delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/09/27/10:28:51

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56A94385841C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1632752930;
bh=fvKBxf8RXZraHOiY3w/gSwmtvDywhmH0vmZZ82Kb8D8=;
h=In-Reply-To:References:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=T/Ldn+EzTrJd0PkEPKMLhmNREuG6/YUeT0mnAxrCjbfUeDCcm3Nxw2o6flb9fMnDZ
kQGya0gSTwmNoyTkgboWsrS6BrJViq911W0EpmuQeabEGBrOCwr6hsqQI7ETUb4rdC
VlbJoaHWhk8Fsdw+5tr8nyOUBxWR3HZYpZO0u+jc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 653EE3858015
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to:cc;
bh=SY/NX90EtdiR8r3w31gZDDTViLlyVbX6h84L+AC414E=;
b=yVf+sWjygeXJAVA6aLFQw1hFshe4DTlcBu3s0/SFYjtmSeyFKAeJ13nCPVkfD/p5/0
G5ZRgHS869Kqky2/8TinEGh55slzCSu2bxUS4m5E/gWr1ZtHDj0H5pVr/Q+pO6YAZXAk
pnyKH1JFRYIi4kLym8VhZaZp5KM2h2BU2p2rasOYtf3lXaDKdgl8IUJHU8F2vfZ2SLR0
6QqU3PvPqrHrPaymJ0y6yWyN1uv2IlnrK4bGjai3tKaK+bSIKxqKT5EHWWi+iUfC7Ihv
UCpM9tvfwZe2bCuZGV0UZlmmePPvVIQV64ME9/YFT0CQ+5+Rmjh7R9a4oYKXmFCSITRs
iWEw==
X-Gm-Message-State: AOAM532fIUBMDQnmW8rti8DnvDNQ3ewtLs3wF3KzuxfwMEy2d8bWZTd/
LewxQcTfteyr4jzCfAlnbR/sxp/SNqK8izaPhfoTZpSAJdlFaa2t
X-Google-Smtp-Source: ABdhPJwgb2qv7odtQuHyfbfyUxwTSHjNrGP7mAV0ZmrHDfFTZvFIpBuLVSRLNT8fBJHeO7S3iO8V+jZGyOGgDoomUGQ=
X-Received: by 2002:a05:6214:493:: with SMTP id
ay19mr24457117qvb.16.1632752860974;
Mon, 27 Sep 2021 07:27:40 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <3034fa70-ad4c-3e8a-31da-d892c7deb3b7@reckeng.com>
References: <3034fa70-ad4c-3e8a-31da-d892c7deb3b7 AT reckeng DOT com>
Date: Mon, 27 Sep 2021 10:27:40 -0400
Message-ID: <CAD8GWstOqVhJeZKUvf=VfGjAaYZDNeJe3j3R58tP2K-cUNgs7Q@mail.gmail.com>
Subject: Re: Setting up toolchains
To: Anthony Webber <akwebber AT reckeng DOT com>
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
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: Lee via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Lee <ler762 AT gmail DOT com>
Cc: cygwin AT cygwin DOT com
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>

On 9/27/21, Anthony Webber wrote:
> Please excuse the naivety of this question, but I've looked elsewhere
> and can't find a good answer. Perhaps a good answer is to install MSYS2
> alongside Cygwin.

that seems to be the usual answer here :(

> Anyway, I am trying to set up my gcc toolchains in Cygwin, by which I
> mean that I'm trying to set up the environment so that the right
> programs are called at the right time by build systems like cmake and
> waf,

cmake supposedly supports cross-compilation.  I've never figured out
how to do it :(

> or if I want to build in a more manual fashion. Particularly, I
> want to be able to switch between toolchains easily.

GNU autoconf.  Switching between toolchains is as easy as

autoconf
autoheader
./configure  --host=i686-w64-mingw32


> I have installed both the x86_64-pc-cygwin-gcc/g++ and
> x86_64-w64-mingw32-gcc/g++ packages using setup-x86_64.exe.
>
> The first thing I notice is that the gcc/g++ programs in /bin are
> identical to  x86_64-pc-cygwin-gcc/g++, and that symbolic links aren't
> being used. I presume it's being done this way because this is
> considered the default, native Cygwin toolchain, and that there should
> be be relatively little to do in the way of configuration if I want to
> build Cygwin software.
>
> If I do want to cross-compile using x86_64-w64-mingw32-gcc/g++, then I
> imagine that the very least I should do is set a bunch of environment
> variables like CC and CXX (perhaps by sourcing a shell script), but
> really I'd like some advice here. What do you guys do?

I've never written anything that needed a make file; I just use the
correct compiler. eg

$ tail -3 getenv.c
}
/* i686-w64-mingw32-gcc -o getenv.exe getenv.c
 */

The only time I've had to use environment variables was for building mbedtls:

export WINDOWS_BUILD=1
#  build for a Windows platform

export SHARED=1
#  want the shared libraries created

export CC=i686-w64-mingw32-gcc
export LD=i686-w64-mingw32-gcc
export CFLAGS="-O2 -fstack-protector-strong -D_FORTIFY_SOURCE=2"
export LDFLAGS="${LDFLAGS} -fstack-protector-strong"

make lib
#  build the libraries

PATH="${PWD}/library:/usr/i686-w64-mingw32/sys-root/mingw/bin:${PATH}"
#  so the tests are able to find the mbedtls and mingw libraries

make check
#  run the test suite


Regards,
Lee

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