delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/12/13/11:52:23

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4BDGqMKC2389728
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4BDGqMKC2389728
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=pFveU8ss
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2297B3858C32
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1734108740;
bh=+5ByODgVupWMzdZgw+/eqlqJmex2SpdbKOYb+Py52eo=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=pFveU8ss2aBAIH7x5bW0ppDpXFiBMvuNbQcYPbNqBNXHFzSbFkToW5OWWN0z4tv/l
5KYDaUIsAz9xt7VJMaTJeHG93d4PxdQuvjbeeMz9gshjcRyTD2lwV4x4jSYi1GR18f
O8l4HZCwz0OErB9WJJbRDqwmJZE+Cn0RBCFHONWA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77D713858C2B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 77D713858C2B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734108640; cv=none;
b=PMo2PvrGomqtrdZmO0zpjjdMfpolTAZxfw3NeUAD+yLLVB1gsdt0KRw18VkglujEMyXgdoIxmJ63cl+LBvn9gaSL26H6X93+O9qjIxd8Yc5PulQr0qu47yNCGctnEj4Y4mjzEtWAtu8tCWWRAhCRSHyHo1oQsquAZqvbe7G2tSM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1734108640; c=relaxed/simple;
bh=5S/KbDs1pHVeqhBsAXJuejhTZ8klJZ82gj5fTogMi04=;
h=Message-ID:Date:MIME-Version:Subject:To:From:DKIM-Signature;
b=IFfmT/kjkk4U7IZSl48x0hsHTnKqdO1mELFm1nRlsCXia/UtTvyt18gyXUJ/QGdos3mmAsBp9kwEW6u2G5YpoYaSRXIrXOHFkRmp7lsHUsa5k+iSGD/IpKtjBQnhYwmBPElZkt/w3beUh88q29vs/HVbbmFsLpopz3B7KauSb1A=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77D713858C2B
Message-ID: <4e44e108-ad1b-4981-8299-da004dfc0c75@SystematicSW.ab.ca>
Date: Fri, 13 Dec 2024 09:50:37 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Building a x86_64-pc-cygwin cross compiler for x86_64-pc-linux-gnu
To: cygwin AT cygwin DOT com
References: <7585f168-4611-447c-911a-c8fa7b3ecaa1 AT johannesthoma DOT com>
Organization: Systematic Software
In-Reply-To: <7585f168-4611-447c-911a-c8fa7b3ecaa1@johannesthoma.com>
X-Rspamd-Queue-Id: 4B0A41D
X-Rspamd-Server: rspamout01
X-Stat-Signature: 8bsuu61sz6cot5hbu9jgxkq86g6pkn1m
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX1/ASZonPIFgbdWc2KKiCBJ77XAT8Dd4qFo=
X-HE-Tag: 1734108614-315909
X-HE-Meta: U2FsdGVkX1+gphuoq/cMqR+511Sjti75EUmnJB/drUrv593apzCjJmmoYY4ey0vEcZ8nkJDMHVO79/EHbxmXA7hFWqi3QbMtXWZStkj1Z8QmNB5Vym3GYJPPVipTKyaw2ondz1btM05COf7vJ4CT7V9ckMDfXhgpGk4zaT2aNCWqcPvoBeZ2QheG5QLakQiqNyVnzSu9/l+IYfg3xWP8IV/2w/MtsoTt5uelXvHHUfAcNKE5ipawQczD313CzYXVQ0/a7Myq/jjuD+ZY8gSloQ6Zt60UCcw2T5Tf1MZDDjfmOFHySTURUMg4HsoBt17+KoJxS617Ft4YODqwqr77ve+iUwKwBt9eFxgwoEcs0blVu9aysUcJJBrD/NOotpVeirO74NQ8rL9qmxpOujLBweIrg8GNiHptqlWezOYZHuxfmDrgQz6LNUfpx4vOC27WXR04OI8xNx7Q1jVYiWHshzwMjomDTRXst51R6/8A/aAtTAoPcoRyeVFVQsYPZUZlZmup1ipfCwDklkdlvZr+yP1EpkXcQMSigyKiZuqsVJ28JDuDQWlC3+NFvq34UfijLaLAVB3hfNxcHH5LHpHcBJfL7eGgBxW86bS17ZozSoEThsmFcW+E0nHiIti0l8op3o1xFoondjXTKHlwCseWXA==
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4BDGqMKC2389728

