public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* help cross-compiling gcc
@ 2022-12-29 21:24 Vincent Fortier
  2022-12-31 12:04 ` Kai Ruottu
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Fortier @ 2022-12-29 21:24 UTC (permalink / raw)
  To: gcc-help

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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-04  1:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-29 21:24 help cross-compiling gcc Vincent Fortier
2022-12-31 12:04 ` Kai Ruottu
2022-12-31 20:30   ` Vincent Fortier
2022-12-31 20:47     ` Tom Kacvinsky
2022-12-31 21:59     ` Kai Ruottu
2023-04-04  1:23       ` Vincent Fortier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).