View previous topic :: View next topic |
Author |
Message |
Dark_Ebola n00b
Joined: 28 Dec 2004 Posts: 28
|
Posted: Sat May 05, 2007 5:14 pm Post subject: [mingw32] Cross compiling for win32 on x86_64? |
|
|
i'm trying to compile libgcrypt libs for win32.
so i'm using crossdev, and get nasty errors while compiling ...
i did:
Code: | emerge crossdev && crossdev i686-mingw32 |
which went fine.
now i'm trying to emerge libgcrypt with:
Code: | CPPFLAGS="-I /usr/i686-mingw32/mingw/include/" ROOT="/root/cross-gcrypt/" ARCH="mingw32" CHOST="i686" CBUILD="mingw32" CFLAGS="-O2" LDFLAGS="-L/usr/i686-mingw32/mingw/lib/ " emerge libgcrypt |
which gives (on compiling gpg-error)
Code: |
/usr/i686-mingw32/mingw/include/stdio.h:442: warning: `__cdecl__' attribute ignored
/usr/i686-mingw32/mingw/include/stdio.h:443: warning: `__cdecl__' attribute ignored
****<snip> zillions of time the same warning </snip>****
gcc -O2 -o gpg-error gpg_error-strsource-sym.o gpg_error-strerror-sym.o gpg_error-gpg-error.o -L/usr/i686-mingw32/mingw/lib/ ./.libs/libgpg-error.a
gpg_error-gpg-error.o: In function `get_err_from_symbol_one':
gpg-error.c:(.text+0x24): undefined reference to `_strnicmp'
gpg-error.c:(.text+0x67): undefined reference to `_stricmp'
gpg-error.c:(.text+0x91): undefined reference to `_strnicmp'
gpg-error.c:(.text+0xce): undefined reference to `_stricmp'
gpg_error-gpg-error.o: In function `get_err_from_str_one':
gpg-error.c:(.text+0x132): undefined reference to `_stricmp'
gpg-error.c:(.text+0x17f): undefined reference to `_stricmp'
gpg_error-gpg-error.o: In function `main':
gpg-error.c:(.text+0x1f1): undefined reference to `_errno'
gpg-error.c:(.text+0x20e): undefined reference to `_errno'
gpg-error.c:(.text+0x44a): undefined reference to `_imp___iob'
gpg-error.c:(.text+0x531): undefined reference to `_imp___iob'
gpg-error.c:(.text+0x572): undefined reference to `_imp___iob'
collect2: ld returned 1 exit status
|
i google my heart out of it, but i'm kinda clueless now.
i'm doing something wrong ... or forgotting something?
the configure says something that doesn't looks okay to me:
Code: | checking for ld used by GCC... /usr/x86_64-pc-linux-gnu/bin/ld |
shouldn't it use its own mingw-ld (or something)
anyway ... i don't even know if it's x86_64 related |
|
Back to top |
|
|
Dark_Ebola n00b
Joined: 28 Dec 2004 Posts: 28
|
Posted: Sun May 06, 2007 8:40 pm Post subject: |
|
|
got gpg-error to compile now with
Code: | CPPFLAGS="-I/usr/i686-mingw32/mingw/include/" ROOT="/usr/i686-mingw32/" ARCH="mingw32" CHOST="i686" CBUILD="mingw32" CFLAGS="-O2" LDFLAGS="-L/usr/i686-mingw32/mingw/lib/" CC="i686-mingw32-gcc" AR="i686-mingw32-ar" RANLIB="i686-mingw32-ranlib" emerge libgcrypt |
fighting with libgcrypt now
after modifying gcrypt.h
Code: |
33a34,35
> #else
> #include <ws2tcpip.h>
|
i'm getting stuck with:
Code: | /bin/sh ../libtool --mode=compile i686-mingw32-gcc -Wa,--noexecstack -O2 -c -o mpih-add1.lo `test -f 'mpih-add1.S' || echo './'`mpih-add1.S
i686-mingw32-gcc -Wa,--noexecstack -O2 -c mpih-add1.S -DPIC -o mpih-add1.o
/usr/libexec/gcc/i686-mingw32/as: unrecognized option `--noexecstack'
|
|
|
Back to top |
|
|
hvengel Guru
Joined: 19 Sep 2004 Posts: 515
|
Posted: Sun May 06, 2007 10:04 pm Post subject: |
|
|
I am trying to do the same things (IE. setup a cross compiler for building windows binaries on an amd64 linux machine) and I am finding that what documentation exists for this to be at best incomplete and contradictory. For example, it appears that you need to modify PORTDIR_OVERLAY and some sources have some information on this and other sources do not. But there also appears to be a conflict between layman and crossdev in how PORTDIR_OVERLAY is used. When any overlays are installed with layman crossdev uses the first overlay listed in /usr/portage/local/layman/make.conf. None of the documentations says anything about this issue. I have opened a bug report about this issue.
I had to uninstall all of my layman overlays to get crossdev to correctly setup the mingw32 overlays. At this point I am not sure if I can reinstall the layman overlays or if I need to do some hand tweaks to keep this working with the overlays. This is likely not your specific problem. So consider this an FYI.
I am now in the process of emerging the dependencies that I need for the app I want to cross compile with some of them working and some not. On those things that fail I am seeing "undefined reference" errors to what appear to be mostly math type functions. However I found that using the xmerge bash script from the gentoo crossdev guide http://www.gentoo.org/proj/en/base/embedded/cross-development.xml with a correctly set SYSROOT (/usr/i686-mingw32 in my case - likely the same for you) environment variable seems to correct these issues for me and I was able to build a number of things that would not build trying to set up the emerge with the command line. So you might want to try this script as I think it will fix the issues you are running into.
Another issue that I have run into is that it does not correctly handle building some libraries that require different source trees for different platforms. In particular I need to have the Qt3 libraries for my app. But Qt3 has different source tarballs and different dependencies for different platforms. But when I try to cross compile qt3 using emerge it is clearly trying to build the X11 version of Qt3 since it is pulling in a whole bunch of X11 and Unix (CUPS?) dependencies. So it looks like at least some stuff will have to be hand built - qt3 being one example - to avoid emerge related issues like this. |
|
Back to top |
|
|
Dark_Ebola n00b
Joined: 28 Dec 2004 Posts: 28
|
Posted: Mon May 07, 2007 1:12 am Post subject: |
|
|
thx for your input, i didn't came across that crossdev guide.
i wasn't aware of the SYSROOT variable, that'll make things a lot more easier for me.
hopefully i'm not mixing problems atm, and not playing with cross-compiling + overlays. I'll tell you if I'm getting problems using them (soon).
i think i'll have to patch libgcrypt since it seems they made some little mistakes with the WIN32 includes, that'll be the time to make an ebuild in an overlay and see if i'm getting the same bug as you. |
|
Back to top |
|
|
hvengel Guru
Joined: 19 Sep 2004 Posts: 515
|
Posted: Mon May 07, 2007 3:24 am Post subject: |
|
|
I know more about the layman issues now. The fix is fairly simple although I had to spend some time digging around to figure out what is was doing. Some sources such as the Gentto wiki HOWTO MinGW article say the order of the statements related to this in the make.conf should look like this:
PORTDIR_OVERLAY="/usr/i686-mingw32/usr/portage /usr/local/portage"
source /usr/portage/local/layman/make.conf
I have found that I need to do this:
source /usr/portage/local/layman/make.conf
PORTDIR_OVERLAY="/usr/i686-mingw32/usr/portage /usr/local/portage $PORTDIR_OVERLAY"
And that fixes the problem and layman no longer clobbers the overlay path needed for crossdev. This problem is specifically related to layman and not your own overlay directories.
I have also starting looking at setting up a mingw build for qt3 and I am finding that the qt-free-win sources are very poorly setup for a cross build. They include documentation on how to do it but nothing in the documentation works at least with the tarballs from their download page. I am thinking that this may have to do with the difference in line break characters between Windows and *nix platforms. I am going to try getting the source tree from CVS to see if that helps since that should have the correct line break characters.
Also please post anything else that you learn about this back on this thread or perhaps better yet on the Gentoo Wiki HOWTO MinGW page. I have seen a number of other threads asking about crossdev and mingw and most of them only have the original post and nothing else. So there is more information in this thread about this than any other thread I have found here. Which is sad considering that this thread does not have much info about this. Perhaps if we continue to post things we learn about this here it might actually be enough info to help others. |
|
Back to top |
|
|
akiross Veteran
Joined: 02 Mar 2003 Posts: 1170 Location: Mostly on google.
|
Posted: Mon Jun 11, 2007 12:39 am Post subject: |
|
|
Hi,
do you know which profile should i use for i686-mingw32?
I'm looking into /usr/portage/profiles but i can't find anything - hey, it seems i'm the only one having troubles with profiles
Thanks _________________ Libera scienza in libero stato.
Horizon of Events |
|
Back to top |
|
|
hvengel Guru
Joined: 19 Sep 2004 Posts: 515
|
Posted: Sat Jun 23, 2007 11:31 pm Post subject: |
|
|
As far as I can tell no one has the working good enough that they can actually do any real work using it. I know that I don't. But I also have no idea why that is the case. So it could be a profile problem but it could also be any number of other things as well. |
|
Back to top |
|
|
|