Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#24133 - [mingw32] mingw32-ld does not link properly

Attached to Project: Community Packages
Opened by Strephil (strephil) - Friday, 06 May 2011, 21:17 GMT
Last edited by Rémy Oudompheng (remyoudompheng) - Sunday, 21 August 2011, 13:53 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
My small program uses WinAPI SetSuspendState function.
I have #include <powrprof.h> and try to build:

$ i486-mingw32-gcc -l powrprof win_main.c -L /usr/i486-mingw32/lib -Wall -L /usr/i486-mingw32/lib/
/tmp/ccug5T9D.o:win_main.c:(.text+0x2f1): undefined reference to `_SetSuspendState@12'
collect2: ld returned 1 exit status

In Debian Squeeze all is OK.

Additional info:
$ pacman -Q mingw32-gcc mingw32-binutils mingw32-w32api
mingw32-gcc 4.5.2-3
mingw32-binutils 2.21-1
mingw32-w32api 3.16-1
This task depends upon

Closed by  Rémy Oudompheng (remyoudompheng)
Sunday, 21 August 2011, 13:53 GMT
Reason for closing:  Not a bug
Additional comments about closing:  User did not use proper compilation arguments
Comment by Sergej Pupykin (sergej) - Friday, 06 May 2011, 22:52 GMT
Works for me:

$ cat q.c
#include <windows.h>
#include <powrprof.h>

int main()
{
SetSuspendState(0,0,0);
return 0;
}


$ i486-mingw32-gcc q.c -lpowrprof

$ ls -l a.exe
-rwxr-xr-x 1 sergej sergej 22178 Май 7 02:52 a.exe
Comment by Strephil (strephil) - Saturday, 07 May 2011, 11:23 GMT
My experience:

$ cat q.c
#include <windows.h>
#include <powrprof.h>

int main()
{
SetSuspendState(0,0,0);
return 0;
}
$ i486-mingw32-gcc -lpowrprof q.c
/tmp/ccEsWoQ4.o:q.c:(.text+0x2e): undefined reference to `_SetSuspendState@12'
collect2: ld returned 1 exit status
$ i486-mingw32-gcc q.c -lpowrprof
$ ls a.exe
a.exe

Is it bug or feature?
Comment by Sergej Pupykin (sergej) - Saturday, 07 May 2011, 18:37 GMT
It is feature of gnu ld. Order of -l options is meaningful.
Comment by Strephil (strephil) - Saturday, 07 May 2011, 21:00 GMT
Yes, it is meaningful for gnu ld. But what is about collect2? gcc uses collect2 to solve this problem…
Comment by Sergej Pupykin (sergej) - Tuesday, 12 July 2011, 13:29 GMT
strace -f i486-mingw32-gcc -lpowrprof qww.c 2>&1 | grep collect

shows that i486-mingw32-gcc also uses /usr/lib/gcc/i486-mingw32/4.5.2/collect2, but it does not work properly.

Loading...