linux - 静态 Git 构建中链接时 undefined reference

标签 linux git gcc linker makefile

我试图在共享服务器上安装 git(没有 root 访问权限或编译器),方法是在我自己的机器(运行 Arch Linux)上静态构建它,并使用与服务器相同的处理器架构(x86_64),如中所述this guide .

当我运行 make 时,我总是遇到这些错误和失败:

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x19): undefined reference to `dlopen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x2c): undefined reference to `dlsym'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x37): undefined reference to `dlclose'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x364): undefined reference to `dlsym'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x422): undefined reference to `dlerror'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x494): undefined reference to `dlsym'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x552): undefined reference to `dlerror'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x5c2): undefined reference to `dlopen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x62d): undefined reference to `dlclose'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x65a): undefined reference to `dlerror'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
(.text+0x6ef): undefined reference to `dladdr'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
(.text+0x749): undefined reference to `dlerror'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
(.text+0x7aa): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make: *** [git-imap-send] Error 1

最佳答案

我终于发现了a different guide ,建议运行稍微不同的 .configure 命令。最终为我工作的是 this guide ,除了运行

$ ./configure --prefix=/home/myuser/git-static CFLAGS="${CFLAGS} -static"NO_OPENSSL=1 NO_CURL=1

在步骤 2 中。

关于linux - 静态 Git 构建中链接时 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14698013/

相关文章:

java - 使用 Runtime.exec 运行批处理文件而不使用 cmd.exe

git - 拆分 git 中的第一个提交

gcc - 带有自定义 gcc 安装的 LIBRARY_PATH 的优先级

linux - Spring Boot 应用程序作为服务 - 在前台而不是守护进程中运行

c++ - Linux 控制台操作函数

linux - TCP 服务器中的 regd setsocketopt 和套接字内存使用情况

已恢复的精选提交的 Git rebase 可以将其设置为 "lose"

Eclipse 作为 git mergetool?

c - 就 C 中的速度和空间消耗而言,静态与全局

c++ - 将静态 Qt 库链接到 C 程序