Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Computers are not intelligent. They only think they are.


computers / comp.sys.raspberry-pi / Weird compilation error

SubjectAuthor
* Weird compilation errorThe Natural Philosopher
+* Re: Weird compilation errorMartin Gregorie
|`- Re: Weird compilation errorThe Natural Philosopher
+* Re: Weird compilation errorAndy Burns
|`- Re: Weird compilation errorThe Natural Philosopher
`* Re: Weird compilation errorRichard Kettlewell
 `- Re: Weird compilation errorThe Natural Philosopher

1
Weird compilation error

<uaoc68$2a4no$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6817&group=comp.sys.raspberry-pi#6817

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Weird compilation error
Date: Sun, 6 Aug 2023 15:54:00 +0100
Organization: A little, after lunch
Lines: 40
Message-ID: <uaoc68$2a4no$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 6 Aug 2023 14:54:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0d4179a52b400d01c1216a70961e8025";
logging-data="2429688"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4/2jyw6xUkkuDFIy+VaFhOMV7xBuPhmc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:q2TceFiis5CtB5Thrfa7sM9ZsGM=
Content-Language: en-GB
 by: The Natural Philosop - Sun, 6 Aug 2023 14:54 UTC

Its been a bad day for coding. Fixed one problem by writing debug code
deleted debug code and problem is back.

But that's not the issue. This issues is conceptually simple.

I want to use a library. specifically the libiw library

I install the library using apt-get install libiw-dev

I include the file <iwlib.h>

The source code compiles fine, so its found iwlib.h Or at least I assume
so.
When I try to link with -liw though, it simple barfs on any reference to
the library.

I found libiw.so, and it contains all the right symbols.

gcc doesn't say it cannot find the libary, only that it *cannot match
the symbols*.

Specifically

gcc -liw -o scan scan.o
/usr/bin/ld: scan.o: in function `main':
scan.c:(.text+0x1f): undefined reference to `iw_sockets_open'
/usr/bin/ld: scan.c:(.text+0x40): undefined reference to `iw_get_range_info'
/usr/bin/ld: scan.c:(.text+0x7f): undefined reference to `iw_scan'
collect2: error: ld returned 1 exit status

I have never seen this behaviour before.
Any clues?

--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx

Re: Weird compilation error

<uaodja$28nkp$5@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6819&group=comp.sys.raspberry-pi#6819

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: martin@mydomain.invalid (Martin Gregorie)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Sun, 6 Aug 2023 15:18:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uaodja$28nkp$5@dont-email.me>
References: <uaoc68$2a4no$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 6 Aug 2023 15:18:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="77941cbb6eeb481237f2924fd886f7f0";
logging-data="2383513"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4juYnl7nVASOfxwxQWLtxiFUqOfUB9Lo="
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:chbCMwOXmNDd+wLjisueLhV+xTQ=
 by: Martin Gregorie - Sun, 6 Aug 2023 15:18 UTC

On Sun, 6 Aug 2023 15:54:00 +0100, The Natural Philosopher wrote:

> The source code compiles fine, so its found iwlib.h Or at least I assume
> so.
> When I try to link with -liw though, it simple barfs on any reference to
> the library.
>
> I found libiw.so, and it contains all the right symbols.
>
> gcc doesn't say it cannot find the libary, only that it *cannot match
> the symbols*.
>
> Specifically
>
> gcc -liw -o scan scan.o /usr/bin/ld: scan.o: in function `main':
> scan.c:(.text+0x1f): undefined reference to `iw_sockets_open'
> /usr/bin/ld: scan.c:(.text+0x40): undefined reference to
> `iw_get_range_info'
> /usr/bin/ld: scan.c:(.text+0x7f): undefined reference to `iw_scan'
> collect2: error: ld returned 1 exit status
>
> I have never seen this behaviour before.
> Any clues?

Anything wrong with the contents of the iwlib.h file? I assume it was
replaced correctly by the update?

--

Martin | martin at
Gregorie | gregorie dot org

Re: Weird compilation error

<kj9t6vFmu4kU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6820&group=comp.sys.raspberry-pi#6820

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@andyburns.uk (Andy Burns)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Sun, 6 Aug 2023 16:40:16 +0100
Lines: 8
Message-ID: <kj9t6vFmu4kU1@mid.individual.net>
References: <uaoc68$2a4no$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net WLKSWWprWku8K91KrENnhwYMzcPgtS+wqpGPNYBZQVKNYiwggW
Cancel-Lock: sha1:Sk+5948/oTzTsXNz/i56nj3eGE0= sha256:X4SHoxGkVsPOoAIk3edb7NNworbj8OqlEtC0DGrX92Y=
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <uaoc68$2a4no$2@dont-email.me>
 by: Andy Burns - Sun, 6 Aug 2023 15:40 UTC

On 06/08/2023 15:54, The Natural Philosopher wrote:

> I have never seen this behaviour before.
> Any clues?

Does it need to pick up .so files from LD_LIBRARY_PATH ?

Re: Weird compilation error

<wwvil9sup1g.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6821&group=comp.sys.raspberry-pi#6821

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.chmurka.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Sun, 06 Aug 2023 17:13:47 +0100
Organization: terraraq NNTP server
Message-ID: <wwvil9sup1g.fsf@LkoBDZeT.terraraq.uk>
References: <uaoc68$2a4no$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="142881"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:DbPkhBkdTpg9ZGYtZGBK5g8rvBI=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Sun, 6 Aug 2023 16:13 UTC

