From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 126193858CDA for ; Thu, 29 Dec 2022 21:25:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 126193858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-x332.google.com with SMTP id m6-20020a9d7e86000000b0066ec505ae93so12131745otp.9 for ; Thu, 29 Dec 2022 13:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=9hFf2glCG5jRHomZgbC1aWepocImrLxS2/131UBgU+0=; b=NrUeX2aLJnR9cfKPei1uRGPUHloelCGLXmtmd78+Awdud5LIRNYmrY99c8FEuWQlIF 1KhP1RV9hy77fFI9HTs9wHC5Go5i9bAjaQR1DJTxpPgers6VYWGKxiOWmyhWmu2ROGzf dS3K6aBSjYzFG7wTTZfekz3y5gG6bNO+VJawczgYe7YrpL93VEhe/LsOLthGmAuB+uxQ BD6OoTqqdQfS5R2c1OKx5M39t3d9j/uDoGyr9vnZDd6jhMLCOxrW3MrgxHaC+8c+nrca +ggKkdAuVI4wAWCBhe2d4eCaNGucd/nKirFBj/pYdD9l/5qPsWU5C6yv4o6B5fa9gY7f 64dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9hFf2glCG5jRHomZgbC1aWepocImrLxS2/131UBgU+0=; b=dIsp4qCBrAMfenMu82z1FA1ZGch6wSGY610YrHtMYxKmyrdDuw+n0+f+mj1PmVvQ3+ aP5W1fRJ8fokWsD84DwllCquCjJZQ3L5Satev/krdJqOdNiHHTsyEsQQinEK78fsSqLX fnlmRulrDttxB3VbeKsINcYIi2OgA7DeEgVnh9v+FaFnTQTEg4vZyHsBPd1J2pLAvlPL wTlChBNamT5TawcNtgZJfnpkF0I7XMY3JUIVw5P8Kqylc8o1DxVbUkRVXxieXm9hhYVC Vx+IU5vyk8G8hgSEDjk6UmCt5ORqSJCqAcpPe8ei+VHSS125q78t66nrk+vEfnxRku/D bq7g== X-Gm-Message-State: AFqh2krHDgRp+/9sEScQ2Kw9YAl9M9mnn4+ubZEmWCIk2KDDfrlsGHUI FKo/L6MRppCehN4Pdlj5Tqrb4iZ960g4U8d8yCrXiBF5Ur8= X-Google-Smtp-Source: AMrXdXucX7ghSgfXtyp0PN6V/2o8x+3S83wK8mYCGHvMwS1zZQbJE9KkB+NSzzgVVlPcHNpWWPRg2wQUblsB5bPdugU= X-Received: by 2002:a05:6830:3499:b0:66c:61c8:ceeb with SMTP id c25-20020a056830349900b0066c61c8ceebmr1959836otu.12.1672349108075; Thu, 29 Dec 2022 13:25:08 -0800 (PST) MIME-Version: 1.0 From: Vincent Fortier Date: Thu, 29 Dec 2022 16:24:57 -0500 Message-ID: Subject: help cross-compiling gcc To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.6 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi all, I've been trying to cross-compile various versions of gcc using the Synology DSM6 and DSM7 toolchains and kernel for various archs (armv5-7-8, ppc, i686, x64). Over the years I've been actively working on the SynoCommunity project that provides a framework to help integrate free software and generate linux packages that can be installed on Synology NAS (ref: https://github.com/SynoCommunity/spksrc) Pertaining to gcc, my first attempt has been to try to build the same compiler as the one used on various versions of DSM6 (gcc-4.9) and DSM7 (gcc-7.5). In order to do so I use the Synology provided toolchain and prepare the associated kernel with proper platform configuration in order to provide its headers. In extra I look forward into applying crosstool-ng patches. As a relatively "simple" example, I've been working on cross-compiling for a x86_64 host/target using DSM6 with gcc-4.9.4. So far I was only able to build the gcc C compiler (beginner's luck?). Enabling any other languages fails so has trying newer versions of gcc on that particular platform. >From my reading I've associated my sysroot with the proper toolchain and added linux headers as extra includes. I believe I'm close but probably missing something obvious (which is why I'm now asking for a bit of extra help :) Build options are as follows (partially based on linux from scratch gcc 4.9.2), makefile variables naming being parsed by the framework: CONFIGURE_ARGS = --disable-bootstrap #CONFIGURE_ARGS += --enable-languages=c CONFIGURE_ARGS += --enable-languages=c,c++ #CONFIGURE_ARGS += --enable-languages=c,c++,fortran,go,objc,obj-c++ CONFIGURE_ARGS += --enable-shared CONFIGURE_ARGS += --enable-threads=posix CONFIGURE_ARGS += --enable-__cxa_atexit CONFIGURE_ARGS += --enable-clocale=gnu CONFIGURE_ARGS += --disable-plugins CONFIGURE_ARGS += --disable-multilib CONFIGURE_ARGS += --with-system-zlib CONFIGURE_ARGS += --with-build-sysroot=$(TC_SYSROOT) #CONFIGURE_ARGS += --with-sysroot=$(TC_SYSROOT) # Otherwise fails ADDITIONAL_CFLAGS += -Wno-error # kernel headers ADDITIONAL_CFLAGS += -I$(WORK_DIR)/linux-$(ARCH)-$(TCVERSION)/arch/$(ARCH)/include ADDITIONAL_CPPFLAGS += -I$(WORK_DIR)/linux-$(ARCH)-$(TCVERSION)/arch/$(ARCH)/include Considering that by default the framework provides: --host=$(TC_TARGET) --build=i686-pc-linux Guidance would be much welcomed :) - vin (@th0ma7)