otrv4 / pidgin-otrng

Fork of https://bugs.otr.im/plugins/pidgin-otr. This is a mirror of https://bugs.otr.im/otrv4/pidgin-otrng
GNU General Public License v2.0
16 stars 5 forks source link

Static compilation does not work #25

Closed juniorz closed 5 years ago

juniorz commented 6 years ago

It fails with:

$ make -f Makefile.static LIBOTRDIR=/usr/lib/x86_64-linux-gnu/ LIBGCRYPTDIR=/usr/lib/x86_64-linux-gnu/ LIBOTRNGDIR=/usr/local/lib/
[...]
ld -r  .libs/otrng-plugin.o \
        .libs/plugin-all.o \
        .libs/ui.o \
        .libs/dialogs.o \
        .libs/gtk-ui.o \
        .libs/gtk-dialog.o \
        .libs/tooltipmenu.o \
        .libs/otrng-client.o \
        /usr/lib/x86_64-linux-gnu//libotr.a \
        /usr/lib/libotr-ng.a \
        /usr/lib/x86_64-linux-gnu/libgcrypt.a \
        /usr/lib/x86_64-linux-gnu/libgpg-error.a \
        -o .libs/pidgin-otr-shared.o
# Make all the libgcrypt references local to that .o file
objcopy -w -L '*gcry*' .libs/pidgin-otr-shared.o \
        .libs/pidgin-otr-static.o
# Turn the .o into a .so
gcc -shared .libs/pidgin-otr-static.o -Wl,-soname -Wl,pidgin-otr.so \
        -o .libs/pidgin-otr.so
/usr/bin/x86_64-linux-gnu-ld: .libs/pidgin-otr-static.o: relocation R_X86_64_32S against `.rodata.cst4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile.static:8: recipe for target '.libs/pidgin-otrng.so' failed
make: *** [.libs/pidgin-otrng.so] Error 1

We should use libtool to build both the static and dynamic library.

olabini commented 6 years ago

How high is this in terms of priority?

claucece commented 6 years ago

Very low, actually @olabini

olabini commented 6 years ago

Yeah, that's what I suspected. I'll tag it.

claucece commented 5 years ago

Let's ask why we have static compilation in a next otr-global meeting.

DrWhax commented 5 years ago

This could be higher priority depending on if we want to go this way (as it has been) or explore ways to circumvent this.