Skip to content
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

Building IGC and LLVM from source with -static-libgcc and -static-libstdc++ produces libs of several gigabytes in size #331

Open
alucryd opened this issue Jun 7, 2024 · 0 comments

Comments

@alucryd
Copy link

alucryd commented Jun 7, 2024

Hi, there seems to be a link issue whenever trying to statically linking libgcc and libstdc++, happens with the last release, also tested 1.0.15468.28:

drwxr-xr-x 2 embybuilder embybuilder 4.0K Jun  7 13:11 igc/
lrwxrwxrwx 1 embybuilder embybuilder   13 Jun  7 13:11 libiga64.so -> libiga64.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   17 Jun  7 13:11 libiga64.so.1 -> libiga64.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder  33M Jun  7 13:11 libiga64.so.1.0.1*
lrwxrwxrwx 1 embybuilder embybuilder   11 Jun  7 13:11 libigc.so -> libigc.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   15 Jun  7 13:11 libigc.so.1 -> libigc.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder 2.4G Jun  7 13:11 libigc.so.1.0.1*
lrwxrwxrwx 1 embybuilder embybuilder   14 Jun  7 13:11 libigdfcl.so -> libigdfcl.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   18 Jun  7 13:11 libigdfcl.so.1 -> libigdfcl.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder  38M Jun  7 13:11 libigdfcl.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder 3.1G Jun  7 13:11 libopencl-clang.so.14*
drwxr-xr-x 2 embybuilder embybuilder 4.0K Jun  7 13:11 pkgconfig/

This does not happen without them:

drwxr-xr-x 2 embybuilder embybuilder 4.0K Jun  7 15:15 igc/
lrwxrwxrwx 1 embybuilder embybuilder   13 Jun  7 15:15 libiga64.so -> libiga64.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   17 Jun  7 15:15 libiga64.so.1 -> libiga64.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder 2.5M Jun  7 15:15 libiga64.so.1.0.1*
lrwxrwxrwx 1 embybuilder embybuilder   11 Jun  7 15:15 libigc.so -> libigc.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   15 Jun  7 15:15 libigc.so.1 -> libigc.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder  83M Jun  7 15:15 libigc.so.1.0.1*
lrwxrwxrwx 1 embybuilder embybuilder   14 Jun  7 15:15 libigdfcl.so -> libigdfcl.so.1*
lrwxrwxrwx 1 embybuilder embybuilder   18 Jun  7 15:15 libigdfcl.so.1 -> libigdfcl.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder 1.9M Jun  7 15:15 libigdfcl.so.1.0.1*
-rwxr-xr-x 1 embybuilder embybuilder 111M Jun  7 15:15 libopencl-clang.so.14*
drwxr-xr-x 2 embybuilder embybuilder 4.0K Jun  7 15:15 pkgconfig/

The compiler is built using GCC from a crosstool toolchain.

CMake command: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/home/embybuilder/Buildbot/x64/cmake/cross.cmake -DCMAKE_INSTALL_PREFIX=/home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/staging -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SKIP_RPATH=ON -DIGC_OPTION__ARCHITECTURE_TARGET=Linux64 -DIGC_OPTION__ARCHITECTURE_HOST=Linux64 -DIGC_OPTION__LLVM_MODE=Source -Wno-dev

CMake cross file:

cmake_minimum_required( VERSION 2.8.12 )

set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SYSROOT "/home/embybuilder/Buildbot/x64/toolchain/x86_64-emby-linux-gnu/sysroot")
set(CMAKE_FIND_ROOT_PATH "/home/embybuilder/Buildbot/x64/toolchain")
set(CMAKE_C_COMPILER "x86_64-emby-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "x86_64-emby-linux-gnu-g++")
set(CMAKE_C_COMPILER_LAUNCHER "sccache")
set(CMAKE_CXX_COMPILER_LAUNCHER "sccache")
set(CMAKE_CPP_FLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -I/home/embybuilder/Buildbot/x64/staging/include")
set(CMAKE_C_FLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -I/home/embybuilder/Buildbot/x64/staging/include")
set(CMAKE_CXX_FLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -I/home/embybuilder/Buildbot/x64/staging/include")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -static-libgcc -static-libstdc++ -L/home/embybuilder/Buildbot/x64/staging/lib -Wl,-rpath-link,/home/embybuilder/Buildbot/x64/staging/lib")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -static-libgcc -static-libstdc++ -L/home/embybuilder/Buildbot/x64/staging/lib -Wl,-rpath-link,/home/embybuilder/Buildbot/x64/staging/lib")

Statically linking these libs is desirable to be more portable, any idea what's going on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant