Hi,

It's solved by adding -fPIC to building panda-imap's make.

For FreeBSD, build panda-imap with:

gmake bsf EXTRACFLAGS=-fPIC



nsimap now builds without halting errors:

# gmake NAVISERVER=/usr/local/nsx IMAPFLAGS=-I../../panda-imap/c-client/ "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5" gcc -I../../panda-imap/c-client/ -g -O2 -DNDEBUG -Wall -fPIC -pipe -I/usr/local/nsx/include -I"/usr/local/nsx/include" -DHAVE_CONFIG_H -I/usr/local/include -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: "/*" within comment [-Wcomment]
  *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
                                                            ^
/bin/rm -Rf nsimap.so
gcc -shared -nostartfiles -L/usr/local/nsx/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/nsx/lib -ltcl8.5 -lgcc_s -lm -L/usr/local/nsx/lib -L/usr/local/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/nsx/lib ../../panda-imap/c-client/c-client.a(osdep.o): In function `ssl_onceonlyinit': /usr/local/src/panda-imap/c-client/osdep.c:347: warning: warning: tmpnam() possibly used unsafely; consider using mkstemp()


I found the solution by googling "relocation R_X86_64_32 against `.rodata.str1.1'"

cheers,
Ben

On 07/12/2017 05:43 PM, Ben Brink via naviserver-devel wrote:

Adding NAVISERVER=/usr/local/ns6 flag corrected the library references.


Still same error for Ubuntu 16.04:

make NAVISERVER=/usr/local/ns6 IMAPFLAGS=-I../../panda-imap/c-client "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/ns6/lib -lpam -lgssapi_krb5 -lkrb5" gcc -I../../panda-imap/c-client -g -O2 -fomit-frame-pointer -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns6/include -I"/usr/local/ns6/include" -DHAVE_CONFIG_H -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: "/*" within comment [-Wcomment]
   *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
  ^
