From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fgw20-4.mail.saunalahti.fi (fgw20-4.mail.saunalahti.fi [62.142.5.107]) by sourceware.org (Postfix) with ESMTPS id ECC8E3858D1E for ; Tue, 14 Feb 2023 13:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECC8E3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=wippies.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=wippies.com Received: from [10.0.0.90] (mobile-access-2e8429-181.dhcp.inet.fi [46.132.41.181]) by fgw20.mail.saunalahti.fi (Halon) with ESMTPSA id 911793d6-ac6c-11ed-bd9b-005056bd6ce9; Tue, 14 Feb 2023 15:36:22 +0200 (EET) Content-Type: multipart/alternative; boundary="------------1fcAOls30J6U3mbn0bGrdYqv" Message-ID: <832e9264-d900-0954-8708-aa61db8a023e@wippies.com> Date: Tue, 14 Feb 2023 15:36:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: Cross Compiling for riscv64 To: Sagar Acharya , Gcc Help References: From: Kai Ruottu In-Reply-To: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,BODY_8BITS,HTML_MESSAGE,KAM_DMARC_STATUS,KAM_NUMSUBJECT,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------1fcAOls30J6U3mbn0bGrdYqv Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sagar Acharya via Gcc-help kirjoitti 14.2.2023 klo 13.37: > I built binutils and added variables > AR , etc. for configuring > > Configured with > ./configure --target=riscv64-unknown-elf > make As told on the GCC page configuring in the main GCC source directory is not recommended (https://gcc.gnu.org/install/configure.html) : ------------------ clip ---------------------------------- We use srcdir to refer to the toplevel source directory for GCC; we use objdir to refer to the toplevel build/object directory. ....... First, we *highly* recommend that GCC be built into a separate directory from the sources which does *not* reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported. ------------------ clip ---------------------------------- > I already have a preinstalled package aarch64-linux-musl-gcc . Kindly help. Where this package could be downloaded?  The "Void Linux" pages don't include any GCC package for native/cross aarch64. Only the runtime libraries in their ROOTFS/PLATFORMFS packages : [root@AthlonXP2 aarch64-void-linux-musl]# ls bin   dev  home  lib32  media  opt   root  sbin  tmp  var boot  etc  lib   lib64  mnt    proc  run   sys   usr [root@AthlonXP2 aarch64-void-linux-musl]# cd usr [root@AthlonXP2 usr]# ls include f2fs_fs.h  gawkapi.h  iproute2  quota.h [root@AthlonXP2 usr]# ls lib depmod.d                         libnftnl.so.11.6.0 dhcpcd                           libnl-3.so.200 dracut                           libnl-3.so.200.26.0 e2initrd_helper                  libnl-cli-3.so.200 engines-1.1                      libnl-cli-3.so.200.26.0 gawk                             libnl-genl-3.so.200 ld-musl-aarch64.so.1             libnl-genl-3.so.200.26.0 libacl.so.1                      libnl-idiag-3.so.200 libacl.so.1.1.2301               libnl-idiag-3.so.200.26.0 libarchive.so.13                 libnl-nf-3.so.200 libarchive.so.13.6.1             libnl-nf-3.so.200.26.0 libattr.so.1                     libnl-route-3.so.200 libattr.so.1.1.2501              libnl-route-3.so.200.26.0 libblkid.so.1                    libnl-xfrm-3.so.200 libblkid.so.1.1.0                libnl-xfrm-3.so.200.26.0 libbz2.so.1                      libpamc.so.0 libbz2.so.1.0                    libpamc.so.0.82.1 libbz2.so.1.0.8                  libpam_misc.so.0 libcap-ng.so.0                   libpam_misc.so.0.82.1 libcap-ng.so.0.0.0               libpam.so.0 libcap.so.2                      libpam.so.0.85.1 libcap.so.2.54                   libpanelw.so.6 libcom_err.so.2                  libpanelw.so.6.3 libcom_err.so.2.1                libpcap.so.1 libcrypto.so.1.1                 libpcap.so.1.10.1 libc.so ............... There should be some but clicking their download links results to nothing :( I found some other package for a 'i686-linux-gnu' hosted "statically built" cross GCC for 'aarch64-linux-musl' target which had both development headers and libraries and that enabled me to build own cross-GCC to 'aarch64-linux-musl' target. And then to build 'aarch64-linux-musl'-hosted stuff like this GCC, configured with : ../configure --build=i686-linux-gnu --host=aarch64-linux-musl --target=riscv64-elf --prefix=/opt/cross --libdir=/opt/cross/lib --libexecdir=/opt/cross/lib --enable-languages=c,c++ --disable-shared --disable-threads --disable-nls --disable-multilib --disable-libgcj --disable-libffi --enable-languages=c,c++ --with-newlib --with-gxx-include-dir=/opt/cross/include/c++/11.3 --enable-version-specific-runtime-libs --program-prefix=riscv64-elf- --program-suffix=-11 BUT this ISN'T for the same host as the "Void Linux for aarch64 with musl"!  How good the binary compatability is between different distros I have no clue.  Producing the same 'riscv64-elf' targeted GCC with the gcc-12.2.0 sources (and with 'newlib') just now succeeded when writing this... One advice from me would be to consider using a "factory" instead of "garage" for producing this kind of stuff. My old 2,8 MHz AthlonXP PC may sound "old and slow" but in my 70 years age its speed is enough for me. --------------1fcAOls30J6U3mbn0bGrdYqv--