-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alpine Linux platform support #148
Comments
sorry, error in documentation, need to update. The @next refers to old release. Could you please try with the standard |
@bsrdjan still the same error:
|
Does the build from source starts after npm install ? If not, could you try to build from source on Alpine container? I need to test. |
Yes, I believe it is building from source successfully. I had to Here is the output from the docker build (I truncated the beginning as I don't think its relevant). See
Then run the container:
Error in startup:
EDIT: Repasted latest log which eliminates @latest tag from the npm install of node-rfc. Problem still persists. |
I forked the node-red-docker project and commited the custom make file for noderfc. Hopefully it helps you if you want to test it https://github.com/PaulWieland/node-red-docker/tree/master/docker-custom |
Does it have to be Alpine Linux? SAP NWRFC SDK is not supported on Alpine, here the list of supported platforms: https://launchpad.support.sap.com/#/notes/2573790 Did it work on nodeRED before, was it another Linux? The SDK usually works on common desktop/server Linux distros, with node-rfc built from source. Alpine is maybe different and SDK need to be compiled on that platform. That could be the feature request for SAP, because the SDK is closed source. |
Hi @bsrdjan, yes it worked on NodeRED before. The issue is that they changed their docker base image to use alpine in order to make it small and efficient. alpine is quite popular, it is the default base image for nodeJS docker containers (which is why NodeRED uses it), so a lot of nodeJS projects will be built on top of alpine. It would be really good to figure out how to get node-rfc and the NWRFC SDK working with it. |
Small update - I think this problem is related to alpine's use of Here's the truncated output of
Notice that it's using |
Could you please send me the Dockerfile that I can build and logon to shell, to check? The build with Dockerfile above ends with error: $ docker build -t rfcami .
Sending build context to Docker daemon 1.084GB
Step 1/42 : ARG ARCH=amd64
Step 2/42 : ARG NODE_VERSION=10
Step 3/42 : ARG OS=alpine
Step 4/42 : FROM ${ARCH}/node:${NODE_VERSION}-${OS} AS base
---> a07f309c9753
Step 5/42 : COPY scripts/*.sh /tmp/
---> Using cache
---> 84762f076463
Step 6/42 : RUN set -ex && apk add --no-cache bash tzdata iputils curl nano git openssl openssh-client && mkdir -p /usr/src/node-red /data && deluser --remove-home node && adduser -h /usr/src/node-red -D -H node-red -u 1000 && chown -R node-red:root /data && chmod -R g+rwX /data && chown -R node-red:root /usr/src/node-red && chmod -R g+rwX /usr/src/node-red
---> Using cache
---> 4570acf7e6ce
Step 7/42 : WORKDIR /usr/src/node-red
---> Using cache
---> e669dcbbcd27
Step 8/42 : COPY package.json .
---> Using cache
---> f151bfc37138
Step 9/42 : FROM base AS build
---> f151bfc37138
Step 10/42 : RUN apk add --no-cache --virtual buildtools build-base linux-headers udev python && npm install --unsafe-perm --no-update-notifier --only=production && /tmp/remove_native_gpio.sh && cp -R node_modules prod_node_modules
---> Running in cf2018fa2ff5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/28) Installing binutils (2.33.1-r0)
(2/28) Installing file (5.37-r1)
(3/28) Installing gmp (6.1.2-r1)
(4/28) Installing isl (0.18-r0)
(5/28) Installing libgomp (9.2.0-r4)
(6/28) Installing libatomic (9.2.0-r4)
(7/28) Installing mpfr4 (4.0.2-r1)
(8/28) Installing mpc1 (1.1.0-r1)
(9/28) Installing gcc (9.2.0-r4)
(10/28) Installing musl-dev (1.1.24-r2)
(11/28) Installing libc-dev (0.7.2-r0)
(12/28) Installing g++ (9.2.0-r4)
(13/28) Installing make (4.2.1-r2)
(14/28) Installing fortify-headers (1.1-r0)
(15/28) Installing build-base (0.5-r1)
(16/28) Installing linux-headers (4.19.36-r0)
(17/28) Installing udev-init-scripts (33-r0)
Executing udev-init-scripts-33-r0.post-install
(18/28) Installing eudev-libs (3.2.9-r1)
(19/28) Installing libblkid (2.34-r1)
(20/28) Installing xz-libs (5.2.4-r0)
(21/28) Installing kmod (26-r0)
(22/28) Installing eudev (3.2.9-r1)
(23/28) Installing libbz2 (1.0.8-r1)
(24/28) Installing libffi (3.2.1-r6)
(25/28) Installing gdbm (1.13-r1)
(26/28) Installing sqlite-libs (3.30.1-r2)
(27/28) Installing python2 (2.7.18-r0)
(28/28) Installing buildtools (20200530.044651)
Executing busybox-1.31.1-r9.trigger
Executing eudev-3.2.9-r1.trigger
OK: 252 MiB in 64 packages
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN docker-alpine@1.0.0 No repository field.
up to date in 0.451s
found 0 vulnerabilities
/bin/sh: /tmp/remove_native_gpio.sh: not found
The command '/bin/sh -c apk add --no-cache --virtual buildtools build-base linux-headers udev python && npm install --unsafe-perm --no-update-notifier --only=production && /tmp/remove_native_gpio.sh && cp -R node_modules prod_node_modules' returned a non-zero code: 127
$ |
This should work:
You can connect to the shell after it's running.
|
As you already found out, the problem is # Alpine
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/9.2.0/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-9.2.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 9.2.0' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,objc,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 9.2.0 (Alpine 9.2.0)
# GNU
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) According to Alpine wiki Running glibc programs it could be eventually possible, with try & errors ... Making |
@bsrdjan agree the best case would be for SAP to support musl, I just don't know what the likely hood is of that ever happening (or where to even submit the request). In the short term, it is possible to install glibc on alpine as there is a pretty well maintained add on for it. The problem is I don't know how to get |
After the glibc added to node-rfc build script, the build fails with: Linking CXX shared library ../lib/binding/sapnwrfc.node
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld:
cannot find /usr/glibc-compat/lib/libc_nonshared.a No idea why but here the setup which can used for further testing. Dockerfile.custom I added sudo, use the latest NWRFC SDK PL6 and mapped the local node-rfc repository clone to docker volume, to test build options. # setup:
# Clone the node-rfc repository and map the node-rfc folder to docker volume
# rebuild:
# docker stop node-rfc-red && docker rm node-rfc-red && docker rmi testing:node-red-build
# ./docker-make.sh
# run:
# docker run -it --name node-rfc-red -p1880:1880 -v /Users/d037732/src:/usr/src/node-red/src testing:node-red-build &
# docker exec -it node-rfc-red /bin/bash
#
# Build script to add SAP's node-rfc to Node RED.
# Download and save nwrfc750P_4-70002752.zip into the same directory as this build script
ARG ARCH=amd64
ARG NODE_VERSION=10
ARG OS=alpine
#### Stage BASE ########################################################################################################
FROM ${ARCH}/node:${NODE_VERSION}-${OS} AS base
# Copy scripts
COPY scripts/*.sh /tmp/
# Install tools, create Node-RED app and data dir, add user and set rights
RUN set -ex && \
apk add --no-cache \
bash \
tzdata \
iputils \
curl \
nano \
git \
openssl \
vim \
libstdc++6 musl-utils sudo su-exec \
openssh-client && \
mkdir -p /usr/src/node-red /data && \
deluser --remove-home node && \
adduser -h /usr/src/node-red -D -H node-red -u 1000 && \
chown -R node-red:root /data && chmod -R g+rwX /data && \
chown -R node-red:root /usr/src/node-red && chmod -R g+rwX /usr/src/node-red && \
echo "node-red ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# chown -R node-red:node-red /data && \
# chown -R node-red:node-red /usr/src/node-red
# Set work directory
WORKDIR /usr/src/node-red
# package.json contains Node-RED NPM module and node dependencies
COPY package.json .
#### Stage BUILD #######################################################################################################
FROM base AS build
# Install Build tools
RUN apk add --no-cache --virtual buildtools build-base linux-headers udev python && \
npm install --unsafe-perm --no-update-notifier --only=production && \
/tmp/remove_native_gpio.sh && \
cp -R node_modules prod_node_modules
#### Stage RELEASE #####################################################################################################
FROM base AS RELEASE
ARG BUILD_DATE
ARG BUILD_VERSION
ARG BUILD_REF
ARG NODE_RED_VERSION
ARG ARCH
ARG TAG_SUFFIX=default
LABEL org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.docker.dockerfile=".docker/Dockerfile.alpine" \
org.label-schema.license="Apache-2.0" \
org.label-schema.name="Node-RED" \
org.label-schema.version=${BUILD_VERSION} \
org.label-schema.description="Low-code programming for event-driven applications." \
org.label-schema.url="https://nodered.org" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/node-red/node-red-docker" \
org.label-schema.arch=${ARCH} \
authors="Dave Conway-Jones, Nick O'Leary, James Thomas, Raymond Mouthaan"
COPY --from=build /usr/src/node-red/prod_node_modules ./node_modules
# Chown, install devtools & Clean up
RUN chown -R node-red:root /usr/src/node-red && \
/tmp/install_devtools.sh && \
rm -r /tmp/*
USER node-red
# Env variables
ENV NODE_RED_VERSION=$NODE_RED_VERSION \
NODE_PATH=/usr/src/node-red/node_modules:/data/node_modules \
FLOWS=flows.json
# ENV NODE_RED_ENABLE_SAFE_MODE=true # Uncomment to enable safe start mode (flows not running)
# ENV NODE_RED_ENABLE_PROJECTS=true # Uncomment to enable projects option
#### SAP RFC Stuff
# Install SAP RFC per these instructions
# http://sap.github.io/node-rfc/install.html#sap-nw-rfc-library-installation
# Add bash
# RUN apk add --no-cache bash
# SHELL ["/bin/bash", "-c"]
USER root
RUN mkdir -p /usr/local/sap/nwrfcsdk
ENV SAPNWRFC_HOME /usr/local/sap/nwrfcsdk
WORKDIR ${SAPNWRFC_HOME}
# Copy SAP rfc sdk zip (the latest is PL6)
COPY ./nwrfc750P_6-70002752.zip ${SAPNWRFC_HOME}/
RUN unzip nwrfc750P_6-70002752.zip
RUN mv nwrfcsdk/* ./
RUN chmod a+x ${SAPNWRFC_HOME}/bin/*
RUN rmdir nwrfcsdk
RUN rm nwrfc750P_6-70002752.zip
# ENV LD_LIBRARY_PATH /usr/local/sap/nwrfcsdk/lib
ENV LD_LIBRARY_PATH /lib:/usr/lib:/usr/glibc-compat/lib:/usr/local/sap/nwrfcsdk/lib
# Add GLIBC
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk
RUN apk add glibc-2.31-r0.apk
#
RUN apk add cmake
RUN apk add libuuid
USER node-red
ENV SAPNWRFC_HOME /usr/local/sap/nwrfcsdk
# ENV LD_LIBRARY_PATH /usr/local/sap/nwrfcsdk/lib
WORKDIR /data
# RUN ldconfig
RUN npm install node-rfc
RUN npm install node-red-contrib-saprfc
### END SAP RFC Stuff
WORKDIR /usr/src/node-red
# User configuration directory volume
VOLUME ["/data"]
# Expose the listening port of node-red
EXPOSE 1880
# Add a healthcheck (default every 30 secs)
# HEALTHCHECK CMD curl http://localhost:1880/ || exit 1
ENTRYPOINT ["npm", "start", "--cache", "/data/.npm", "--", "--userDir", "/data"] The glibc is added to node-rfc build script (search for glibc): Cmake # cmake standard
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0042 NEW)
# verbose
set(CMAKE_VERBOSE_MAKEFILE ON)
# C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# project
execute_process(COMMAND node -p "require('./package.json').version"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION)
string(REPLACE "\n" "" VERSION ${VERSION})
project(sapnwrfc VERSION ${VERSION})
# node platform
execute_process(COMMAND node -p "process.platform"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_PLATFORM)
string(REPLACE "\n" "" NODE_PLATFORM ${NODE_PLATFORM})
string(REPLACE "\"" "" NODE_PLATFORM ${NODE_PLATFORM})
# node version
execute_process(COMMAND node -v WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_VERSION)
string(REPLACE "\n" "" NODE_VERSION ${NODE_VERSION})
# node abi version
execute_process(COMMAND node -p "process.versions.modules"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_ABI_VERSION)
string(REPLACE "\n" "" NODE_ABI_VERSION ${NODE_ABI_VERSION})
string(REPLACE "\"" "" NODE_ABI_VERSION ${NODE_ABI_VERSION})
# N-API
set (NAPI_BUILD_VERSION 3)
add_compile_definitions(NAPI_VERSION=${NAPI_BUILD_VERSION})
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NAPI_INCLUDE_DIR
)
string(REPLACE "\n" "" NAPI_INCLUDE_DIR ${NAPI_INCLUDE_DIR})
string(REPLACE "\"" "" NAPI_INCLUDE_DIR ${NAPI_INCLUDE_DIR})
# NodeJS headers download, if needed
if (NOT DEFINED ENV{NODE_HEADERS_INCLUDE_DIR})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
execute_process(COMMAND cmd /c "npm -g prefix"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_HEADERS_INCLUDE_DIR
)
else()
execute_process(COMMAND npm -g prefix
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_HEADERS_INCLUDE_DIR
)
endif()
string(CONCAT NODE_HEADERS_INCLUDE_DIR ${NODE_HEADERS_INCLUDE_DIR} "/include")
string(REPLACE "\n" "" NODE_HEADERS_INCLUDE_DIR ${NODE_HEADERS_INCLUDE_DIR})
if (NOT EXISTS "${NODE_HEADERS_INCLUDE_DIR}")
set(NODE_HEADERS_FILENAME "node-${NODE_VERSION}-headers.tar.gz")
set(NODE_HEADERS_DOWNLD_PATH ${CMAKE_CURRENT_BINARY_DIR}/${NODE_HEADERS_FILENAME})
message("Downloading ${NODE_HEADERS_FILENAME} to ${NODE_HEADERS_DOWNLD_PATH} ...")
file(DOWNLOAD "https://nodejs.org/download/release/${NODE_VERSION}/${NODE_HEADERS_FILENAME}" "${NODE_HEADERS_DOWNLD_PATH}" ) # SHOW_PROGRESS)
execute_process(COMMAND tar -xzf ${NODE_HEADERS_DOWNLD_PATH})
file(REMOVE ${NODE_HEADERS_DOWNLD_PATH})
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/node-${NODE_VERSION}/include" "${NODE_HEADERS_INCLUDE_DIR}")
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/node-${NODE_VERSION}")
endif()
endif()
# build and binding path
string(CONCAT ADDON_BINDING_PATH "node-v" ${NODE_ABI_VERSION} "-" ${NODE_PLATFORM} "-" ${NODE_ARCH} )
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/binding/)
# sapnwrfc dependencies
set(SAPNWRFC_INCLUDE_DIR $ENV{SAPNWRFC_HOME}/include)
set(SAPNWRFC_LIB_DIR $ENV{SAPNWRFC_HOME}/lib)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(SAPNWRFC_LIB_FILES sapnwrfc.lib libsapucum.lib)
else()
set(SAPNWRFC_LIB_FILES -lsapnwrfc -lsapucum)
endif()
# glibc dependency
set(GLIBC_LIB_DIR /usr/glibc-compat/lib)
set(GLIBC_LIB_FILES -lc)
# source files and target library
add_library(${PROJECT_NAME} SHARED src/node_sapnwrfc.cc src/Client.cc src/rfcio.cc src/noderfcsdk.cc src/Throughput.cc ) # src/Pool.cc)
# build path ignored on Windows, copy after build
if ( MSVC )
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${PROJECT_NAME}>"
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\\$<TARGET_FILE_NAME:${PROJECT_NAME}>"
COMMENT "Copying to output directory" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif ( MSVC )
#
# build
#
# All platforms
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions")
#target_compile_options(${PROJECT_NAME} PUBLIC -fno-exceptions)
# https://launchpad.support.sap.com/#/notes/2573953
target_compile_definitions(${PROJECT_NAME} PUBLIC
_CONSOLE
SAPwithUNICODE UNICODE _UNICODE
_FILE_OFFSET_BITS=64
_LARGEFILE_SOURCE
NDEBUG
SAPwithTHREADS
NAPI_CPP_EXCEPTION)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# show SAP NWRFC SDK version
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ci/utils/nwrfcsdk-version-linux.sh OUTPUT_VARIABLE SAPNWRFCSDK_VERSION)
message("SAP NWRFC SDK: " ${SAPNWRFCSDK_VERSION})
target_compile_options(${PROJECT_NAME} PUBLIC -std=c++11 -Wall)
add_compile_definitions(
SAPonLIN
SAPonUNIX
__NO_MATH_INLINES)
target_link_directories(${PROJECT_NAME} PRIVATE ${GLIBC_LIB_DIR})
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} ${GLIBC_LIB_FILES})
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# show SAP NWRFC SDK version
execute_process(
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}\\ci\\utils\\nwrfcsdk-version.bat"
OUTPUT_VARIABLE SAPNWRFCSDK_VERSION)
message("SAP NWRFC SDK: " ${SAPNWRFCSDK_VERSION})
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically
target_compile_options(${PROJECT_NAME} PUBLIC
-EHs
-Gy
-J
-MD
-nologo
-W3
-Z7
-GL -O2 -Oy-
/we4552 /we4700 /we4789
)
target_compile_definitions(${PROJECT_NAME} PUBLIC
SAP_PLATFORM_MAKENAME=ntintel
SAPonNT
_CRT_NON_CONFORMING_SWPRINTFS
_CRT_SECURE_NO_DEPRECATE
#_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_DEPRECATE
_AFXDLL
WIN32
_WIN32_WINNT=0x0502
_ATL_ALLOW_CHAR_UNSIGNED
)
# https://docs.microsoft.com/en-us/cpp/build/reference/linker-options?view=vs-2019
target_link_options(${PROJECT_NAME} PUBLIC
/NXCOMPAT
/SWAPRUN:NET
/OPT:REF
/NOLOGO
/LTCG
)
if (${NODE_ARCH} STREQUAL "ia32")
target_compile_definitions(${PROJECT_NAME} PUBLIC _X86_ )
target_link_options(${PROJECT_NAME} PUBLIC
-STACK:0x800000
-DEBUGTYPE:CV
-MACHINE:x86
-LARGEADDRESSAWARE
)
else()
target_compile_definitions(${PROJECT_NAME} PUBLIC WIN64 _AMD64_ )
target_link_options(${PROJECT_NAME} PUBLIC
-STACK:0x2000000
-DEBUG
-DEBUGTYPE:CV,FIXUP
-MACHINE:amd64
)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# show SAP NWRFC SDK version
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ci/utils/nwrfcsdk-version-darwin.sh OUTPUT_VARIABLE SAPNWRFCSDK_VERSION)
message("SAP NWRFC SDK: " ${SAPNWRFCSDK_VERSION})
target_compile_options(${PROJECT_NAME} PUBLIC -stdlib=libc++ -std=c++0x -Wall -mmacosx-version-min=10.10)
add_compile_definitions(
SAPonDARW
__NO_MATH_INLINES)
endif()
# set .node extension without any "lib" prefix
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
set (${PROJECT_NAME}_USE_STATIC_LIBS OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
# build target
target_include_directories(${PROJECT_NAME} PRIVATE "${NODE_HEADERS_INCLUDE_DIR}/node" ${NAPI_INCLUDE_DIR} ${SAPNWRFC_INCLUDE_DIR})
target_link_directories(${PROJECT_NAME} PRIVATE ${SAPNWRFC_LIB_DIR})
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} ${SAPNWRFC_LIB_FILES}) The node-rfc re-build is done by following command, resulting in above mentioned error: npm run prebuild The linker invocation command is traced in /usr/bin/c++ -fPIC -O3 -DNDEBUG -shared -Wl,-soname,sapnwrfc.node -o ../lib/binding/sapnwrfc.node
CMakeFiles/sapnwrfc.dir/src/node_sapnwrfc.cc.o
CMakeFiles/sapnwrfc.dir/src/Client.cc.o
CMakeFiles/sapnwrfc.dir/src/rfcio.cc.o
CMakeFiles/sapnwrfc.dir/src/noderfcsdk.cc.o
CMakeFiles/sapnwrfc.dir/src/Throughput.cc.o
-L/usr/glibc-compat/lib -L/usr/local/sap/nwrfcsdk/lib
-Wl,-rpath,/usr/glibc-compat/lib:/usr/local/sap/nwrfcsdk/lib
-lc -lsapnwrfc -lsapucum Following this thread I added libc-dev to Dockerfile.custom but no effect. Not sure why this lib is required and if that is the correct lib or perhaps there is a "compat" counterpart? glibc-compat experts might eventually help? |
@bsrdjan Thank you so much for taking the time to troubleshoot this. I haven't got a lot of time today, but hopefully in the next few days I can take what you've done and do some further experimentation. I got a hit for EDIT: it's here;
|
The $ npm run prebuild
...
[100%] Linking CXX shared library ../lib/binding/sapnwrfc.node
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld:
/usr/glibc-compat/lib/libc.a(malloc.o): relocation R_X86_64_TPOFF32 against `tcache' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld:
/usr/glibc-compat/lib/libc.a(assert.o): relocation R_X86_64_PC32 against symbol `__progname' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: final link failed: bad value |
Closing. I don't think this is possible or practical without a native MUSL version of nwrfc from SAP. |
@PaulWieland I found the place where to submit the request: https://launchpad.support.sap.com/#/notes/11 I personally consider the requirement relevant and it would be great if you could describe in more detail and submit the request. No guarantee it will be adopted but it helps when others can find and support the request. |
So i'm logged into the customer influence website. It seems that in order to submit an improvement request, I first have to pick a platform that I want improved - however I don't find anything seemingly relevant to the NWRFC software. Searching for Any ideas? |
The feature request shall be created for Please mention the SAP NWRFC SDK in the request title and share the request link here. |
To make the node-rfc available on Alpine Linux, SAP NWRFC SDK shall be supported on that platform. You can create or vote for SAP NWRFC SDK feature request, please see my comment above: #148 (comment) |
Hello @bsrdjan |
I'm trying to deploy noderfc under Alpine Linux (specifically node-red docker), but it seems like I might be having issues with ldconfig.
My dockerfile builds, but when my program runs I get the following error:
Error: Error relocating /usr/local/sap/nwrfcsdk/lib/libsapnwrfc.so: __strdup: symbol not found
This is a really similar error as this one, so I am assuming this is an ldconfig problem. However I'm learning that under alpine
ldconfig
is somehow different from other mainstream linux distros.I read that under alpine linux
LD_LIBRARY_PATH=/usr/local/sap/nwrfcsdk/lib
should accomplish the same as loading the/etc/ld.so.conf.d/nwrfcsdk.conf
withldconfig
as you would do in other distros, but clearly something isn't working.Any ideas?
Here is my dockerfile (scroll to #### SAP RFC Stuff, the rest is standard node-red dockerfile).
P.S. There is a curl command to pull the nwrfcsdk.zip file from a local server since I do not think SAP hosts this file for public download - if I'm wrong about that please let me know so I can make a dockerfile that will work for everyone.
The text was updated successfully, but these errors were encountered: