xmake-io / xrepo

🗂️ A cross-platform C/C++ package manager based on Xmake
https://xrepo.xmake.io
Apache License 2.0
361 stars 16 forks source link

在使用add_requires("libcurl")时安装失败 #38

Open greencamel opened 10 months ago

greencamel commented 10 months ago

Xmake 版本

v2.8.5+20231220

操作系统版本和架构

Linux DESKTOP-79IFIOU 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

描述问题

程序使用add_requires("libcurl"),在编译库时出现安装失败的 问题 加-vD后,最后定位到是链接时缺少-ldl参数,能修改下相关程序吗?

期待的结果

成功安装libcurl

工程配置

lua脚本: add_requires("libcurl",{system = false})

GCC版本 gcc (Ubuntu 11.4.0-2ubuntu1~18.04) 11.4.0

附加信息和错误日志

cd /home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/build_0a140039/src && /usr/bin/cc -DBUILDING_CURL -DCURL_STATICLIB -DHAVE_CONFIG_H -I/home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/include -I/home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/lib -I/home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/build_0a140039/lib -I/home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/build_0a140039/include -I/home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/src -isystem /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/include -W -Wall -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Waddress -Wattributes -Wcast-align -Wdeclaration-after-statement -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-security -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-noreturn -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wredundant-decls -Wold-style-definition -Wstrict-prototypes -Wtype-limits -Wunreachable-code -Wunused-parameter -Wvla -Wclobbered -Wmissing-parameter-type -Wold-style-declaration -Wstrict-aliasing=3 -Wformat=2 -Warray-bounds=2 -ftree-vrp -Wduplicated-cond -Wnull-dereference -fdelete-null-pointer-checks -Wshift-negative-value -Wshift-overflow=2 -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wrestrict -Warith-conversion -Wdouble-promotion -Wenum-conversion -Wpragmas -Wunused-const-variable -O3 -DNDEBUG -fPIE -MD -MT src/CMakeFiles/curl.dir//lib/dynbuf.c.o -MF CMakeFiles/curl.dir//lib/dynbuf.c.o.d -o CMakeFiles/curl.dir/__/lib/dynbuf.c.o -c /home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/lib/dynbuf.c [100%] Linking C executable curl cd /home/camel/.xmake/cache/packages/2401/l/libcurl/8.5.0/source/build_0a140039/src && /home/camel/.xmake/packages/c/cmake/3.28.1/130fb2d927cc4c0cabd31f0f6b3ef621/bin/cmake -E cmake_link_script CMakeFiles/curl.dir/link.txt --verbose=1

