delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/12/13/10:15:33

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4BDFFXEN2360371
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 4BDFFXEN2360371
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=pGaRMUkR
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E7D83858290
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1734102931;
bh=4ZwCAPvwckykYVo/J1hrKmO2we6yCx8Ham8cYrN0BUw=;
h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=pGaRMUkRxVwWzdzX09oVMWW/aeQxCDMxZWUjy7ieOOjxB8lL+ubuLO/gLCPTPr0V3
Vg8y1YPkkd1wrhqE4aNjY4skYZOA9Mk2YMk6qfs/CfSa4XVcMtbf5LUj7o9wH/YRq7
+G5Zx9wl9y4Y25ewXGa33AP+EmJaG8Jr/o+CEIUQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45E8C3858294
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 45E8C3858294
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734102829; cv=none;
b=tU6mBaICYkNK5oi3sq3HVXJMS0Grjpc7oGjviN/7etIgy/Fk8gTuzA/3NGK2Nsk4ZD2jh+qochAwlot9xaHNX3RF9+weZXot3oVtqb520+QULyk0ETQc+fxGTkKEf+Gy+WYcLHi7o0f+rwGU9ZBIFMyP3sTOFT1qtP2/lRHpUlw=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1734102829; c=relaxed/simple;
bh=XQuqUuSZ/DQ3KSRzO+SIgsWE+OU/0aMlelWYoF3Pc9c=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject;
b=uteAhq9tIF8MIaYsgF52R5d9WStcu4th+KAsuRRf6IWaUcijnM8ZVYSsmQHHy2wwnmRcMTXW6ceRKnjPv2/tBjDaB3nty0G+88uMipIDiKA9nDLkZxoOznk3BNH9lG99MkSVnC/RRzcYqEsk5I9cbFlsYyVGiCYKwTNK7x+fyo8=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45E8C3858294
X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6
Message-ID: <7585f168-4611-447c-911a-c8fa7b3ecaa1@johannesthoma.com>
Date: Fri, 13 Dec 2024 16:13:47 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: Building a x86_64-pc-cygwin cross compiler for x86_64-pc-linux-gnu
X-Provags-ID: V03:K1:rVZCTA+BMEnBCKMVuFYxUw58ACq2qGIvxpj/0Sb1Xfp1TTdiojG
VtPJW6ATDtarBcbskpoLrxtzs2qfQ/i9CMi0GvMuyMDmwZddWN/clPdklcTIH2sOTkp1Vob
/Ao0lS5ioes2tfiwA1byVv3COTH4DmhCxgoYCzmBQ8ePR9dbpg2JoHWHDdQEcYuuPIDq/3g
8yzhTqaxGCoyvMUwOy40w==
UI-OutboundReport: notjunk:1;M01:P0:pkxk1GYbxFs=;8IY81ZbwYFKC0KNjdzxj5AIUzkR
cJuSPPu8rAwz3cRdWMJNtrtnpQkouAc0MWi4Z8Bw/ouDu+kRqjL6u03xrl9Pq5D+XAZx8F19N
jv5VSXUamUm2hvyoYafh33eSHsAiNUyzP+TifVa9oAF3Fko2I0TV0AlcLueB61jqploGSFPHl
4RrtSd+dCcOkFtwiMkNjoZKBlTn4Ow18m5jq7GcXffh1wrAr5XCFQueHP60fSHLqhUZPfb200
zNWmQaq0KgwRuFjfuSSjxCnf1B1eiC9DwbjF/0Q+1ppZGUOtT5+hTdGT6J9ZgTxjWo7lMgh07
EW5Vyvo3IlpZklrDkGGfvdnfQO3/ivc70WMRrcBuiPJxOv+tivEEb9nEJDg03hq9+i6ZfI+xZ
0xgJ1hbHrN6/Uvv48f1ab1o2Ru1jqIPVCtE0Z9FL+El7cRmTefGtwvkkxB7DIX2IHtUMpj/Y7
f5kT/crlMSGzilr4AgBojdrSev1vXRS8u1yoDHAJZCRNP9tHcfZdMg6+LvfzrjFnSWZ7Fv6pe
5I/1K9+yywJ/KjiiRB1H0Dg5nRjPC8j9AWtw4hb/lU8kyMtGRyazceKgZ05dA234lV5m9r/aE
lZJpiJThPDTM+TLN2E0Wk7QehJh9kOsdRVY+WfL8Nm31Dc8ybi9Tt4mUa4byyaIgokE5wdUFt
yph8iH5aBvrlUOBFj9n7g8GzpWkKdAoXQVn2tCabZwXx2147nXXuLCEBImbJTT/KSxY/HEF4n
euvba5utr8H1Kjnq/1t2/u/PqflbDJ8BJmC9Tme2k97FrE8hYy2bkHpnMIjd8RB6hnGdumNP5
9IEELkIsNFbDRVjhxEzcBMk7IIrK5xKKLPqCHc10CAbOT+mdajAuVNdtyO6Z4G5L+mg5bBhCs
cYQ9Qoxo7lxel4ShV3mvENx0gEYeyaSOwZG8X8ev+6/WJPp4CwZ5tcVmLtLe6eODddX5k/XUq
IoiqHyqWCuCWaNLNYaU25hnCikYgweU5P3G4TrJ4RAFxqyUY266Vi7m9iFJKc/55FCMHRPSO6
X4miR/zhMxxoqulDPxoorXlLRgX1Wb5uswg5BvG
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-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: Johannes Khoshnazar-Thoma via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Johannes Khoshnazar-Thoma <johannes AT johannesthoma DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

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?

Thanks for any insights,

Best regards,

- Johannes


-- 
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