Skip to content

Commit b70d60f

Browse files
committed
examples : add dl to the list of libraries linked
This commit adds the dynamic linker library to the list of libraries linked by the examples. The motivation for this change is that when building the examples on ubuntu 20.04, which uses GCC 9.4.0, the dynamic linker requires explicit linking or the following error is generated: ```console [ 64%] Linking CXX executable ../../bin/whisper-cli cd /app/whisper.cpp/build/examples/cli && /usr/bin/cmake -E cmake_link_script CMakeFiles/whisper-cli.dir/link.txt --verbose=1 /usr/bin/c++ -O3 -DNDEBUG CMakeFiles/whisper-cli.dir/cli.cpp.o -o ../../bin/whisper-cli -Wl,-rpath,/app/whisper.cpp/build/src:/app/whisper.cpp/build/ggml/src: ../libcommon.a ../../src/libwhisper.so.1.7.4 -pthread ../../ggml/src/libggml.so ../../ggml/src/libggml-cpu.so ../../ggml/src/libggml-base.so /usr/bin/ld: ../libcommon.a(common-whisper.cpp.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [examples/cli/CMakeFiles/whisper-cli.dir/build.make:89: bin/whisper-cli] Error 1 make[2]: Leaving directory '/app/whisper.cpp/build' make[1]: *** [CMakeFiles/Makefile2:433: examples/cli/CMakeFiles/whisper-cli.dir/all] Error 2 make[1]: Leaving directory '/app/whisper.cpp/build' make: *** [Makefile:130: all] Error 2 ``` Refs: ggml-org#2854
1 parent 7d14005 commit b70d60f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ add_library(${TARGET} STATIC
6161

6262
include(DefaultTargetOptions)
6363

64-
target_link_libraries(${TARGET} PRIVATE whisper ${COMMON_EXTRA_LIBS})
64+
target_link_libraries(${TARGET} PRIVATE whisper ${COMMON_EXTRA_LIBS} dl)
6565

6666
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
6767
set_target_properties(${TARGET} PROPERTIES FOLDER "libs")

0 commit comments

Comments
 (0)