2016-02-15 2 views
0

Я пытаюсь скомпилировать libircclient с SSL включеннеопределенная ссылка на `dlopen» при создании libircclient с SSL включен

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, поэтому проблема заключается в том, что Makefile, который отвечает за строительство этой тестовой программы не поднимая ручной LDFLAGS настройки.

Итак, действительно, вот в чем проблема. Ваш следующий шаг - попытаться выяснить, почему, самостоятельно. Конечно, вам может повезти, и кто-то здесь будет достаточно хорош, чтобы захватить этот пакет самостоятельно и выяснить его для вас.

Но если вы действительно хотите узнать что-то из этого опыта, вы должны сделать это сами. Посмотрите на фактический файл makefile, который его построит, посмотрите, какая команда используется для связи программы, какие переменные она использует, а затем выясните, что нужно сделать, чтобы эта часть этой ссылки была правильно использована.

Это прекрасная возможность для вас узнать все о GNU toolchain, который, очевидно, используется здесь: autoconf, automake и libtool. И как только вы это сделаете, вы сможете выяснить и работать не только с этим конкретным программным пакетом, но и с тысячами и тысячами других бесплатных программных пакетов, которые также используют инструментальную цепочку GNU. Я уверен, вы согласитесь, что это будет очень полезным умением. Потребуется некоторое время, чтобы вы могли прочитать всю документацию, понять ее и научиться ее использовать, но вы сможете использовать это знание и использовать его много раз в будущем.

+0

Если я установил флаги после настройки, я получаю ту же ошибку, проблема не устранена – Chris

+0

Я понимаю. Теперь вы посмотрели Makefile, как я предложил, чтобы узнать, что он использует для создания команды link? –

+0

я удалил каталог примеров из файла make, и он просто не указал цель, указанную для файла make, и остановился – Chris

Смежные вопросы