Problem with linking step

Jonathan Wakely jwakely.gcc@gmail.com
Fri Sep 1 14:49:00 GMT 2017


On 1 September 2017 at 15:29, Alessandro Vicini wrote:
>
>
> Hullo everybody,
>
> I am using gfortran-6 under Suse sles11. The linking step for my program looks like the following:
>
> gcc-6 -static-libgcc -o myprogram.exe myprogram.o  $(GRAPHIC_LIBS) -Wl,-Bstatic -lgfortran -lquadmath -lgomp -Wl,-Bdynamic  -lm
>
> This works fine.
> However, when I move under a Suse Sles12 system, I get the following error:
>
> /usr/x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/7/libgomp.a(target.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
> /lib64/libdl.so.2: error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status
>
> Any hint about what could be the problem? Thank you.

This isn't really a GCC question, but the problem is that dlclose is
defined in libdl and you didn't add -ldl to the command-line.



More information about the Gcc-help mailing list