R: Problem with linking step

Alessandro Vicini alessandro.vicini@sitael.com
Fri Sep 1 15:00:00 GMT 2017


Ok, but then the question would be... why does it work under Suse Sles 11, while it doesn't under Sles 12?

-----Messaggio originale-----
Da: Jonathan Wakely [mailto:jwakely.gcc@gmail.com] 
Inviato: venerdì 1 settembre 2017 16:59
A: Alessandro Vicini
Cc: gcc-help@gcc.gnu.org
Oggetto: Re: Problem with linking step

On 1 September 2017 at 15:55, Alessandro Vicini wrote:
> Thank you Jonathan, but if I add -ldl to the command line I get:
>
> /usr/x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/6/libgomp.a(proc.o): undefined reference to symbol 'pthread_getaffinity_np@@GLIBC_2.3.4'
> /lib64/libpthread.so.0: error adding symbols: DSO missing from command 
> line
> collect2: error: ld returned 1 exit status

Same problem, you didn't link to the required library for pthread_getaffinity_np. Look at the man page for pthread_getaffinity_np and it tells you to compile and link with -pthread.

Just like the man page for dlclose tells you to link with -ldl.



>
>
> -----Messaggio originale-----
> Da: Jonathan Wakely [mailto:jwakely.gcc@gmail.com]
> Inviato: venerdì 1 settembre 2017 16:50
> A: Alessandro Vicini
> Cc: gcc-help@gcc.gnu.org
> Oggetto: Re: Problem with linking step
>
>
> 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