Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #224758
| From | Sven Joachim <svenjoac@gmx.de> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Bullseye: Linker Can't Find libgps Library |
| Date | 2020-07-13 20:30 +0200 |
| Message-ID | <Asbnb-3gd-3@gated-at.bofh.it> (permalink) |
| References | <ArPZn-76x-11@gated-at.bofh.it> <ArQsq-7vW-15@gated-at.bofh.it> <ArS1c-8h4-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2020-07-12 15:44 -0600, Charles Curley wrote:
> On Sun, 12 Jul 2020 22:04:54 +0200
> Sven Joachim <svenjoac@gmx.de> wrote:
>
>> I am rather surprised that it does, for I have learned that you always
>> need to put libraries to link with at the end of the gcc commandline,
>> i.e.
>>
>> gcc -Wall -ggdb -o gpsclient gpsclient.c -lm -lgps
>>
>> should work.
>
> Bingo.
>
> charles@white:~/versioned/gpsclient$ gcc -Wall -o gpsclient gpsclient.c -lm -lgps
> gpsclient.c:72:2: warning: #warning Setting up for API version 9.0 [-Wcpp]
> 72 | #warning Setting up for API version 9.0
> | ^~~~~~~
> charles@white:~/versioned/gpsclient$
>
> Worked correctly. Thank you. Interesting.
>
> This is a change from Buster, gcc (Debian 9.3.0-14) 9.3.0 versus gcc
> (Debian 8.3.0-6) 8.3.0. I conjecture the reason is so that gcc can
> accommodate multiple source files on one line, each with their own
> libraries. Something like:
>
> gcc -Wall -o snark foo.c -la -lb -lc bar.c -lb -lc -ld
Not really, the reason is that in Bullseye gcc now passes the
--as-needed option to the linker to reduce unnecessary linking of
libraries (and dependencies in the Debian package system). According to
the binutils documentation,
,----
| '--as-needed' causes a DT_NEEDED tag to only be emitted for a library
| that _at that point in the link_ satisfies a non-weak undefined symbol
| reference from a regular object file or, if the library is not found in
| the DT_NEEDED lists of other needed libraries, a non-weak undefined
| symbol reference from another needed dynamic library. Object files or
| libraries appearing on the command line _after_ the library in question
| do not affect whether the library is seen as needed.
`----
HTH,
Sven
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bullseye: Linker Can't Find libgps Library Charles Curley <charlescurley@charlescurley.com> - 2020-07-12 21:40 +0200
Re: Bullseye: Linker Can't Find libgps Library Sven Joachim <svenjoac@gmx.de> - 2020-07-12 22:10 +0200
Re: Bullseye: Linker Can't Find libgps Library Charles Curley <charlescurley@charlescurley.com> - 2020-07-12 23:50 +0200
Re: Bullseye: Linker Can't Find libgps Library Sven Joachim <svenjoac@gmx.de> - 2020-07-13 20:30 +0200
Re: Bullseye: Linker Can't Find libgps Library Charles Curley <charlescurley@charlescurley.com> - 2020-07-13 21:10 +0200
csiph-web