public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gcc x86 - problem on library search order
@ 2016-04-25 19:34 Marco Atzeri
  2016-04-26 12:11 ` JonY
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2016-04-25 19:34 UTC (permalink / raw)
  To: cygwin

Visible on 32bit and not present on 64bit

$ cat uuid.c
#include <uuid/uuid.h>

int main ()
{
     uuid_t out;
     uuid_generate_random(out);
     return 0;
}


$ gcc uuid.c -luuid
/tmp/ccLlmFMf.o:uuid.c:(.text+0x16): undefined reference to 
`uuid_generate_random'
collect2: error: ld returned 1 exit status

$ gcc uuid.c -luuid -L /usr/lib


The problem seems "/usr/lib/w32api" searched
before "/usr/lib"

$ cygcheck -l w32api-runtime |grep libuuid.
/usr/lib/w32api/libuuid.a

$ cygcheck -l libuuid-devel |grep libuuid.dll
/usr/lib/libuuid.dll.a

$ cygcheck -c gcc-core
Cygwin Package Information
Package              Version        Status
gcc-core             5.3.0-4        OK


Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc x86 - problem on library search order
  2016-04-25 19:34 gcc x86 - problem on library search order Marco Atzeri
@ 2016-04-26 12:11 ` JonY
  2016-04-26 13:54   ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: JonY @ 2016-04-26 12:11 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

On 4/26/2016 01:46, Marco Atzeri wrote:
> Visible on 32bit and not present on 64bit
> 
> $ cat uuid.c
> #include <uuid/uuid.h>
> 
> int main ()
> {
>     uuid_t out;
>     uuid_generate_random(out);
>     return 0;
> }
> 
> 
> $ gcc uuid.c -luuid
> /tmp/ccLlmFMf.o:uuid.c:(.text+0x16): undefined reference to
> `uuid_generate_random'
> collect2: error: ld returned 1 exit status
> 

Pretty sure I removed the patch that does that, not sure where it gets
in from. It isn't in the specs file either.

-Wl,-v does say it is from gcc.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc x86 - problem on library search order
  2016-04-26 12:11 ` JonY
@ 2016-04-26 13:54   ` Marco Atzeri
  2016-04-26 17:29     ` JonY
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2016-04-26 13:54 UTC (permalink / raw)
  To: cygwin



On 26/04/2016 12:16, JonY wrote:
> On 4/26/2016 01:46, Marco Atzeri wrote:
>> Visible on 32bit and not present on 64bit
>>
>> $ cat uuid.c
>> #include <uuid/uuid.h>
>>
>> int main ()
>> {
>>     uuid_t out;
>>     uuid_generate_random(out);
>>     return 0;
>> }
>>
>>
>> $ gcc uuid.c -luuid
>> /tmp/ccLlmFMf.o:uuid.c:(.text+0x16): undefined reference to
>> `uuid_generate_random'
>> collect2: error: ld returned 1 exit status
>>
>
> Pretty sure I removed the patch that does that, not sure where it gets
> in from. It isn't in the specs file either.
>
> -Wl,-v does say it is from gcc.

may be from "COLLECT_GCC_OPTION" as "LIBRARY_PATH" has the right order

LIBRARY_PATH=/usr/lib/gcc/i686-pc-cygwin/5.3.0/:/usr/lib/gcc/i686-pc-cygwin/5.3.0/../../../../i686-pc-cygwin/lib/:/usr/lib/:/lib/:/usr/lib/w32api/

COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
  /usr/lib/gcc/i686-pc-cygwin/5.3.0/collect2.exe -plugin 
/usr/lib/gcc/i686-pc-cygwin/5.3.0/cyglto_plugin.dll 
-plugin-opt=/usr/lib/gcc/i686-pc-cygwin/5.3.0/lto-wrapper.exe 
-plugin-opt=-fresolution=/tmp/ccqHx4mQ.res 
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lcygwin -plugin-opt=-pass-through=-ladvapi32 
-plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 
-plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lgcc --build-id --wrap _Znwj --wrap _Znaj 
--wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwjRKSt9nothrow_t --wrap 
_ZnajRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap 
_ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg 
--large-address-aware --tsaware /usr/lib/crt0.o 
/usr/lib/gcc/i686-pc-cygwin/5.3.0/crtbegin.o 
-L/usr/lib/gcc/i686-pc-cygwin/5.3.0 
-L/usr/lib/gcc/i686-pc-cygwin/5.3.0/../../../../i686-pc-cygwin/lib 
-L/usr/lib/w32api /tmp/ccHGOCXX.o -luuid -lgcc_s -lgcc -lcygwin 
-ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc 
/usr/lib/default-manifest.o /usr/lib/gcc/i686-pc-cygwin/5.3.0/crtend.o
/tmp/ccHGOCXX.o:uuid.c:(.text+0x16): undefined reference to 
`uuid_generate_random'
collect2: error: ld returned 1 exit status

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc x86 - problem on library search order
  2016-04-26 13:54   ` Marco Atzeri
@ 2016-04-26 17:29     ` JonY
  0 siblings, 0 replies; 4+ messages in thread
From: JonY @ 2016-04-26 17:29 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

On 4/26/2016 20:10, Marco Atzeri wrote:
> 
> 
> On 26/04/2016 12:16, JonY wrote:
>> On 4/26/2016 01:46, Marco Atzeri wrote:
>>> Visible on 32bit and not present on 64bit
>>>
>>> $ cat uuid.c
>>> #include <uuid/uuid.h>
>>>
>>> int main ()
>>> {
>>>     uuid_t out;
>>>     uuid_generate_random(out);
>>>     return 0;
>>> }
>>>
>>>
>>> $ gcc uuid.c -luuid
>>> /tmp/ccLlmFMf.o:uuid.c:(.text+0x16): undefined reference to
>>> `uuid_generate_random'
>>> collect2: error: ld returned 1 exit status
>>>
>>
>> Pretty sure I removed the patch that does that, not sure where it gets
>> in from. It isn't in the specs file either.
>>
>> -Wl,-v does say it is from gcc.
> 
> may be from "COLLECT_GCC_OPTION" as "LIBRARY_PATH" has the right order
> 
> LIBRARY_PATH=/usr/lib/gcc/i686-pc-cygwin/5.3.0/:/usr/lib/gcc/i686-pc-cygwin/5.3.0/../../../../i686-pc-cygwin/lib/:/usr/lib/:/lib/:/usr/lib/w32api/
> 

In -Wl,-v, looks like 64bit gcc too has -L/usr/lib/w32api, however, it
is "-L/usr/lib/../lib -L/lib/../lib
-L/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/lib
-L/usr/lib/w32api", so it comes out correct eventually. The 32bit
version is lacking that.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-26 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-25 19:34 gcc x86 - problem on library search order Marco Atzeri
2016-04-26 12:11 ` JonY
2016-04-26 13:54   ` Marco Atzeri
2016-04-26 17:29     ` JonY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).