The Natural Philosopher <tnp@invalid.invalid> writes:
> gcc -liw -o scan scan.o
> /usr/bin/ld: scan.o: in function `main':
> scan.c:(.text+0x1f): undefined reference to `iw_sockets_open'
> /usr/bin/ld: scan.c:(.text+0x40): undefined reference to `iw_get_range_info'
> /usr/bin/ld: scan.c:(.text+0x7f): undefined reference to `iw_scan'
> collect2: error: ld returned 1 exit status
>
> I have never seen this behaviour before.
> Any clues?

The library needs to be listed after the object files that depend on it,
not before.

https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html:

It makes a difference where in the command you write this option; the
linker searches and processes libraries and object files in the order
they are specified. Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after
file foo.o but before bar.o. If bar.o refers to functions in ‘z’,
those functions may not be loaded.

--
https://www.greenend.org.uk/rjk/

Re: Weird compilation error

<uaq8pa$2pe1u$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6828&group=comp.sys.raspberry-pi#6828

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Mon, 7 Aug 2023 09:08:10 +0100
Organization: A little, after lunch
Lines: 37
Message-ID: <uaq8pa$2pe1u$1@dont-email.me>
References: <uaoc68$2a4no$2@dont-email.me> <uaodja$28nkp$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 7 Aug 2023 08:08:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b25dda442a0cb64764cc515d18e077e5";
logging-data="2930750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QxvYxqo5e14EDxKv98vMbq6FTxb7eD1A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:n5tXV6R/E0KAqRD6xEs28oYCtyo=
In-Reply-To: <uaodja$28nkp$5@dont-email.me>
Content-Language: en-GB
 by: The Natural Philosop - Mon, 7 Aug 2023 08:08 UTC

On 06/08/2023 16:18, Martin Gregorie wrote:
> On Sun, 6 Aug 2023 15:54:00 +0100, The Natural Philosopher wrote:
>
>> The source code compiles fine, so its found iwlib.h Or at least I assume
>> so.
>> When I try to link with -liw though, it simple barfs on any reference to
>> the library.
>>
>> I found libiw.so, and it contains all the right symbols.
>>
>> gcc doesn't say it cannot find the libary, only that it *cannot match
>> the symbols*.
>>
>> Specifically
>>
>> gcc -liw -o scan scan.o /usr/bin/ld: scan.o: in function `main':
>> scan.c:(.text+0x1f): undefined reference to `iw_sockets_open'
>> /usr/bin/ld: scan.c:(.text+0x40): undefined reference to
>> `iw_get_range_info'
>> /usr/bin/ld: scan.c:(.text+0x7f): undefined reference to `iw_scan'
>> collect2: error: ld returned 1 exit status
>>
>> I have never seen this behaviour before.
>> Any clues?
>
> Anything wrong with the contents of the iwlib.h file? I assume it was
> replaced correctly by the update?
>
>
>
As with all these things it is complex, but looks healthy enough.
The compiler didnt barf

--
Climate Change: Socialism wearing a lab coat.

Re: Weird compilation error

<uaq8st$2pe1u$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6829&group=comp.sys.raspberry-pi#6829

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Mon, 7 Aug 2023 09:10:04 +0100
Organization: A little, after lunch
Lines: 17
Message-ID: <uaq8st$2pe1u$2@dont-email.me>
References: <uaoc68$2a4no$2@dont-email.me> <kj9t6vFmu4kU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 7 Aug 2023 08:10:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b25dda442a0cb64764cc515d18e077e5";
logging-data="2930750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197Ss33RSO+bc8sTYut9pfyAYkPXnAEN8E="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:P4/8/u+VyhSQaGIL28MUF0dxVN8=
In-Reply-To: <kj9t6vFmu4kU1@mid.individual.net>
Content-Language: en-GB
 by: The Natural Philosop - Mon, 7 Aug 2023 08:10 UTC

On 06/08/2023 16:40, Andy Burns wrote:
> On 06/08/2023 15:54, The Natural Philosopher wrote:
>
>> I have never seen this behaviour before.
>> Any clues?
>
>
> Does it need to pick up .so files from LD_LIBRARY_PATH ?
>
That is the strange thing. I tried introducing a random library to the
command, , and ld says 'cant find file' so it would seem to be finding
the .so file OK

--
Climate Change: Socialism wearing a lab coat.

Re: Weird compilation error

<uaq94f$2pe1u$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=6830&group=comp.sys.raspberry-pi#6830

  copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: Weird compilation error
Date: Mon, 7 Aug 2023 09:14:07 +0100
Organization: A little, after lunch
Lines: 18
Message-ID: <uaq94f$2pe1u$3@dont-email.me>
References: <uaoc68$2a4no$2@dont-email.me>
<wwvil9sup1g.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 7 Aug 2023 08:14:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b25dda442a0cb64764cc515d18e077e5";
logging-data="2930750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0ekrgavRzP8CYRkiCIpVNXFVEbpjWTsM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:GOVS8dVor6kel0DrzMMSYhPJwEY=
Content-Language: en-GB
In-Reply-To: <wwvil9sup1g.fsf@LkoBDZeT.terraraq.uk>
 by: The Natural Philosop - Mon, 7 Aug 2023 08:14 UTC

On 06/08/2023 17:13, Richard Kettlewell wrote:
> The library needs to be listed after the object files that depend on it,
> not before.

Ah. That seems to have fixed it, thanks.

Code doesn't work very well, but it does link ;)

--
Those who want slavery should have the grace to name it by its proper
name. They must face the full meaning of that which they are advocating
or condoning; the full, exact, specific meaning of collectivism, of its
logical implications, of the principles upon which it is based, and of
the ultimate consequences to which these principles will lead. They must
face it, then decide whether this is what they want or not.

Ayn Rand.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor