tindy2013 / subconverter

Utility to convert between various subscription format
GNU General Public License v3.0
12.8k stars 2.72k forks source link

make 编译报错“undefined reference to symbol 'dlclose@@GLIBC_2.2.5' ”请教 #399

Closed szkzn closed 2 years ago

szkzn commented 2 years ago

系统环境: Ubuntu 20.04 LTS ,gcc 9.3.0

参考 Github action 的Build过程,https://github.com/tindy2013/subconverter/runs/3919482985?check_suite_focus=true,Linux x86_64 Build 前面的 cmake -DCMAKE_BUILD_TYPE=Release . 没报错,然后进行 make 编译 到 [ 3%] Linking CXX executable subconverter,时报错如下: /usr/bin/ld: /tmp/subconverter.BdHJIT.ltrans2.ltrans.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]: [CMakeFiles/subconverter.dir/build.make:450: subconverter] Error 1 make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/subconverter.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

我在谷歌和百度搜索资料,说了几种方案,一个说是 gcc 增加编译参数 -ldl,但是我不知道在哪里加,检查过 CMakeList 和 Makefile 这2个文件,还有说把gcc换成g++,我设置了alias 把gcc临时改成了g++,重新编译还是同样报错,请问该从哪里下手?

svher commented 1 year ago

这个有解决方法吗,我也遇到了这个问题

wsm25 commented 1 year ago

我也遇到了这个问题,参考 Fix for "undefined reference to dlopen" in CMake projects ,在 CMakeLists.txt 中添加了 ${CMAKE_DL_LIBS} 后重新编译解决了问题。参考命令:

sed -i "s/\${QUICKJS_LIBRARIES}/\${QUICKJS_LIBRARIES} \${CMAKE_DL_LIBS}/g" CMakeLists.txt
szkzn commented 1 year ago

感谢回复,早已解决该问题,但是随后在正式环境下编译还遇到了很多其他报错,最后弃疗,最后使用 docker 方式搭建github ci 的编译环境,并编译成功

具体见,并在最新上游 commit 4205dee 中编译、运行成功 https://www.0z.gs/webDevelopment/856.html#makesub