Doubts using the precompiled binaries
Manfred Schwarb
manfred99@gmx.ch
Wed Apr 26 15:13:00 GMT 2017
Am 26.04.2017 um 15:48 schrieb marco restelli:
> 2017-04-26 1:13 GMT+02:00, Manfred Schwarb <manfred99@gmx.ch>:
>> Am 26.04.2017 um 00:21 schrieb Manfred Schwarb:
>>> Am 25.04.2017 um 20:30 schrieb marco restelli:
>>>> Hi all,
>>>> I am experimenting with the precompiled binaries from the GCC Wiki,
>>>> and in particular with gcc-6.3.0.
>>>>
>>>> I have two questions.
>>>>
>>>>
>>>> 1) I get an error trying to link without -fno-use-linker-plugin
>>>>
>>>> gfortran *.o -o test
>>>> collect2: fatal error: cannot find 'ld'
>>>> compilation terminated.
>>>>
>>>> >From the documentation, I see that this should not be a problem with
>>>> ld >= 2.21, and I have 2.26.1. Also, using gfortran compiled by myself
>>>> I don't need this option. Is this expected?
>>>>
>>>
>>> ld >= 2.21 definitely has plugin support.
>>> You probably need the package binutils-gold for this to work.
>
> I do have both
>
> # ld --version
> GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
>
> # ld.gold --version
> GNU gold (Gentoo 2.26.1 p1.0 2.26.1) 1.11
>
> Both are from binutils-2.26.1. What else should I have?
Then it should work, I think. The linker might be called by the name "gold"
though, so you probably need a link "/usr/bin/gold -> ld.gold", which should
be provided per default.
binutils needs to be built with the option "--enable-plugins", which is not
set per default, I guess. You can check whether your "ld" has plugin support by doing
# ld --help | grep plugin | head -n 1
which should show "-plugin PLUGIN Load named plugin"
Otherwise: No idea. I really think it should work for your version.
Cheers,
Manfred
>
>>>> 2) Trying to do static linking with "-static" I get the error
>>>>
>>>> <local-installation-path>/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../lib64/libgfortran.a(unix.o):
>>>> In function `tempfile':
>>>> /tmp/gcc-6.3.0-build/x86_64-pc-linux-gnu/libgfortran/../../../gcc-6.3.0-source/gcc-6.3.0/libgfortran/io/unix.c:1208:
>>>> undefined reference to `__secure_getenv'
>>>> collect2: error: ld returned 1 exit status
>>>>
>>>
>>> Hmm, I do see it, too. No idea. I will investigate, seems to be quite a
>>> mess.
>>> If someone has a clue, I would appreciate it.
>>>
>>> The build system has binutils-2.25, as I got troubles building gfortran
>>> with older binutils. I don't know if this has something to do with it.
>>>
>>
>> Seems to have nothing to do with binutils.
>> glibc <2.17 has __secure_getenv.
>> glibc >=2.17 has __secure_getenv and secure_getenv, but you can not link
>> against __secure_getenv.
>> So if you compile libgfortran on a system with old glibc, you
>> can't use it for static compilation on a system with new glibc.
>
> Yes, indeed, I have glibc-2.23 and I see
>
> # nm /usr/lib64/libc.a | grep secure_getenv
> 0000000000000000 T __libc_secure_getenv
> 0000000000000000 W secure_getenv
> U __libc_secure_getenv
> U __libc_secure_getenv
> U __libc_secure_getenv
> U __libc_secure_getenv
> U __libc_secure_getenv
>
> # nm /usr/lib64/libc.so | grep secure_getenv
> 0000000000035960 t __GI___libc_secure_getenv
> 0000000000035960 W __libc_secure_getenv
> 0000000000035960 W __secure_getenv@GLIBC_2.2.5
> 0000000000035960 W secure_getenv
>
>
> Thanks a lot,
> Marco
>
More information about the Fortran
mailing list