Closed schamane closed 1 year ago
Do I understand correctly that the added code just removes "-static" option from compiler options when compiling extras and tests?
CC @LoganDark just in case -- he is more familliar with C/C++ :)
Yes, at least on macosx you dont need "-static" flag to build binaries, it event worse. It break your build.
https://leanprover-community.github.io/archive/stream/113488-general/topic/libgmp.20dependency.html
Yeah no, this is a grave misunderstanding of the screenshotted article. You only can't statically link libSystem.dylib
. You can however statically link with individual libraries. There should be no problem here
Thats true @LoganDark, but on mac build process crash if you try to build statically tests and extras...
tests and extras binaries will be successful statically build with librwkv.a even without "-static" flag.
Here is the way to reproduce:
mkdir build && cd build
cmake -DRWKV_BUILD_SHARED_LIBRARY=OFF -DRWKV_STATIC=ON ..
cmake --build . --config Release
Output:
4 warnings generated.
[ 23%] Linking CXX static library librwkv.a
[ 23%] Built target rwkv
[ 30%] Building C object tests/CMakeFiles/test_ggml_basics.dir/test_ggml_basics.c.o
[ 38%] Linking CXX executable ../bin/test_ggml_basics
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_ggml_basics] Error 1
make[1]: *** [tests/CMakeFiles/test_ggml_basics.dir/all] Error 2
Thats true @LoganDark, but on mac build process crash if you try to build statically tests and extras...
does removing -static
still allow you to statically link with rwkv.cpp?
Thats true @LoganDark, but on mac build process crash if you try to build statically tests and extras...
does removing
-static
still allow you to statically link with rwkv.cpp?
Yes, here is build without -static flag in tests and extras:
❯ otool -L bin/rwkv_cpu_info
bin/rwkv_cpu_info:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
Done
Hi,
on macosx you cant staticaly link with "-static" flag for binaries. So it should be removed. Please review my pool request for this :D