oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.34k stars 1.63k forks source link

Issue with SCTP application #5771

Closed akibsayyed closed 8 months ago

akibsayyed commented 1 year ago

Hi

I am trying to build a native app using native-image but it's failing to build one.

I checked in the previous issue#1569 that the feature will be implemented. I would like to know if shared library such as libsctp.so support is implemented or not.

Thank you,

below is my log of native-image building

akib@bootstrap:/opt/project/safeseven$ native-image -jar STP.jar --no-fallback  -H:+ReportExceptionStackTraces 
========================================================================================================================
GraalVM Native Image: Generating 'STP' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (4.6s @ 0.23GB)
 Version info: 'GraalVM 22.3.0 Java 11 CE'
 Java version info: '11.0.17+8-jvmci-22.3-b08'
 C compiler: gcc (linux, x86_64, 9.4.0)
 Garbage collector: Serial GC
[2/7] Performing analysis...  [******]                                                                  (17.3s @ 2.80GB)
   5,753 (82.20%) of  6,999 classes reachable
   7,837 (58.08%) of 13,493 fields reachable
  23,077 (45.29%) of 50,954 methods reachable
     153 classes,     0 fields, and   502 methods registered for reflection
      66 classes,    60 fields, and    61 methods registered for JNI access
       6 native libraries: dl, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (2.4s @ 1.48GB)
[4/7] Parsing methods...      [**]                                                                       (3.2s @ 0.67GB)
[5/7] Inlining methods...     [***]                                                                      (1.3s @ 1.51GB)
[6/7] Compiling methods...    [****]                                                                    (14.0s @ 0.61GB)
[7/7] Creating image...
                                                                                  (0.0s @ 1.42GB)
