2016-02-15 22 views
0

我试图编译libircclient启用SSL未定义的参考`dlopen的”使用SSL建立libircclient启用时

export LDFLAGS="-Wl,--no-as-needed -ldl -L/usr/local/ssl/lib -lssl -lcrypto" 
export CPATH=/usr/local/include 
export LIBRARY_PATH=/usr/local/lib 
export LD_LIBRARY_PATH=/usr/local/lib 
./configure --enable-openssl --enable-ipv6 

但我得到的错误

undefined reference to `dlopen'

这是我的构建日志

[email protected]:~/luaTest/thirdparty/libircclient-1.8$ export LDFLAGS="-ldl -L/usr/local/ssl/lib -lssl -lcrypto" 
[email protected]:~/luaTest/thirdparty/libircclient-1.8$ export CPATH=/usr/local/[email protected]:~/luaTest/thirdparty/libircclient-1.8$ export LIBRARY_PATH=/usr/local/lib 
[email protected]:~/luaTest/thirdparty/libircclient-1.8$ export LD_LIBRARY_PATH=/usr/local/lib 
[email protected]:~/luaTest/thirdparty/libircclient-1.8$ ./configure --enable-openssl --enable-ipv6 
checking for g++... g++ 
checking whether the C++ compiler works... yes 
checking for C++ compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... no 
checking for suffix of object files... o 
checking whether we are using the GNU C++ compiler... yes 
checking whether g++ accepts -g... yes 
checking for gcc... gcc 
checking whether we are using the GNU C compiler... yes 
checking whether gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking for ar... ar 
checking for ranlib... ranlib 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for ANSI C header files... yes 
checking for sys/types.h... yes 
checking for sys/stat.h... yes 
checking for stdlib.h... yes 
checking for string.h... yes 
checking for memory.h... yes 
checking for strings.h... yes 
checking for inttypes.h... yes 
checking for stdint.h... yes 
checking for unistd.h... yes 
checking for stdbool.h that conforms to C99... yes 
checking for _Bool... yes 
checking for an ANSI C-conforming const... yes 
checking for size_t... yes 
checking whether time.h and sys/time.h may both be included... yes 
checking for stdlib.h... (cached) yes 
checking for GNU libc compatible malloc... yes 
checking sys/select.h usability... yes 
checking sys/select.h presence... yes 
checking for sys/select.h... yes 
checking sys/socket.h usability... yes 
checking sys/socket.h presence... yes 
checking for sys/socket.h... yes 
checking types of arguments for select... int,fd_set *,struct timeval * 
checking whether lstat correctly handles trailing slash... yes 
checking whether stat accepts an empty string... no 
checking for localtime_r... yes 
checking for socket... yes 
checking for socket in -lsocket... no 
checking for getaddrinfo... yes 
checking for inet_pton... yes 
checking for getaddrinfo in -lnsl... yes 
checking For MinGW32... no 
checking for CRYPTO_new_ex_data in -lcrypto... no 
configure: error: OpenSSL not found 
[email protected]:~/luaTest/thirdparty/libircclient-1.8$ make 
for subdir in src examples; do \ 
     make -C $subdir || exit 1; \ 
    done 
make[1]: Entering directory `/home/user/luaTest/thirdparty/libircclient-1.8/src' 
make[1]: Nothing to be done for `all'. 
make[1]: Leaving directory `/home/user/luaTest/thirdparty/libircclient-1.8/src' 
make[1]: Entering directory `/home/user/luaTest/thirdparty/libircclient-1.8/examples' 
gcc -o spammer spammer.o -L../src/ -lircclient -lpthread -lssl -lcrypto -lnsl 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup': 
dso_dlfcn.c:(.text+0x15): undefined reference to `dlopen' 
dso_dlfcn.c:(.text+0x2b): undefined reference to `dlsym' 
dso_dlfcn.c:(.text+0x35): undefined reference to `dlclose' 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func': 
dso_dlfcn.c:(.text+0x33b): undefined reference to `dlsym' 
dso_dlfcn.c:(.text+0x410): undefined reference to `dlerror' 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var': 
dso_dlfcn.c:(.text+0x48b): undefined reference to `dlsym' 
dso_dlfcn.c:(.text+0x566): undefined reference to `dlerror' 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load': 
dso_dlfcn.c:(.text+0x5e0): undefined reference to `dlopen' 
dso_dlfcn.c:(.text+0x658): undefined reference to `dlclose' 
dso_dlfcn.c:(.text+0x69d): undefined reference to `dlerror' 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr': 
dso_dlfcn.c:(.text+0x736): undefined reference to `dladdr' 
dso_dlfcn.c:(.text+0x821): undefined reference to `dlerror' 
/usr/local/lib/../lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload': 
dso_dlfcn.c:(.text+0x87e): undefined reference to `dlclose' 
collect2: error: ld returned 1 exit status 
make[1]: *** [spammer] Error 1 
make[1]: Leaving directory `/home/user/luaTest/thirdparty/libircclient-1.8/examples' 
make: *** [all] Error 1 
[email protected]:~/luaTest/thirdparty/libircclient-1.8$ 

回答

-1

很明显,examples子目录下的示例程序没有得到与libdl链接。该链接命令很清楚。

你明确地在环境中设置LDFLAGS包括“-ldl”标志,运行configure过,所以问题是,这是负责建设这个测试程序生成文件不拿起手动LDFLAGS设置。

所以,真的,这就是问题所在。你的下一步是要自己弄清楚为什么。当然,你可能会很幸运,而且周围的某个人可以很好地抓住这个软件包,并为你解决这个问题。但是,如果你真的想从这个经历中学到一些东西,你应该自己去做。查看构建它的实际生成文件,查看使用什么命令链接程序,使用哪些变量,然后弄清楚需要做些什么才能正确构建此应用程序链接的这一部分。

这是您了解GNU工具链的绝佳机会,这里明显地使用了这些:autoconfautomakelibtool。而且,一旦你这样做了,你就可以找出并处理这个特定的软件包,而且还有成千上万的其他免费软件包也使用GNU工具链。我相信你会同意这将是一个非常有用的技能。您可能需要一段时间才能阅读所有文档,了解它并了解如何使用它,但您可以随时了解这些知识,并在将来多次使用它。

+0

如果我在配置后设置标志,我得到相同的错误,问题依然存在 – Chris

+0

我明白。现在,您是否按照我的建议查看了Makefile,看看它是如何生成链接命令的? –

+0

我从make文件中删除了examples目录,它只是说没有为make文件指定目标并停止 – Chris