Thanks for the quick reply.  I've spent some more time fighting with it,
with varying degrees of success, but I've now hit a brick wall with regards
to multilib.  Apologies in advance for the long email, but hopefully the
details here and any responses will help to guide others following this
path in future.

I've been loosely following the guide I found at
http://pete.akeo.ie/2010/07/compiling-mingw-w64-with-multilib-on.html in an
effort to put together a step by step process that someone in my position
in future can follow; this is how far I got:

mkdir /usr/src/mingw-build
cd /usr/src/mingw-build
# wget gcc here
tar -xvvzf gcc-6.2.0.tar.bz2
cd gcc-6.2.0
contrib/download_prerequisites
cd ..
# get and build binutils:
.. get binutils
tar -xvvzf binutils-2.27.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-2.27/configure --target=x86_64-w64-mingw32
--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 --with-system-zlib
--prefix=/usr/local/x86_64-w64-mingw32
make -j$(nproc)
make install
cd ..
# build mingw headers:
mkdir mingw-build
cd mingw-build
../mingw-w64-v5.0.0/mingw-w64-headers/configure --host=x86_64-w64-mingw32
--prefix=/usr/local/x86_64-w64-mingw32
make install
cd ..
# mingw directories and symlinks:
mkdir -p /usr/local/x86_64-w64-mingw32/lib32
ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64
# build gcc, pass 1:
cd gcc-6.2.0
contrib/download_prerequisites
cd ..
mkdir gcc-build
cd gcc-build
../gcc-6.2.0/configure --disable-nls --target=x86_64-w64-mingw32
--enable-languages=c,c++ --with-system-zlib --enable-multilib
--enable-version-specific-runtime-libs --enable-shared
--enable-fully-dynamic-string
make all-gcc -j$(nproc)
make install-gcc
cd ..
# build mingw crt:
cd mingw-build
../mingw-w64-v5.0.0/configure --disable-nls --host=x86_64-w64-mingw32
--enable-experimental --prefix=/usr/local/x86_64-w64-mingw32
make -j$(nproc)
make install -j$(nproc)
cd ..
# build gcc, pass 2:
cd gcc-build
make -j$(nproc)  # and this fails

...and here is where things begin to unwind.  The build fails with a number
of the following:
    /usr/local/x86_64-w64-mingw32/bin/ld: skipping incompatible
/usr/local/x86_64-w64-mingw32/lib/libmingwthrd.a when searching for
-lmingwthrd
    /usr/local/x86_64-w64-mingw32/bin/ld: cannot find -lmingwthrd
    (etc)
and, sure enough, objdump -f
/usr/local/x86_64-w64-mingw32/lib/libmingwthrd.a | grep ^arch tells me
those are x86-64.  The full log from a single-job rerun of that make is too
long to paste here, but is uploaded at http://hastebin.com/iwesavijed.txt

Now, the guide I linked above also encounters an error like this one (which
is presumably why it suggested creating the lib64 and lib32 symlinks
separately earlier), and now it suggests modifying the makefile in
x86_64-w64-mingw32/32/libgcc/Makefile to introduce a CC32 variable and
replacing lib with lib32.  Here, in line with the experiences of the guide
I'm following, begins an adventure of repeatedly calling make.  I'm pretty
sure that by this point there's something I could have done differently to
avoid this sequence, but I'm at a loss to find it.  Nevertheless, the
following works, up to a point:

# modify x86_64-w64-mingw32/32/libgcc/Makefile to replace all instances of
lib with lib32 and introduce a CC32 copy of the CC variable:
#      apply patch at http://hastebin.com/pikulisaqu.patch
cd x86_64-w64-mingw32/32/libgcc
make -j$(nproc)
cd ../../..
cp Makefile Makefile_64
# modify Makefile to replace lib with lib32:
#      apply patch at http://hastebin.com/fiwogiyuqo.patch
cp Makefile Makefile_32
make -j$(nproc)
# the above will fail, this time looking for 64bit libraries
cd x86_64-w64-mingw32/32/libgcc
make -j$(nproc)
cd ../../..
make -j$(nproc)
# the above will fail with more 32bit errors, different ones this time...
cp Makefile_64 Makefile
make
# the above will fail with checking for ld that supports
-Wl,--gc-sections... configure: error: Link tests are not allowed after
GCC_NO_EXECUTABLES.
# we simply try again and it succeeds:
make
# the above will fail with /bin/bash: ../libtool: No such file or directory
cp libcc1/libtool x86_64-w64-mingw32/libstdc++-v3
make -j$(nproc)
# the above will fail with
../../../../gcc-6.2.0/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc:25:21:
fatal error: gstdint.h: No such file or directory
# we grab it from a different part of the tree (this may not be correct,
however):
cp gcc/include/stdint.h x86_64-w64-mingw32/libstdc++-v3/include/gstdint.h
make

And this now fails with a slew of undefined references, starting with:

    ../libsupc++/.libs/libsupc++convenience.a(eh_alloc.o): In function
`__gthread_mutex_init_function':

/usr/src/mingw_build_temp/gcc-build/x86_64-w64-mingw32/libstdc++-v3/include/x86_64-w64-mingw32/bits/gthr-default.h:471:
undefined reference to `__gthr_win32_mutex_init_function'

The rest of the result of that last make is far too long to paste here but
listed in full at: http://hastebin.com/patedaloji


And here I am at a complete loss as to how to continue - any help at all
would be appreciated.  If I've gone wrong somewhere earlier along the line,
and could have avoided all the 32bit/64bit makefile fiddling, I would also
love to hear how, as I doubt that the above is how it's supposed to proceed.


Regards,
Riot

...

On 7 December 2016 at 23:25, JonY <jo...@users.sourceforge.net> wrote:

> On 12/07/2016 07:45 PM, Riot wrote:
> > Hi all,
> >
> > I've been using MinGW-w64 for a long while now, but always on windows.
> I'm
> > currently trying to cross-compile windows projects on linux for the first
> > time.
> >
> > The issue I've run into is that std::experimental is not enabled in
> > Debian's packaged version of mingw-w64, which I need for
> > std::experimental::filesystem in several projects (and which is enabled
> in
> > the mingw-builds version on windows).  Since the repository packages
> aren't
> > built the way I need, and it seems there are no linux binary packages for
> > download anywhere on the site, I need to build my own.
> >
> > I've started by downloading and extracting mingw-w64-v5.0.0.tar.bz2 to
> > /usr/src/mingw-w64-v5.0.0 and configuring as follows:
> >
> > tar -xvvjf mingw-w64-v5.0.0.tar.bz2
> > mkdir mingw-w64-v5.0.0-build
> > cd mingw-w64-v5.0.0-build
> > ../mingw-w64-v5.0.0/configure --enable-experimental
> >
> > and I got:
> >
> > ...
> > checking for unistd.h... yes
> > checking _mingw_mac.h usability... no
> > checking _mingw_mac.h presence... no
> > checking for _mingw_mac.h... no
> > configure: error: Please check if the mingw-w64 header set and the
> > build/host option are set properly.
> > configure: error: ../../mingw-w64-v5.0.0/mingw-w64-crt/configure failed
> for
> > mingw-w64-crt
> >
>
> You need to bootstrap, build and install the headers first, and then the
> 1st stage gcc, then crt, lastly complete gcc.
>
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/xeonphi
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to