0

Github :: https://github.com/mmgaggle/sslsqueeze

I am trying to build from source a code from github called "sslsqueeze". I have installed all required libraries but "make" command is still unable to link them for some reason. I am sure there is a very simple point/step I am missing here, but after hours of debugging, I am turning to you.

sslsqueeze.c file contains the line:

**sslsqueeze** needs to be linked with -levent_core from libevent2 library.

Accordingly I have installed libevent-dev library. And I run this command:

make

This is my list of errors :

sslsqueeze.o: In function `new_connection':
sslsqueeze.c:(.text+0x57): undefined reference to `bufferevent_socket_new'
sslsqueeze.c:(.text+0x68): undefined reference to `bufferevent_set_timeouts'
sslsqueeze.c:(.text+0x88): undefined reference to `bufferevent_setcb'
sslsqueeze.c:(.text+0x9d): undefined reference to `bufferevent_socket_connect'
sslsqueeze.o: In function `read_cb':
sslsqueeze.c:(.text+0x161): undefined reference to `bufferevent_read'
sslsqueeze.c:(.text+0x20d): undefined reference to `bufferevent_free'
sslsqueeze.c:(.text+0x25d): undefined reference to `bufferevent_write'
sslsqueeze.c:(.text+0x288): undefined reference to `bufferevent_write'
sslsqueeze.c:(.text+0x2b3): undefined reference to `bufferevent_write'
sslsqueeze.o: In function `event_cb':
sslsqueeze.c:(.text+0x2ed): undefined reference to `bufferevent_free'
sslsqueeze.o: In function `write_cb':
sslsqueeze.c:(.text+0x136): undefined reference to `bufferevent_enable'
sslsqueeze.o: In function `event_cb':
sslsqueeze.c:(.text+0x32c): undefined reference to `bufferevent_write'
sslsqueeze.o: In function `main':
sslsqueeze.c:(.text.startup+0x1f9): undefined reference to `event_base_new'
sslsqueeze.c:(.text.startup+0x229): undefined reference to `event_base_dispatch'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'sslsqueeze' failed
make: *** [sslsqueeze] Error 1

After some research I tried the following commands ALL to the same result :

make -levent_core
gcc -levent_core  sslsqueeze.c -o take6
gcc -L/usr/lib/x86_64-linux-gnu  sslsqueeze.c -o take8

The following were also not successful. They gave "file not found" errors.

gcc -L/usr/lib/x86_64-linux-gnu -libevent_core.so sslsqueeze.c -o take7
gcc -L/usr/lib/x86_64-linux-gnu -libevent_core.a sslsqueeze.c -o take7

Final piece of information. Header files are in /usr/include/event2

libevent_core files are in /usr/lib/x86_64-linux-gnu/(2 files, one with .so extension and the other with .a)

Any help would be appreciated!

Macindows
  • 209
  • 3
  • 14
  • `undefined reference` errors come from the *linker* and indicate a missing library or compilation unit. A missing header file would cause an error from the *compiler*. – Jonathon Reinhart Mar 25 '19 at 11:13
  • 1
    I think this is probably most appropriate: [Why does the order in which libraries are linked sometimes cause errors in GCC?](https://stackoverflow.com/q/45135/608639) That means, for example, `gcc -o take6 sslsqueeze.c -levent_core`. And `gcc -o take7 sslsqueeze.c -L/usr/lib/x86_64-linux-gnu -libevent_core.a` – jww Mar 25 '19 at 11:26
  • And looking at Example 7, I believe it should be `-l:libevent_core.a` or `-l:libevent_core.so` to link against the exact named library. Also see [`ld(1)` man page](https://linux.die.net/man/1/ld) and the discussion of *`:filename`*. – jww Mar 25 '19 at 11:34
  • 1
    `-libevent_core.so` would look for a library named `libibevent_core.so.a` or similar :P – Antti Haapala -- Слава Україні Mar 25 '19 at 11:51
  • @jww Wow!! That worked perfectly. I am still baffled at the fact that order of libraries should have any bearing at all, but this certainly puts an end to hours of agony. Thanks again. – Macindows Mar 25 '19 at 12:58

0 Answers0