Skip to content

linking error with static build #76

Description

@WilliamTambellini

Prerequisites

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Your exact command line to replicate the issue

cmake ..  -DLLAMA_CUBLAS=ON -DLLAMA_STATIC=1
make

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

  1. cmake .. -DLLAMA_CUBLAS=ON -DLLAMA_STATIC=1
  2. make

Failure Logs

...
Consolidate compiler generated dependencies of target quantize-stats
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: attempted static link of dynamic object `/usr/lib64/librt.so'
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: attempted static link of dynamic object `/usr/lib64/librt.so'
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: attempted static link of dynamic object `/usr/lib64/librt.so'
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: attempted static link of dynamic object `/usr/lib64/librt.so'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/test-sampling] Error 1
collect2: error: ld returned 1 exit status
make[2]: *** [bin/test-quantize-perf] Error 1
collect2: error: ld returned 1 exit status
make[1]: *** [tests/CMakeFiles/test-sampling.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [bin/falcon_quantize] Error 1
collect2: error: ld returned 1 exit status
make[1]: *** [tests/CMakeFiles/test-quantize-perf.dir/all] Error 2
make[1]: *** [examples/falcon_quantize/CMakeFiles/falcon_quantize.dir/all] Error 2
make[2]: *** [bin/test-quantize-fns] Error 1
make[1]: *** [tests/CMakeFiles/test-quantize-fns.dir/all] Error 2

When adding CMAKE_VERBOSE_MAKEFILE=1:

g++ -O3 -DNDEBUG -static CMakeFiles/quantize-stats.dir/quantize-stats.cpp.o -o ../../bin/quantize-stats   
-L/usr/local/cuda/targets/x86_64-linux/lib/stubs  -L/usr/local/cuda/targets/x86_64-linux/lib  
../../libllama.a -pthread /usr/local/cuda/lib64/libcudart_static.a -pthread -ldl 
/usr/lib64/librt.so /usr/local/cuda/lib64/libcublas_static.a /usr/local/cuda/lib64/libcublasLt_static.a 
/usr/local/cuda/lib64/libculibos.a -lcudadevrt -lcudart_static 
-lrt -lpthread -ldl 

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions