Hi!
I, as Fedora's vim co-maintainer, encountered the issue with default
LDFLAGS.
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:
-L. -Wl,-z,relro -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector
-rdynamic -Wl,-export-dynamic
, where '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' causes the
issue. I talked with Vita Ondruch, Fedora's ruby maintainer, and he
explained Ruby embeds LDFLAGS from the machine, where Ruby was built -
in our case in our building system, and Ruby's upstream are not willing
to change this behavior.
To sum it up, I would like to ask if there is way how to solve it in our
build system, not in Vim or Ruby projects themselves - because at least
Ubuntu does not have this issue... and python+perl seem to have it
solved too. (I can patch Vim downstream in the worst scenario...)
Thank you for reading the email and answers in advance!
Zdenek
--
Zdenek Dohnal
Associate Software Engineer
Red Hat Czech - Brno TPB-C