/usr/bin/cc -W -Wall -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Waddress -Wattributes -Wcast-align -Wdeclaration-after-statement -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-security -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-noreturn -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wredundant-decls -Wold-style-definition -Wstrict-prototypes -Wtype-limits -Wunreachable-code -Wunused-parameter -Wvla -Wclobbered -Wmissing-parameter-type -Wold-style-declaration -Wstrict-aliasing=3 -Wformat=2 -Warray-bounds=2 -ftree-vrp -Wduplicated-cond -Wnull-dereference -fdelete-null-pointer-checks -Wshift-negative-value -Wshift-overflow=2 -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wrestrict -Warith-conversion -Wdouble-promotion -Wenum-conversion -Wpragmas -Wunused-const-variable -O3 -DNDEBUG CMakeFiles/curl.dir/slist_wc.c.o CMakeFiles/curl.dir/tool_binmode.c.o CMakeFiles/curl.dir/tool_bname.c.o CMakeFiles/curl.dir/tool_cb_dbg.c.o CMakeFiles/curl.dir/tool_cb_hdr.c.o CMakeFiles/curl.dir/tool_cb_prg.c.o CMakeFiles/curl.dir/tool_cb_rea.c.o CMakeFiles/curl.dir/tool_cb_see.c.o CMakeFiles/curl.dir/tool_cb_wrt.c.o CMakeFiles/curl.dir/tool_cfgable.c.o CMakeFiles/curl.dir/tool_dirhie.c.o CMakeFiles/curl.dir/tool_doswin.c.o CMakeFiles/curl.dir/tool_easysrc.c.o CMakeFiles/curl.dir/tool_filetime.c.o CMakeFiles/curl.dir/tool_findfile.c.o CMakeFiles/curl.dir/tool_formparse.c.o CMakeFiles/curl.dir/tool_getparam.c.o CMakeFiles/curl.dir/tool_getpass.c.o CMakeFiles/curl.dir/tool_help.c.o CMakeFiles/curl.dir/tool_helpers.c.o CMakeFiles/curl.dir/tool_hugehelp.c.o CMakeFiles/curl.dir/tool_ipfs.c.o CMakeFiles/curl.dir/tool_libinfo.c.o CMakeFiles/curl.dir/tool_listhelp.c.o CMakeFiles/curl.dir/tool_main.c.o CMakeFiles/curl.dir/tool_msgs.c.o CMakeFiles/curl.dir/tool_operate.c.o CMakeFiles/curl.dir/tool_operhlp.c.o CMakeFiles/curl.dir/tool_paramhlp.c.o CMakeFiles/curl.dir/tool_parsecfg.c.o CMakeFiles/curl.dir/tool_progress.c.o CMakeFiles/curl.dir/tool_setopt.c.o CMakeFiles/curl.dir/tool_sleep.c.o CMakeFiles/curl.dir/tool_stderr.c.o CMakeFiles/curl.dir/tool_strdup.c.o CMakeFiles/curl.dir/tool_urlglob.c.o CMakeFiles/curl.dir/tool_util.c.o CMakeFiles/curl.dir/tool_vms.c.o CMakeFiles/curl.dir/tool_writeout.c.o CMakeFiles/curl.dir/tool_writeout_json.c.o CMakeFiles/curl.dir/tool_xattr.c.o CMakeFiles/curl.dir/var.c.o CMakeFiles/curl.dir//lib/base64.c.o CMakeFiles/curl.dir//lib/dynbuf.c.o -o curl ../lib/libcurl.a -lpthread /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libssl.a /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a -lpthread //这里缺少-ldl

/home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_load': dso_dlfcn.c:(.text+0x114): undefined reference todlopen' dso_dlfcn.c:(.text+0x148): undefined reference to dlerror' dso_dlfcn.c:(.text+0x206): undefined reference todlclose' /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_unload': dso_dlfcn.c:(.text+0x2d2): undefined reference todlclose' /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_bind_func': dso_dlfcn.c:(.text+0x3d8): undefined reference todlsym' dso_dlfcn.c:(.text+0x40e): undefined reference to dlerror' /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a(dso_dlfcn.o): In functiondlfcn_pathbyaddr': dso_dlfcn.c:(.text+0x7de): undefined reference to dladdr' dso_dlfcn.c:(.text+0x849): undefined reference todlerror' /home/camel/.xmake/packages/o/openssl/1.1.1-w/6c51ab6278e2479b883dffafac69fdaf/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_globallookup': dso_dlfcn.c:(.text+0x8a3): undefined reference todlopen' dso_dlfcn.c:(.text+0x8c1): undefined reference to dlsym' dso_dlfcn.c:(.text+0x8d1): undefined reference todlclose' collect2: error: ld returned 1 exit status make[2]: *** [src/curl] Error 1

waruqi commented 10 months ago

openssl 依赖 dl,xmake-repo的 openssl包本身已经加上了 dl ,但是现在是 cmake 构建 curl 链接阶段报错,其实应该是 curl 的 cmakelists 问题,它没加 dl

一种就是给 curl 提 issues/pr 对 linux 加上 dl,如果 ssl 启用的时候

一种就是提个 pr 到 xmake-repo/curl,对 cmakelists.txt 打 patch ,强制加上 dl

greencamel commented 10 months ago

感谢,我去那边提交下