On 28/02/2019 08:30, Zdenek Dohnal wrote:
I tried to manually run configure script for Vim, with ruby support enabled, but it always failed with error message about missing ncurses (ncurses-devel was installed though). When I looked into config.log, I saw: configure:12069: gcc -o conftest -g -O2 -L. -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib conftest.c -lselinux -lncurses >&5 conftest.c: In function 'main': conftest.c:67:26: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration] char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); ^~~~~~~ /usr/bin/ld: /tmp/ccivPtT5.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: final link failed: nonrepresentable section on output collect2: error: ld returned 1 exit status Adding -fPIC actually solved it, but why does the script want it in the first place? Then I ran configure without ruby support enabled and it passed... again from config.log I found out that script wants ruby's LDFLAGS, because script needs them for compilation of ruby support and Ruby LDFLAGS are:
You don't need -fPIC but you need -fPIE at least. The simple rule is that if you're going to link with Fedora's linker flags (which you are doing here) then you need to compile with Fedora's compiler flags, which would have included -fPIE if you didn't already specify -fPIE or -fPIC on the command line. So make sure you tell configure to use $RPM_OPT_FLAGS when compiling - if you use %configure and the configure script is not too silly then that should happen automatically. There is a reasonable argument here that the pkgconfig file that our ruby package installs is broken, because it embeds our linker flags without embedding our compiler flags. So "pkg-config --libs ruby" tells you to link with those flags but "pkg-config --cflags ruby" doesn't give you matching compiler flags. That said, the ruby.pc file may be assuming that it will be used for building ruby extensions, which would be .so files and hence use -fPIC anyway... Tom -- Tom Hughes (tom@xxxxxxxxxx) http://compton.nu/ _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx