Skip to content

Commit

Permalink
attempt to compile libstdc++ and glibc
Browse files Browse the repository at this point in the history
libstdc++ currently fails with

../.././libgcc/config/i386/cpuinfo.c: In function ‘get_available_features’:
../.././libgcc/config/i386/cpuinfo.c:388:14: error: ‘bit_AVX512VP2INTERSECT’ undeclared (first use in this function); did you mean ‘FEATURE_AVX512VP2INTERSECT’?
    if (edx & bit_AVX512VP2INTERSECT)
              ^~~~~~~~~~~~~~~~~~~~~~
              FEATURE_AVX512VP2INTERSECT
../.././libgcc/config/i386/cpuinfo.c:388:14: note: each undeclared identifier is reported only once for each function it appears in
../.././libgcc/config/i386/cpuinfo.c:392:14: error: ‘bit_AVX512BF16’ undeclared (first use in this function); did you mean ‘bit_AVX512F’?
    if (eax & bit_AVX512BF16)
  • Loading branch information
publicarray committed Feb 26, 2021
1 parent 0892875 commit 5038ab9
Show file tree
Hide file tree
Showing 10 changed files with 1,980 additions and 63 deletions.
31 changes: 31 additions & 0 deletions cross/glibc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PKG_NAME = glibc
PKG_VERS = 2.28
PKG_EXT = tar.xz
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)-build
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://ftpmirror.gnu.org/$(PKG_NAME)

DEPENDS =

#REQUIRE_KERNEL = 1

HOMEPAGE = https://www.gnu.org/software/libc/started.html
COMMENT = The GNU C Library (glibc)
LICENSE = GPLv3

CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)
CONFIGURE_ARGS += --disable-sanity-checks
# CONFIGURE_ARGS += --with-headers=$(KERNAL_ROOT)

CONFIGURE_TARGET = glibc_config
INSTALL_TARGET = glibc_install

include ../../mk/spksrc.cross-cc.mk

.PHONY: glibc_config glibc_build glibc_install
glibc_config:
mkdir -p $(WORK_DIR)/$(PKG_NAME)-$(PKG_VERS)-build
@$(RUN) $(WORK_DIR)/$(PKG_NAME)-$(PKG_VERS)/configure $(CONFIGURE_ARGS)

glibc_install:
@$(RUN) $(MAKE) install DESTDIR=$(INSTALL_DIR)
3 changes: 3 additions & 0 deletions cross/glibc/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
glibc-2.28.tar.xz SHA1 ccb5dc9e51a9884df8488f86982439d47b283b2a
glibc-2.28.tar.xz SHA256 b1900051afad76f7a4f73e71413df4826dce085ef8ddb785a945b66d7d513082
glibc-2.28.tar.xz MD5 c81d2388896379997bc359d4f2084239
90 changes: 90 additions & 0 deletions cross/libstdc++/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
PKG_NAME = libstdc++
PARENT_PKG_NAME = gcc

This comment has been minimized.

Copy link
@publicarray

publicarray Feb 26, 2021

Author Owner

@hgy59 @th0ma7 I've tried to compile libstdc++ for .NET applications, but I think my approach is wrong and/or finding compatible versions for the libraries and host compiler is harder that it should be... If you guys have time I'd like to get some feedback. Maybe before I start hitting my head against a wall.

This comment has been minimized.

Copy link
@th0ma7

th0ma7 Feb 26, 2021

That is not an easy one... personally I would first attempt at using the toolkit functionality and adjust the various flags to include the necessary path. Have a look at my long overdue but rather complex [WIP] fuse3 at https://github.com/SynoCommunity/spksrc/pull/4335/files
Also, many post-compile tests will fail and you may require something similar to ENV += ac_cv_func_realloc_0_nonnull=yes or the equivalent undel CMAKE -D options.
You're up for the long run...

This comment has been minimized.

Copy link
@publicarray

publicarray Feb 27, 2021

Author Owner

Thanks, I'll look into it. The trouble is that the libraries/gcc in the toolkit are too old to compile a modern gcc. (I want to get modern libs so that .NET can't complain anymore) I think it's easier to use the native compiler. But I'll see how it goes.

This comment has been minimized.

Copy link
@th0ma7

th0ma7 Feb 27, 2021

I went that route not long ago and hit that same issue.
I did some trial and errors at building a newer C compiler but this is a heavy process that makes it even more complex in a cross-compiled environment. You sort of have to stage 1) compile a newer C, then at stage 2) using that new C version rebuild the same version in order this time to get C and C++ then at stage 3 build the full suite of that same version. The cross-compiling part got me sideways... I may reinvest time in that once the syno*kernel stuff is over.

This comment has been minimized.

Copy link
@th0ma7

th0ma7 Feb 28, 2021

I revisited this file a bit... a may have a "start" of a proof of concept.
I was finally able to build a target gcc-4.9.4
In theory, with that, we could create a host/target gcc-4.9.4, and from there start building newer GCC based on minimal requirements. Long shot but feasible.

You'll see a [WIP] PR for the target type gcc shortly.

PKG_VERS = 10.2.0
PKG_EXT = tar.xz
PKG_DIR = $(PARENT_PKG_NAME)-$(PKG_VERS)
PKG_DIST_NAME = $(PARENT_PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://ftpmirror.gnu.org/$(PARENT_PKG_NAME)/$(PARENT_PKG_NAME)-$(PKG_VERS)

BUILD_DEPENDS = cross/gmp cross/mpfr cross/mpc

HOMEPAGE = https://gcc.gnu.org/
COMMENT = This package contains an additional runtime library for C++ programs built with the GNU compiler.
LICENSE = GPLv3


include ../../mk/spksrc.archs.mk
ifeq ($(findstring $(ARCH),$(ARMv5_ARCHS) $(ARMv7_ARCHS) $(ARMv7L_ARCHS) $(ARMv8_ARCHS)),$(ARCH))
BUILD_TARGET = arm-unknown-linux-gnueabi
endif
ifeq ($(findstring $(ARCH),$(i686_ARCHS)),$(ARCH))
BUILD_TARGET = i686-linux-gnu
endif
ifeq ($(findstring $(ARCH),$(x64_ARCHS)),$(ARCH))
BUILD_TARGET = x86_64-pc-linux-gnu
endif
ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH))
BUILD_TARGET = powerpc-linux-gnu
endif

include ../../mk/spksrc.cross-cc.mk

GNU_CONFIGURE = 1
ADDITIONAL_CXXFLAGS += -std=c++11 -march=x86-64

CONFIGURE_ARGS += --target=$(BUILD_TARGET)
# CONFIGURE_ARGS += --build=$(BUILD_TARGET)
CONFIGURE_ARGS += --host=x86_64-pc-linux-gnu
CONFIGURE_ARGS += --with-gmp $(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --with-mpfr $(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --with-mpc $(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)
#CONFIGURE_ARGS += --enable-shared=libstdc++
CONFIGURE_ARGS += --enable-languages=c++
CONFIGURE_ARGS += --disable-nls
CONFIGURE_ARGS += --disable-multilib
# CONFIGURE_ARGS += --with-system-zlib
CONFIGURE_ARGS += --without-headers
# CONFIGURE_ARGS += --with-sysroot=/
# CONFIGURE_ARGS += --with-sysroot=$(TOOLKIT_ROOT)/$(BUILD_TARGET)/$(BUILD_TARGET)/sys-root
# CONFIGURE_ARGS += --with-native-system-header-dir=$(TOOLKIT_ROOT)/$(BUILD_TARGET)/$(BUILD_TARGET)/sys-root/usr/include
# CONFIGURE_ARGS += --with-native-system-header-dir=/usr/include/

COMPILE_TARGET = gcc_build
INSTALL_TARGET = gcc_install

## force newer system bintools
CONFIGURE_ARGS += --with-ld=/usr/bin/ld
CONFIGURE_ARGS += --with-as=/usr/bin/as
## force newer system compiler from host systemm since the gcc from the toolchain is too old,
## we can still cross compile by setting the target touple.
# env -u LDSHARED -u MAKEFLAGS -u PKG_CONFIG -u PKG_CONFIG_LIBDIR -u PKG_CONFIG_PATH
ENV += LD=
ENV += CPP=
ENV += NM=
ENV += CC=
ENV += RANLIB=
ENV += CXX=
ENV += AR=
ENV += STRIP=
ENV += OBJDUM=
ENV += READELF=
ENV += AS=
ENV += OBJDUMP=
ENV += CFLAGS="-I$(STAGING_INSTALL_PREFIX)/include -I/usr/include/ -march=x86-64"
ENV += CPPFLAGS="-I$(STAGING_INSTALL_PREFIX)/include -I/usr/include/"
ENV += CXXFLAGS="-I$(STAGING_INSTALL_PREFIX)/include -I/usr/include/ -std=c++11 -march=x86-64"
ENV += LDFLAGS=" -L$(STAGING_INSTALL_PREFIX)/lib -L/usr/lib -Wl,--rpath-link,$(STAGING_INSTALL_PREFIX)/lib -Wl,--rpath,/usr/local/libstdc++/lib "
#ENV += LD_LIBRARY_PATH=-L$(STAGING_INSTALL_PREFIX)/lib
.PHONY: gcc_build gcc_install
gcc_build:
# quick hack to "fix missing commands for the "
ln -s /usr/bin/gcc /usr/bin/x86_64-pc-linux-gnu-gcc
ln -s /usr/bin/cc /usr/bin/x86_64-pc-linux-gnu-cc
ln -s /usr/bin/ar /usr/bin/x86_64-pc-linux-gnu-ar
@$(RUN) $(MAKE) all-target-libstdc++-v3
rm /usr/bin/x86_64-pc-linux-gnu-gcc
rm /usr/bin/x86_64-pc-linux-gnu-cc
rm /usr/bin/x86_64-pc-linux-gnu-ar
gcc_install:
@$(RUN) $(MAKE) install-target-libstdc++-v3 DESTDIR=$(INSTALL_DIR)
3 changes: 3 additions & 0 deletions cross/libstdc++/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcc-10.2.0.tar.xz SHA1 8de0aecd3a52bb92b43082df8a9256356d1f03be
gcc-10.2.0.tar.xz SHA256 b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c
gcc-10.2.0.tar.xz MD5 e9fd9b1789155ad09bcf3ae747596b50
7 changes: 4 additions & 3 deletions cross/mpc/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = mpc
PKG_VERS = 1.1.0
PKG_VERS = 1.2.1
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://ftp.gnu.org/gnu/mpc
Expand All @@ -13,7 +13,8 @@ LICENSE = LGPLv3

GNU_CONFIGURE = 1

CONFIGURE_ARGS = --with-gmp=$(STAGING_INSTALL_PREFIX)
include ../../mk/spksrc.cross-cc.mk

CONFIGURE_ARGS += --with-gmp=$(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --with-mpfr=$(STAGING_INSTALL_PREFIX)

include ../../mk/spksrc.cross-cc.mk
6 changes: 3 additions & 3 deletions cross/mpc/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mpc-1.1.0.tar.gz SHA1 b019d9e1d27ec5fb99497159d43a3164995de2d0
mpc-1.1.0.tar.gz SHA256 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e
mpc-1.1.0.tar.gz MD5 4125404e41e482ec68282a2e687f6c73
mpc-1.2.1.tar.gz SHA1 2a4919abf445c6eda4e120cd669b8733ce337227
mpc-1.2.1.tar.gz SHA256 17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459
mpc-1.2.1.tar.gz MD5 9f16c976c25bb0f76b50be749cd7a3a8
16 changes: 9 additions & 7 deletions cross/mpfr/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = mpfr
PKG_VERS = 4.0.2
PKG_VERS = 4.1.0
PKG_EXT = tar.xz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://ftp.gnu.org/gnu/$(PKG_NAME)
Expand All @@ -11,23 +11,25 @@ HOMEPAGE = https://www.mpfr.org/
COMMENT = C library for multiple-precision floating-point computations with correct rounding.
LICENSE = GNU Lesser GPL

# Cumulative patches from https://www.mpfr.org/mpfr-4.0.2/allpatches
# for version 4.0.2-p1
# Cumulative patches from https://www.mpfr.org/mpfr-4.1.0/allpatches
# for version 4.1.0-p9

GNU_CONFIGURE = 1

CONFIGURE_ARGS = --with-gmp=$(STAGING_INSTALL_PREFIX)
include ../../mk/spksrc.cross-cc.mk

CONFIGURE_ARGS += --with-gmp=$(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)

COMPILE_TARGET = mpfr_compile
INSTALL_TARGET = mpfr_install

include ../../mk/spksrc.cross-cc.mk

# Do not build test nor doc
.PHONY: mpfr_compile
.PHONY: mpfr_compile mpfr_install
mpfr_compile:
@$(RUN) $(MAKE) SUBDIRS=src

.PHONY: mpfr_install
mpfr_install:
$(RUN) $(MAKE) SUBDIRS=src DESTDIR=$(INSTALL_DIR) install prefix=$(INSTALL_PREFIX)
@$(RUN) $(MAKE) SUBDIRS=src install DESTDIR=$(INSTALL_DIR)
6 changes: 3 additions & 3 deletions cross/mpfr/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mpfr-4.0.2.tar.xz SHA1 52c1f2a4c9a202f46cf3275a8d46b562aa584208
mpfr-4.0.2.tar.xz SHA256 1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a
mpfr-4.0.2.tar.xz MD5 320fbc4463d4c8cb1e566929d8adc4f8
mpfr-4.1.0.tar.xz SHA1 159c3a58705662bfde4dc93f2617f3660855ead6
mpfr-4.1.0.tar.xz SHA256 0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f
mpfr-4.1.0.tar.xz MD5 bdd3d5efba9c17da8d83a35ec552baef
47 changes: 0 additions & 47 deletions cross/mpfr/patches/001-allpatches-20190602.patch

This file was deleted.

Loading

0 comments on commit 5038ab9

Please sign in to comment.