[openjfx11] Review request for 8203294: [Linux] Link libgcc and libstdc++ statically to support gcc-7.x

Arunprasad Rajkumar arunprasad.rajkumar at oracle.com
Tue May 22 05:28:13 UTC 2018


Please review the following fix: 


Root cause: 
Currently C and C++ standard libraries are linked dynamically(except javafx.web), it may restrict the usage of javafx on old Linux distros when we upgrade to latest compiler(GCC 7.3?) 

Fix all javafx module dynamic library linking process to use '-static-libgcc -static-libstdc++' flags to force the static linking of standard libs. Additionally '-ffunction-sections -fdata-sections' GCC compiler flags[1] are used to reduce the library size due to static linking.

Used the following command to see the size difference of javafx libraries with and without static linking 
find build/modular-sdk/modules_libs/ -type f -name *.so -exec ls -lh {} \; -exec sh -c 'ls -lh $JAVA_HOME/lib/$(basename {})' \; 

Used the following command to verify the fix, 
find build/modular-sdk/modules_libs -name *.so -exec sh -c "readelf -d {} | egrep 'libgcc|libstdc++' > /dev/null && echo {}" \; 

[1] https://gcc.gnu.org/onlinedocs/gnat_ugn/Compilation-options.html


More information about the openjfx-dev mailing list