On 2024-12-13 08:13, Johannes Khoshnazar-Thoma via Cygwin wrote:
> Hi list,
> 
> At the moment I am stuck building a cygwin gcc compiler that runs on
> Linux and creates cygwin executables.
> 
> Here's what I did:
> 
> Downloaded and installed binutils:
> 
> git clone --depth 1 -b master https://sourceware.org/git/binutils-gdb.git binutils
> cd binutils
> ./configure --prefix=/home/johannes/cygwin-build-gcc/sysroot/ --disable-shared 
> --enable-static --with-sysroot=/home/johannes/cygwin-build-gcc/sysroot/ -- 
> target=x86_64-pc-cygwin --disable-multilib --disable-nls --enable-lto --disable-gdb
> make -j 10
> make install
> 
> which went fine.
> 
> Now after trying to compile gcc it (later) complains about missing windows.h 
> header.
> So I downloaded and installed the MinGW-w64 package, configured and installed it
> (also to this sysroot but in the x86_64-pc-cygwin directory:
> 
> git clone --depth 1 -b master https://git.code.sf.net/p/mingw-w64/mingw-w64 
> mingw-w64
> cd mingw-w64
> ./configure --build=x86_64-pc-linux-gnu --host=x86_64-w64-mingw32 \
> --prefix=/home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin --without-crt
> make install
> 
> (I also tried with --host=x86_64-pc-cygwin)
> 
> Question: As far as I understood it, installing the MinGW headers is a prerequisite
> to building a x86_64-pc-cygwin cross compiler (because libgcc will need certain
> windows headers). Is that correct?
> 
> Then I tried various gcc configure options:
> 
> git clone --depth 1 -b releases/gcc-14 https://gcc.gnu.org/git/gcc.git gcc
> cd gcc
> ./contrib/download_prerequisites
> ../configure --target=x86_64-pc-cygwin --host=x86_64-pc-linux --disable-shared \
> --enable-static --disable-multilib --prefix=/home/johannes/cygwin-build-gcc/ 
> sysroot/ \
> --enable-languages=c,c++ --disable-nls --enable-threads=posix \
> --with-newlib=/home/johannes/cygwin-build-gcc/newlib-cygwin \
> --with-cygwin=/home/johannes/cygwin-build-gcc/newlib-cygwin --with-system-libunwind
> make -j 8
> 
> Building gcc (xgcc) works fine but when the stage1 compiler tries to compile
> libgcc I get lots of errors complaining about certain types not found:
> 
> Compiler command line is:
> 
> /home/johannes/cygwin-build-gcc/gcc/build/./gcc/xgcc \
> -B/home/johannes/cygwin-build-gcc/gcc/build/./gcc/ \
> -B/home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/bin/ \
> -B/home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/lib/ \
> -isystem /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/include \
> -isystem /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/sys-include    \
> -g -O2 -O2 -I../../../libgcc/../winsup/w32api/include -I../../../libgcc/../ 
> winsup/include \
> -I../../../libgcc/../winsup/cygwin/include -g -O2 -DIN_GCC - 
> DCROSS_DIRECTORY_STRUCTURE  \
> -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes - 
> Wmissing-prototypes \
> -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc \
> -fno-stack-protector -Dinhibit_libc  -I. -I. -I../.././gcc -I../../../libgcc \
> -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include \
> -I../../../libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS - 
> DUSE_EMUTLS  \
> -o unwind-seh.o -MT unwind-seh.o -MD -MP -MF unwind-seh.dep -fexceptions -c \
> ../../../libgcc/unwind-seh.c
> 
> First few error outputs are:
> 
> In file included from /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/ 
> include/winnt.h:16,
>                   from /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/ 
> include/minwindef.h:163,
>                   from /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/ 
> include/windef.h:9,
>                   from /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/ 
> include/windows.h:69,
>                   from ./unwind.h:34,
>                   from ../../../libgcc/unwind-seh.c:29:
> /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/include/ 
> ctype.h:43:17:error: unknown type name 'wctype_t'
>     43 |   _CRTIMP const wctype_t * __cdecl __pwctype_func(void);
>        |                 ^~~~~~~~
> /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/include/ctype.h:123:24 
> error: unknown type name 'wint_t'
>    123 |   int __cdecl iswalpha(wint_t _C);
>        |                        ^~~~~~
> /home/johannes/cygwin-build-gcc/sysroot/x86_64-pc-cygwin/include/ctype.h:124:24 
> error: unknown type name 'wint_t'
>    124 |   int __cdecl iswupper(wint_t _C);
>        |                        ^~~~~~
> 
> followed by many others.
> 
> Researching a bit showed that there is a _cygwin.h header that #defines 
> _INTPTR_T_DEFINED
> to prevent corecrt.h to typedef intptr_t. But in my case the cygwin headers are not
> included.
> 
> I also tried to symlink winsup to the gcc root directory: same result plus
> a non-existent header:
> 
> ../../../libgcc/../winsup/cygwin/include/features.h:13:10: fatal error: sys/ 
> features.h: No such file or directory
>     13 | #include <sys/features.h>
> 
> Is there a web resource that explains how to create a cygwin cross compiler
> for Linux? Or even better a shell script that does it? What should I do to
> fix the intptr_t issue?

Read the instructions:

	https://x.cygwin.com/docs/cg/cross.html

Recipe for Fedora:

	https://cygwin.com/pipermail/cygwin-cvs/2020q3/014567.html

Fedora copr:

	https://copr.fedorainfracloud.org/coprs/yselkowitz/cygwin/

Posts:

	https://inbox.sourceware.org/cygwin/?q=s:cross

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019