Fatal error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-10204387894810271685/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /opt/project/safeseven/STP STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-10204387894810271685 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lz -lpthread -ldl -lrt

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --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=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --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 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/opt/project/safeseven/STP' '-v' '-L/tmp/SVM-10204387894810271685' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccAB60pW.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o /opt/project/safeseven/STP -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/tmp/SVM-10204387894810271685 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. --gc-sections --dynamic-list /tmp/SVM-10204387894810271685/exported_symbols.list --exclude-libs ALL -x STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lz -lpthread -ldl -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: STP.o:(.data+0xd0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0'
/usr/bin/ld: STP.o:(.data+0x3b8): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0'
/usr/bin/ld: STP.o:(.data+0x538): undefined reference to `Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0'
/usr/bin/ld: STP.o:(.data+0x728): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_listen0'
/usr/bin/ld: STP.o:(.data+0x8e0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_bindx'
/usr/bin/ld: STP.o:(.data+0x8f0): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect'
/usr/bin/ld: STP.o:(.data+0x9a0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_connect0'
/usr/bin/ld: STP.o:(.data+0x9f0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_preClose0'
/usr/bin/ld: STP.o:(.data+0xc78): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_socket0'
/usr/bin/ld: STP.o:(.data+0xcf0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_close0'
/usr/bin/ld: STP.o:(.data+0xdc8): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_receive0'
/usr/bin/ld: STP.o:(.data+0xdf0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0'
/usr/bin/ld: STP.o:(.data+0xf70): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_send0'
collect2: error: ld returned 1 exit status
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:204)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:718)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
------------------------------------------------------------------------------------------------------------------------
                        1.0s (2.0% of total time) in 21 GCs | Peak RSS: 5.42GB | CPU load: 7.18
========================================================================================================================
Failed generating 'STP' after 48.3s.
Error: Image build request failed with exit status 1
akibsayyed commented 1 year ago

After little research i found that there is libsctp.a which have all the required function so i added -H:NativeLinkerOption=-lsctp to command like as follows but still failing

can anyone help ?

akib@bootstrap:/opt/project/safeseven$ native-image -jar STP.jar -H:+ReportExceptionStackTraces  --no-fallback -H:NativeLinkerOption=-lsctp 
========================================================================================================================
GraalVM Native Image: Generating 'STP' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (4.7s @ 0.22GB)
 Version info: 'GraalVM 22.3.0 Java 11 CE'
 Java version info: '11.0.17+8-jvmci-22.3-b08'
 C compiler: gcc (linux, x86_64, 9.4.0)
 Garbage collector: Serial GC
[2/7] Performing analysis...  [******]                                                                  (19.6s @ 0.72GB)
   5,753 (82.20%) of  6,999 classes reachable
   7,837 (58.08%) of 13,493 fields reachable
  23,077 (45.29%) of 50,954 methods reachable
     153 classes,     0 fields, and   502 methods registered for reflection
      66 classes,    60 fields, and    61 methods registered for JNI access
       6 native libraries: dl, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (2.6s @ 1.81GB)
[4/7] Parsing methods...      [**]                                                                       (2.5s @ 1.09GB)
[5/7] Inlining methods...     [***]                                                                      (1.4s @ 1.94GB)
[6/7] Compiling methods...    [****]                                                                    (16.5s @ 1.96GB)
[7/7] Creating image...
                                                                                  (0.0s @ 2.76GB)
Fatal error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-15976576782537737869/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /opt/project/safeseven/STP STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-15976576782537737869 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lz -lpthread -ldl -lrt -lsctp

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --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=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --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 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/opt/project/safeseven/STP' '-v' '-L/tmp/SVM-15976576782537737869' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cce40QLG.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o /opt/project/safeseven/STP -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/tmp/SVM-15976576782537737869 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. --gc-sections --dynamic-list /tmp/SVM-15976576782537737869/exported_symbols.list --exclude-libs ALL -x STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lz -lpthread -ldl -lrt -lsctp -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libsctp.a(SctpChannelImpl.o): in function `Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs':
SctpChannelImpl.c:(.text.Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs+0x0): multiple definition of `Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs'; /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a(JvmFuncs.o):main/substratevm/mxbuild/linux-amd64-jdk11/com.oracle.svm.native.jvm.posix/amd64/main/substratevm/src/com.oracle.svm.native.jvm.posix/src/JvmFuncs.c:344: first defined here
/usr/bin/ld: /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libsctp.a(SctpNet.o): in function `handleSocketError':
SctpNet.c:(.text.handleSocketError+0x0): multiple definition of `handleSocketError'; /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a(Net.o):Net.c:(.text.handleSocketError+0x0): first defined here
collect2: error: ld returned 1 exit status
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:204)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:718)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
------------------------------------------------------------------------------------------------------------------------
                        1.0s (1.9% of total time) in 21 GCs | Peak RSS: 5.43GB | CPU load: 7.03
========================================================================================================================
Failed generating 'STP' after 52.4s.
Error: Image build request failed with exit status 1
akib@bootstrap:/opt/project/safeseven$ native-image -jar STP.jar -H:+ReportExceptionStackTraces  --no-fallback -H:NativeLinkerOption=-lsctp 
oubidar-Abderrahim commented 1 year ago

Hi, Thank you for reporting this issue. First, do you have all the prerequisites for installing native-image https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites

Also make sure that you're using the tracing agent to generate the Metadat config files as explained in here: https://www.graalvm.org/22.3/reference-manual/native-image/metadata/AutomaticMetadataCollection/

Finally, if you still face the issue, please share a reproducer we can use to further debugging. Thank you

oubidar-Abderrahim commented 1 year ago

hi, Any updates?

akibsayyed commented 1 year ago

I am too much confused about how to generate metadata config files.

can you please guide me

akibsayyed commented 1 year ago

You can try following git repo which is using SCTP based protocols. https://github.com/akibsayyed/safeseven

oubidar-Abderrahim commented 1 year ago

I am too much confused about how to generate metadata config files.

For example, if you run your application using: java -jar app.jar and you want to save the config on a folder named configs; you should use java -agentlib:native-image-agent=config-merge-dir=configs -jar app.jar This will run the app.jar normally where you should test your application to ensure the agent collects as much information as possible.

After that you can add this config files to the native-image build command by adding the flag -H:ConfigurationFileDirectories=configs (same folder used in the agent)

akibsayyed commented 1 year ago

Hi I have tried to execute the process but still facing issue

akib@bootstrap:~/safeseven$ java -agentlib:native-image-agent=config-merge-dir=configs -jar STP.jar stp_config 
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/reflect-config.json (No such file or directory)
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/jni-config.json (No such file or directory)
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/resource-config.json (No such file or directory)
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/proxy-config.json (No such file or directory)
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/serialization-config.json (No such file or directory)
native-image-agent: Warning: could not open configuration file: java.io.FileNotFoundException: /home/akib/safeseven/configs/predefined-classes-config.json (No such file or directory)
*************************************
*****         MAP_SRI           *****
*************************************
Input Stream = sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@fad74ee
0    [main] DEBUG org.matrixshell.mapScanner.STP  - log4j configured
5    [main] DEBUG org.matrixshell.mapScanner.STP  - this.SERVER_PORT 2905
6    [main] DEBUG org.matrixshell.mapScanner.STP  - Routing_Context 1
7    [main] DEBUG org.matrixshell.mapScanner.STP  - Local_SPC_SERVER 10
9    [main] DEBUG org.matrixshell.mapScanner.STP  - CLIENT_IP 192.168.140.132
10   [main] DEBUG org.matrixshell.mapScanner.STP  - Local GT 91966514211
10   [main] DEBUG org.matrixshell.mapScanner.STP  - HLR_PORT 2906
10   [main] DEBUG org.matrixshell.mapScanner.STP  - HLR_IP 192.168.140.1
11   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SSN_MSC 8
11   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SPC_MSC 30
12   [main] DEBUG org.matrixshell.mapScanner.STP  - CLIENT_PORT 2908
12   [main] DEBUG org.matrixshell.mapScanner.STP  - SERVER IP 192.168.140.1
13   [main] DEBUG org.matrixshell.mapScanner.STP  - NETWORK_INDICATOR 2
13   [main] DEBUG org.matrixshell.mapScanner.STP  - IS_SERVER true
14   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SPC_Client 40
14   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SSN_Client 9
16   [main] DEBUG org.matrixshell.mapScanner.STP  - MSC_PORT 2907
17   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SPC_HLR 20
18   [main] DEBUG org.matrixshell.mapScanner.STP  - Local_SSN 6
18   [main] DEBUG org.matrixshell.mapScanner.STP  - Remote_SSN_HLR 7
19   [main] DEBUG org.matrixshell.mapScanner.STP  - MSC_IP 127.0.0.1
19   [main] DEBUG org.matrixshell.mapScanner.STP  - Constructor INIT
20   [main] DEBUG org.matrixshell.mapScanner.STP  - Stack Init
21   [main] DEBUG org.matrixshell.mapScanner.STP  - Initializing SCTP Stack ....
52   [main] WARN  org.mobicents.protocols.sctp.ManagementImpl  - Failed to load the SCTP configuration file. 
/home/akib/safeseven/Client_sctp.xml (No such file or directory)
85   [main] DEBUG org.matrixshell.mapScanner.STP  - Server
85   [main] DEBUG org.matrixshell.mapScanner.STP  - Initialized SCTP Stack ....
86   [main] DEBUG org.matrixshell.mapScanner.STP  - Initializing M3UA Stack ....
151  [main] DEBUG org.matrixshell.mapScanner.STP  - Initialized M3UA Stack ....
151  [main] DEBUG org.matrixshell.mapScanner.STP  - Initializing SCCP Stack ....
157  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - Starting ...
159  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - SCCP Management configuration file path /home/akib/safeseven/MapLoadServerSccpStack_management2.xml
160  [main] WARN  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - Failed to load the Sccp Management configuration file. 
/home/akib/safeseven/MapLoadServerSccpStack_management2.xml (No such file or directory)
168  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.router.RouterImpl  - SCCP Router configuration file path /home/akib/safeseven/MapLoadServerSccpStack_sccprouter2.xml
170  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.router.RouterImpl  - Started SCCP Router
173  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpResourceImpl  - SCCP Resource configuration file path /home/akib/safeseven/MapLoadServerSccpStack_sccpresource2.xml
175  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpResourceImpl  - Started Sccp Resource
176  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - Starting routing engine...
176  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - Starting management ...
177  [main] INFO  org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl-MapLoadServerSccpStack  - Starting MSU handler...
192  [main] DEBUG org.matrixshell.mapScanner.STP  - Initialized SCCP Stack ....
Pattern 91966514211
Pattern in byte  12
202  [main] DEBUG org.matrixshell.mapScanner.STP  - Initializing TCAP Stack ....
222  [main] WARN  org.mobicents.protocols.ss7.tcap.TCAPStackImpl-TCAP  - Failed to load the TCAP Management configuration file. 
/home/akib/safeseven/TCAP_management.xml (No such file or directory)
227  [main] DEBUG org.matrixshell.mapScanner.STP  - Initializing MAP Stack ....
256  [main] DEBUG org.matrixshell.mapScanner.STP  - Initialized MAP Stack ....
257  [main] DEBUG org.matrixshell.mapScanner.STP  - Starting ASP
273  [main] DEBUG org.matrixshell.mapScanner.STP  - ASP Started
Pattern 10000
Pattern in byte  10
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 10000
Pattern in byte  12
Pattern 20000
Pattern in byte  10
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 20000
Pattern in byte  12
Pattern 30000
Pattern in byte  10
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern 30000
Pattern in byte  12
Pattern *
Pattern in byte  12
Pattern *
Pattern in byte  12
Enter your choice
1: Activate SS Request
2: Activate Deactivate SS
3: Erase SS request
4: InterrogateSSRequest
5: Send ProcessUnstructuredSSRequest
6: send RegisterSSRequest
7: Process UnstructuredSSRequest request
^Cakib@bootstrap:~/safesevennative-image -H:ConfigurationFileDirectories=configs -jar STP.jar 
========================================================================================================================
GraalVM Native Image: Generating 'STP' (executable)...
========================================================================================================================
Warning: Could not resolve com.ibm.uvm.tools.DebugSupport for reflection configuration. Reason: java.lang.ClassNotFoundException: com.ibm.uvm.tools.DebugSupport.
Warning: Could not resolve java.lang.ObjectBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: java.lang.ObjectBeanInfo.
Warning: Could not resolve java.lang.ObjectCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: java.lang.ObjectCustomizer.
Warning: Could not resolve org.apache.log4j.AppenderSkeletonBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.AppenderSkeletonBeanInfo.
Warning: Could not resolve org.apache.log4j.AppenderSkeletonCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.AppenderSkeletonCustomizer.
Warning: Could not resolve org.apache.log4j.FileAppenderBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.FileAppenderBeanInfo.
Warning: Could not resolve org.apache.log4j.FileAppenderCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.FileAppenderCustomizer.
Warning: Could not resolve org.apache.log4j.LayoutBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.LayoutBeanInfo.
Warning: Could not resolve org.apache.log4j.LayoutCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.LayoutCustomizer.
Warning: Could not resolve org.apache.log4j.PatternLayoutBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.PatternLayoutBeanInfo.
Warning: Could not resolve org.apache.log4j.PatternLayoutCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.PatternLayoutCustomizer.
Warning: Could not resolve org.apache.log4j.RollingFileAppenderBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.RollingFileAppenderBeanInfo.
Warning: Could not resolve org.apache.log4j.RollingFileAppenderCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.RollingFileAppenderCustomizer.
Warning: Could not resolve org.apache.log4j.WriterAppenderBeanInfo for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.WriterAppenderBeanInfo.
Warning: Could not resolve org.apache.log4j.WriterAppenderCustomizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.WriterAppenderCustomizer.
[1/7] Initializing...                                                                                    (4.3s @ 0.22GB)
 Version info: 'GraalVM 22.3.0 Java 11 CE'
 Java version info: '11.0.17+8-jvmci-22.3-b08'
 C compiler: gcc (linux, x86_64, 9.4.0)
 Garbage collector: Serial GC
[2/7] Performing analysis...  [******]                                                                  (18.5s @ 0.57GB)
   5,781 (82.28%) of  7,026 classes reachable
   7,913 (58.23%) of 13,590 fields reachable
  23,210 (45.42%) of 51,106 methods reachable
     195 classes,     0 fields, and   568 methods registered for reflection
      66 classes,    60 fields, and    61 methods registered for JNI access
       6 native libraries: dl, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (2.3s @ 1.64GB)
[4/7] Parsing methods...      [**]                                                                       (2.5s @ 0.81GB)
[5/7] Inlining methods...     [***]                                                                      (1.1s @ 1.64GB)
[6/7] Compiling methods...    [****]                                                                    (13.6s @ 0.93GB)
[7/7] Creating image...
                                                                                  (0.0s @ 1.74GB)
Fatal error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-10396712391454251955/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /home/akib/safeseven/STP STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-10396712391454251955 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lz -lpthread -ldl -lrt

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --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=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --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 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/akib/safeseven/STP' '-v' '-L/tmp/SVM-10396712391454251955' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc' '-L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccZe1V0R.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o /home/akib/safeseven/STP -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/tmp/SVM-10396712391454251955 -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc -L/opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. --gc-sections --dynamic-list /tmp/SVM-10396712391454251955/exported_symbols.list --exclude-libs ALL -x STP.o /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libextnet.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libnio.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libjava.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libmanagement_ext.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libawt.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/static/linux-amd64/glibc/libzip.a /opt/project/graalvm/graalvm-ce-java11-22.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lz -lpthread -ldl -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: STP.o:(.data+0x180): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_send0'
/usr/bin/ld: STP.o:(.data+0x190): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_listen0'
/usr/bin/ld: STP.o:(.data+0x4a8): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect'
/usr/bin/ld: STP.o:(.data+0x4c8): undefined reference to `Java_sun_nio_ch_sctp_SctpChannelImpl_receive0'
/usr/bin/ld: STP.o:(.data+0x688): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0'
/usr/bin/ld: STP.o:(.data+0x748): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_bindx'
/usr/bin/ld: STP.o:(.data+0x778): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0'
/usr/bin/ld: STP.o:(.data+0x9c0): undefined reference to `Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0'
/usr/bin/ld: STP.o:(.data+0xab8): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0'
/usr/bin/ld: STP.o:(.data+0xcf0): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_preClose0'
/usr/bin/ld: STP.o:(.data+0xd08): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_connect0'
/usr/bin/ld: STP.o:(.data+0xd50): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_socket0'
/usr/bin/ld: STP.o:(.data+0xfc8): undefined reference to `Java_sun_nio_ch_sctp_SctpNet_close0'
collect2: error: ld returned 1 exit status
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:204)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:718)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
------------------------------------------------------------------------------------------------------------------------
                        0.9s (1.9% of total time) in 21 GCs | Peak RSS: 5.42GB | CPU load: 7.47
========================================================================================================================
Failed generating 'STP' after 47.7s.
Error: Image build request failed with exit status 1
akib@bootstrap:~/safeseven$ ^C
petermz commented 1 year ago

I think adding -H:NativeLinkerOption=-lsctp was a step in the right direction; the reason it failed was a duplicate symbol defined in both libsctp.a and libnio.a. One solution to try could be to create a version of libsctp.a with the conflicting symbol stripped or hidden/made local.

akibsayyed commented 1 year ago

May i know how can i achieve this .

I already gave a try for masking or renaming the functions but no luck.

oubidar-Abderrahim commented 1 year ago

It seems that SCTP is still not support in native-image.

oubidar-Abderrahim commented 1 year ago

relates to #1569