/bin/rm -Rf nsimap.so
gcc -shared -I../../panda-imap/c-client -g -O2 -fomit-frame-pointer -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns6/include -I"/usr/local/ns6/include" -DHAVE_CONFIG_H -L/usr/local/ns6/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/ns6/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/ns6/lib -ltcl8.5 -lgcc_s -lieee -lm -Wl,--export-dynamic -L/usr/local/ns6/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/ns6/lib /usr/bin/ld: ../../panda-imap/c-client/c-client.a(osdep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
../../panda-imap/c-client/c-client.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [nsimap.so] Error 1




FreeBSD 10.3 breaks at about the same point:


# gmake NAVISERVER=/usr/local/nsx IMAPFLAGS=-I../../panda-imap/c-client/ "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5" gcc -I../../panda-imap/c-client/ -g -O2 -DNDEBUG -Wall -fPIC -pipe -I/usr/local/nsx/include -I"/usr/local/nsx/include" -DHAVE_CONFIG_H -I/usr/local/include -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: "/*" within comment [-Wcomment]
   *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
                                                             ^
/bin/rm -Rf nsimap.so
gcc -shared -nostartfiles -L/usr/local/nsx/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/nsx/lib -ltcl8.5 -lgcc_s -lm -L/usr/local/nsx/lib -L/usr/local/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/nsx/lib ../../panda-imap/c-client/c-client.a(osdep.o): In function `ssl_onceonlyinit': /usr/local/src/panda-imap/c-client/osdep.c:347: warning: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(osdep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mail.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(misc.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(smanager.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(utf8.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(utf8aux.o): relocation R_X86_64_32 against symbol `_DefaultRuneLocale@@FBSD_1.0' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(dummy.o): relocation R_X86_64_32 against symbol `dummydriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(rfc822.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(nntp.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(smtp.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(imap4r1.o): relocation R_X86_64_32 against symbol `imapdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(pop3.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(unix.o): relocation R_X86_64_32 against symbol `unixdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mbx.o): relocation R_X86_64_32 against symbol `mbxdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mmdf.o): relocation R_X86_64_32 against symbol `mmdfdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(tenex.o): relocation R_X86_64_32 against symbol `tenexdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mtx.o): relocation R_X86_64_32 against symbol `mtxdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(news.o): relocation R_X86_64_32 against symbol `newsdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(phile.o): relocation R_X86_64_32 against symbol `philedriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mh.o): relocation R_X86_64_32 against symbol `mhdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(mx.o): relocation R_X86_64_32 against symbol `mxdriver' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(newsrc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: ../../panda-imap/c-client/c-client.a(netmsg.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
gmake: *** [/usr/local/nsx/include/Makefile.module:143: nsimap.so] Error 1


On 07/12/2017 05:22 PM, Ben Brink via naviserver-devel wrote:
Hi,

The build appears to use /usr/local/ns instead of /usr/local/ns6 or /usr/local/nsx provided by IMAPLIBS flag.

I'm not sure how to specify additional flags.

Will report results after trying to use the normal install dir "/usr/local/ns".



Building on Ubuntu 16.04 gives similar error:

# make IMAPFLAGS=-I../../panda-imap/c-client "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/ns6/lib -lpam -lgssapi_krb5 -lkrb5" gcc -I../../panda-imap/c-client -g -O2 -fomit-frame-pointer -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns/include -I"/usr/local/ns/include" -DHAVE_CONFIG_H -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: "/*" within comment [-Wcomment]
   *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
  ^
/bin/rm -Rf nsimap.so
gcc -shared -I../../panda-imap/c-client -g -O2 -fomit-frame-pointer -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns/include -I"/usr/local/ns/include" -DHAVE_CONFIG_H -L/usr/local/ns/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/ns6/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/ns/lib -ltcl8.5 -lgcc_s -lieee -lm -Wl,--export-dynamic -L/usr/local/ns/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/ns/lib /usr/bin/ld: ../../panda-imap/c-client/c-client.a(osdep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
../../panda-imap/c-client/c-client.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [nsimap.so] Error 1


uname -a
Linux openacs-a22 3.13.0-65-generic #106-Ubuntu SMP Fri Oct 2 22:08:27 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Using install dir of /usr/local/ns6 instead of /usr/local/nsx for freebsd case.

On 07/12/2017 01:32 PM, Ben Brink via naviserver-devel wrote:


On 07/12/2017 12:38 PM, Ben Brink via naviserver-devel wrote:
Hi,

I'm trying to build nsmap on FreeBSD 10.3-STABLE.

Hint says to 'recompile with -fPIC'. Error is same with and without hint.

This hint has more meaning in development context:
https://forums.freebsd.org/threads/55008/
PR = problem report (I had to look it up in context of that thread).


Any suggestions?
Thanks in advance,
Ben


build with hint  '-fPIC':

# gmake -fMakefile IMAPFLAGS=-I../../panda-imap/c-client/ "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5" clang -I../../panda-imap/c-client/ -g -O2 -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns/include -I"/usr/local/ns/include" -DHAVE_CONFIG_H -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: '/*' within block comment [-Wcomment]
  *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
                                                            ^
1 warning generated.
/bin/rm -Rf nsimap.so
clang -shared -L/usr/local/ns/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/ns/lib -ltcl8.5 -lgcc_s -lm -L/usr/local/ns/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/ns/lib /usr/bin/ld: ../../panda-imap/c-client/c-client.a(osdep.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../panda-imap/c-client/c-client.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation) gmake: *** [/usr/local/ns/include/Makefile.module:143: nsimap.so] Error 1



first build attempt:


# gmake IMAPFLAGS=-I../../panda-imap/c-client/ "IMAPLIBS=../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5" clang -I../../panda-imap/c-client/ -g -O2 -DNDEBUG -Wall -fPIC -pipe -I/usr/local/ns/include -I"/usr/local/ns/include" -DHAVE_CONFIG_H -c -o nsimap.o nsimap.c
nsimap.c:190:60: warning: '/*' within block comment [-Wcomment]
  *           oss2:nscp 4> ns_imap list 1 {{localhost}} mail/*
                                                            ^
1 warning generated.
/bin/rm -Rf nsimap.so
clang -shared -L/usr/local/ns/lib -o nsimap.so nsimap.o ../../panda-imap/c-client/c-client.a -L/usr/local/nsx/lib -lpam -lgssapi_krb5 -lkrb5 -lnsthread -lnsd -L/usr/local/ns/lib -ltcl8.5 -lgcc_s -lm -L/usr/local/ns/lib -lssl -lcrypto -Wl,-rpath,:/usr/local/ns/lib /usr/bin/ld: ../../panda-imap/c-client/c-client.a(osdep.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../panda-imap/c-client/c-client.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation) gmake: *** [/usr/local/ns/include/Makefile.module:143: nsimap.so] Error 1
root@or97:/usr/local/src/modules/nsimap #

# gmake -v
GNU Make 4.2.1
Built for amd64-portbld-freebsd10.3
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Other notes:


This build is using Naviserver head so as to get the latest nsmap changes.

Naviserver build dir is /usr/local/nsx (Latest release of NaviServer already uses /usr/local/ns)

IMAP-2007f is from https://github.com/jonabbey/panda-imap and locally at: /usr/local/src/panda-imap



panda-imap was built using: gmake bsf

No flags were passed as arguments because the defaults seem appropriate for this system:
   PASSWDTYPE=nopwd IP=4




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to