Re: [hatari-devel] mingw-w64

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On Thu, Sep 26, 2013 at 11:23 AM, Nicolas Pomarède
<npomarede@xxxxxxxxxxxx> wrote:
> On 26/09/2013 11:06, Christer Solskogen wrote:
>>
>> On Thu, Sep 26, 2013 at 12:07 AM, Nicolas Pomarède
>> <npomarede@xxxxxxxxxxxx> wrote:
>>
>>> I changed Toolchain-mingw32.cmake a little to allow changing the mingw's
>>> values using cmake -D parameters, instead of editing the file.
>>>
>>> In your case, you would use for example :
>>> -DMINGW_EXE_PREFIX=x86_64-w64-mingw32 -DMINGW_ROOT_PATH=i686-w64-mingw32
>>>
>>
>> Cool, but I think you only need to set one variable. The system should
>> be able to figure out the rest it self.
>> I mean, the setting over is meaningless since it will use a 64bit
>> compiler with a sysroot that contains 32bit libraries.
>>
>
> I don't see how the system can find MINGW_ROOT_PATH ; in my case and in most
> distribs it's "mingws", in your case it's i686-w64-mingw32. We can maintain
> a list of all possible directory variations that go under "sysroot/". Patch
> welcome if you have one.
>

The compiler does. If you use for instance have #include <SDL/SDL.h>
in your source file, the cross compiler will *not* use the one in
/usr/include, but will instead use the one that is located in
$SYSROOT.
If you compile a cross compiler without the --with-sysroot option, it
will default to ${gcc_tooldir}/sys-root (which in most distributions
will mean /usr/x86_64-w64-mingw32/sys-root)
My point is that the compiler knows where the sysroot are. You don't
have to tell the compiler, linker or make-system anything unless the
sys-root is somewhere else that gcc was initially configured with.

I don't rely on my distribution for the cross compiler, since I
compile that myself (I follow mingw-w64 a lot). And since I configure
gcc with a path and sysroot that is relative to each other, "my" cross
compiler is relocatable. And by that means that it does not care if it
is placed in /opt or $HOME. It will still find the correct headers and
libraries.

> /usr/i586-pc-mingw32/sys-root/mingw/
> or /usr/i686-w64-mingw32/sys-root/mingw
> or /usr/x86_64-w64-mingw32/sys-root/mingw
>
> I wouldn't go as far as to say that all distribs are wrong :)
>

I would. But also note that they do not compile gcc with
--with-sysroot. Also their compilers don't need to be relocateable.

> Also, Hatari build system should try to accomodate to what most distribs
> provide to ease compilation and inclusion of Hatari in such distribs
> (especially when they all provide the same directory hierarchy in that
> case). More advanced users who use their own tools will have no problem
> adjusting their settings.
>

I agree. But it is possible to accommodate both ways by doing it right
the first time :-)

-- 
chs,



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/