intel / intel/intel-graphics-compiler

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

Open
#331 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
718
Forks
191
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.