Open WilliamTambellini opened 1 year ago
You try to manually add "-static" in the main cmake script: https://github.com/cmp-nct/ggllm.cpp/blob/66aa59e790f097bd8f19e8749c0a7f29e84a0fe1/CMakeLists.txt#L364
According to https://www.man7.org/linux/man-pages/man1/gcc.1.html
-static
On systems that support dynamic linking, this overrides -pie
and prevents linking with the shared libraries. On other
systems, this option has no effect.
I m not sure why you use "-static" but you probably have/had good reasons to. On my side, removing that line does resolve the link issue and generates execs/libs with minimum dyn deps:
ldd falcon_main
linux-vdso.so.1 => (0x00007fffa456b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007efd36cef000)
librt.so.1 => /lib64/librt.so.1 (0x00007efd36ae7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efd368cb000)
libstdc++.so.6 (0x00007efd364cd000)
libm.so.6 => /lib64/libm.so.6 (0x00007efd361cb000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007efd35fb5000)
libc.so.6 => /lib64/libc.so.6 (0x00007efd35be7000)
/lib64/ld-linux-x86-64.so.2 (0x00007efd36ef3000)
which is good for my purpose.
@cmp-nct would you mind if I add a cmake option to not "-static" there: https://github.com/cmp-nct/ggllm.cpp/blob/66aa59e790f097bd8f19e8749c0a7f29e84a0fe1/CMakeLists.txt#L364 ? Best
I'll look into it, I am still burried with a large overhaul of the code and stuck in details. Hope to finish at least a experimental branch before I go on vacation.
Once the new code is ready I'll add the smaller suggestions and fixes, otherwise I'll need to do all twice.
Prerequisites
Your exact command line to replicate the issue
Environment and Context
Physical (or virtual) hardware you are using, e.g. for Linux: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Operating System, e.g. for Linux: CentOS 7 + gcc11.3 + cuda 11.6
Steps to Reproduce
Failure Logs
When adding CMAKE_VERBOSE_MAKEFILE=1:
For some reasons (mainly the added "-static"), cmake adds both "/usr/lib64/librt.so" (not a static lib) and "-lrt" (that one is usually acceptable even for a static build).