wanted to contribute to the multilib cross compiler issue. I just
joined the list to share my solution to the problem of a failed build
for the gcc stage 2 - and hopefully the documentation/Makefile can be
adjusted.

My procedure for building the cross compiler pretty much follows the
documentation, except for one difference:
I used the branches/release version and the howto
http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/branches/releases/v1.0/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt?revision=3506&view=markup

This howto says in line 235, to create a mingw link
ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw

I am not sure if this is really necessary, or if it has changed
recently, but what is required to build stage 2 of gcc is to make a
link in the gcc build directory to mingw, so basically

cd gcc-4.5.1-build
ln -s /mypath/x86_64-w64-mingw32 ./mingw

assuming, that you are building/configuring gcc in the folder
gcc-4.5.1-build - otherwise whatever path
I guess the howto assumes that /mypath is also the configure and build
directory, than you do not have that problem, but if your
build/configure directory is somewhere totally else, than gcc does not
know here to find the mingw folder

make and make install runs smoothly afterwards!!

After make install, the last thing I did was, to make symlinks in
sysroot or prefix
ln -s /mypath/lib/gcc/x86_64-w64-mingw32/lib32/libgcc_s.a
/mypath/x86_64-w64-mingw32/lib32/
and
ln -s /mypath/lib/gcc/x86_64-w64-mingw32/lib64/libgcc_s.a
/mypath/x86_64-w64-mingw32/lib64/

compiler and linker works (at least -m32, I have not tried the 64bit)

Here are the details
It took me some time to figure that out, but after getting this error
all the time
for this command:
ln -s -f libgcc.map libgcc.map.def && if [ ! -d 32/shlib ]; then mkdir
32/shlib; else true; fi &&
/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/./gcc/xgcc
-B/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/./gcc/
-L/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/lib
-L/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/mingw/lib
-isystem 
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/include
-isystem /blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/mingw/include
-B/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/bin/
-B/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/lib/
-isystem 
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/include
-isystem 
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/sys-include
   -O2 -I../../../../../gcc/gcc-4.5.1/gcc/../winsup/w32api/include -g
-O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include   -g -DHAVE_GTHR_DEFAULT
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs
libgcc.map.def -Wl,--out-implib,32/shlib/libgcc_s.a.tmp -o
32/shlib/libgcc_s_sjlj-1.dll.tmp -g -O2 -m32 -B./ _chkstk_s.o
_muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o
_cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o
_trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o
_addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o
_negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o
_clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o
_popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o
_powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o
_muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o
_divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o
_fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o
_fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o
_floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o
_floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o
_udiv_w_sdiv_s.o _udivmoddi4_s.o gthr-win32_s.o addtf3_s.o divtf3_s.o
eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o
unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o
fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o
extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o
trunctfdf2_s.o trunctfxf2_s.o tf-signs_s.o unwind-dw2_s.o
unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o
emutls_s.o -lmingw32 -lmingwex -lmoldname -lmsvcrt -luser32 -lkernel32
-ladvapi32 -lshell32 && if [ -f 32/shlib/libgcc_s_sjlj-1.dll ]; then
mv -f 32/shlib/libgcc_s_sjlj-1.dll
32/shlib/libgcc_s_sjlj-1.dll.backup; else true; fi && mv
32/shlib/libgcc_s_sjlj-1.dll.tmp 32/shlib/libgcc_s_sjlj-1.dll && mv
32/shlib/libgcc_s.a.tmp 32/shlib/libgcc_s.a

the error is (and more of those)
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/bin/ld:
skipping incompatible
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/lib/libmingw32.a
when searching for -lmingw32

They are only warnings, but ultimately, the error is:
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32/bin/ld:
cannot find -lmingw32

the same for:
-lmingwex, -lmoldname, -lmsvcrt, -luser32, -lkernel32, -ladvapi32, -lshell32

The problem is, xgcc does not know about the lib32 mypath - when calling
/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/./gcc/xgcc
-m32 --print-search-dirs

this is the output
libraries: 
=/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/4.5.1/32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/lib/../lib32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/..//mingw/lib/x86_64-w64-mingw32/4.5.1/32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/..//mingw/lib/../lib32/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/4.5.1/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/lib/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/..//mingw/lib/x86_64-w64-mingw32/4.5.1/:/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/gcc/..//mingw/lib/

it only list the builddir subfolders of:
/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/
but my sysroot and prefix are both:
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/
and that is where everything is installed

basically, I needed a link to the
/blue/meilerlab/apps/Linux2/x86_64/mingw-w64/2010.09.07/x86_64-w64-mingw32
in my build directory:
/blue/meilerlab/apps/Linux2/src/mingw-w64/build/x86_64-w64-mingw32/gcc-4.5.1/
called mingw - now the stage one xgcc knows where to find the
libraries
ln -s /mypath/x86_64-w64-mingw32 ./mingw

After make install, the last thing I did was, to make symlinks in
sysroot or prefix in
x86_64-w64-mingw32/lib32/
to lib/gcc/x86_64-w64-mingw32/lib32/libgcc_s.a
and
x86_64-w64-mingw32/lib64/
to lib/gcc/x86_64-w64-mingw32/lib64/libgcc_s.a

because yet again, this library path is not a default search path.

I also tried Pete's solution first, and the compiling worked, but the
32 libs were not created
http://pete-tech.blogspot.com/2010/07/compiling-mingw-w64-with-multilib-on.html

Let me know if I can help with more details.
My final suggestion is to change the howto from

230     Step 3) GCC requires the x86_64-w64-mingw32 directory be mirrored as a
231     directory 'mingw' in the same root. So, if using configure default
232     /usr/local, type:
233     ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw
234     or, for sysroot, type:
235     ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw

to

230     Step 3) GCC requires the x86_64-w64-mingw32 directory be mirrored as a
231     directory 'mingw' in the same root and in the build folder. So,
if using configure default
232     /usr/local, type:
233     ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw
233a ln -s /usr/local/x86_64-w64-mingw32 ./mingw
234     or, for sysroot, type:
235     ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw
235a ln -s /mypath/x86_64-w64-mingw32 ./mingw

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to