Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
#459: use glibc instead of uClibc
Browse files Browse the repository at this point in the history
in universal installer builds for Linux
  • Loading branch information
hugbug committed Oct 26, 2017
1 parent 18fbd12 commit 54f14f5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
46 changes: 31 additions & 15 deletions linux/build-info.txt
Expand Up @@ -31,14 +31,14 @@ Building toolchains
setup - for extra files required for installer;

4. Build buildroot-toolchain for one CPU-architecture (see below);
4.1. Download Buildroot distribution archive from http://buildroot.uclibc.org/download.html
(currently using version "buildroot-2015.08.01");
4.2. Unpack the tarball into 'toolchain'-directory;
4.3. Rename the buildroot-directory according to the target CPU-architecture name;
Be careful here, after the toolchain is built the directory cannot be renamed
or moved, you will have to rebuild the toolchain if you want another name;
4.4. Run 'make nconfig';
4.5. Configure toolchain:
4.1. Download Buildroot distribution archive from http://buildroot.uclibc.org/download.html
(currently using version "buildroot-2015.08.01");
4.2. Unpack the tarball into 'toolchain'-directory;
4.3. Rename the buildroot-directory according to the target CPU-architecture name;
Be careful here, after the toolchain is built the directory cannot be renamed
or moved, you will have to rebuild the toolchain if you want another name;
4.4. Run 'make menuconfig';
4.5. Configure toolchain:
- Target architecture:
- choose your target architecture;
- Build options:
Expand All @@ -47,7 +47,8 @@ Building toolchains
- Kernel Headers (Manually specified Linux version);
- (2.6.32) linux version;
- Custom kernel headers series (2.6.x);
- uClibc C library Version (uClibc-ng);
- C library: glibc (for *86, arm*) or uClibc (for mips*, ppc*);
- uClibc library version (uClibc-ng);
- Enable large file (files > 2 GB) support;
- Enable IPv6 support;
- Enable toolchain locale/i18n support;
Expand All @@ -61,15 +62,30 @@ Building toolchains
- JSON/XML: libxml2;
- Text and terminal handling: ncurses;
- Save configuration and exit;
4.6. Do few extra manual adjustments:
- in the file '.config' in the buildroot directory activate define to
build 'ubacktrace';
4.6. Do few extra manual adjustments:
- in 'packages/ncurses/ncurses.mk' add extra configure parameters to
option 'NCURSES_CONF_OPTS‘ (without quotation marks):
option 'NCURSES_CONF_OPTS‘ (with quotation marks):
"--with-fallbacks=xterm xterm-color xterm-256color xterm-16color linux vt100 vt200";
- in 'packages/openssl/openssl.mk' replace 'zlib-dynamic' with 'zlib';
4.7. Run 'make' to build the toolchain. It may take an hour or so depending
on your hardware;
- in 'packages/glibc/glibc.mk' add extra configure parameter
'--enable-static-nss';
4.7. Run 'make' to build the toolchain. It may take an hour or less depending
on your hardware;
4.8. If C library "glibc" was chosen extra steps are needed to build proper
static libraries of OpenSSL in addition to already built dynamic
libraries (which are also required):
- delete directory 'output/build/openssl-x.x.x';
- in 'packages/openssl/openssl.mk' replace
'$(if $(BR2_STATIC_LIBS),no-shared,shared)' with
'$(if $(BR2_STATIC_LIBS),no-shared,no-shared)'
and replace '$(if $(BR2_STATIC_LIBS),no-dso,dso)' with
'$(if $(BR2_STATIC_LIBS),no-dso,no-dso)';
- from root directory of toolchain run 'make' again;
- openssl will be rebuilt without shared libraries support;
- installation step of openssl fails with message:
"chmod: cannot access ‘../lib/engines/lib*.so’: No such file or directory";
- ignore the error, static libraries of openssl are already installed
and will be used by NZBGet;

5. Now you should have a working toolchain for one CPU-architecture, let's
test it.
Expand Down
21 changes: 10 additions & 11 deletions linux/build-nzbget
Expand Up @@ -247,15 +247,9 @@ ConstructArchParams()
mipseb)
ARCH=mips
;;
armhf)
ARCH=arm
;;
arm*)
ARCH=arm
;;
ppc500)
ARCH=powerpc
;;
ppc*)
ARCH=powerpc
;;
Expand All @@ -264,7 +258,7 @@ ConstructArchParams()
TOOLCHAIN_ROOT=$ROOT/toolchain/$TARGET$PLATSUFF
TOOLPATH=$TOOLCHAIN_ROOT/output/host/usr/bin
PATH=$TOOLPATH:$ROOTPATH
STAGING="$TOOLCHAIN_ROOT/output/staging/usr"
STAGING="$TOOLCHAIN_ROOT/output/staging"
case $PLATFORM in
linux)
TOOLKIND=buildroot
Expand All @@ -290,11 +284,16 @@ ConfigureTarget()
DEBUG="-g"
fi

LUBACKTRACE=""
if [ -f "$STAGING/lib/libubacktrace.so.1" ] ; then
LUBACKTRACE="-lubacktrace"
fi

case "$TOOLKIND-$CONFIG" in
buildroot-debug|buildroot-debug-strip)
LDFLAGS="-static $STRIP" \
CXXFLAGS="-std=c++14 -g -fasynchronous-unwind-tables" \
LIBS="-lcrypto -ldl -lz -lubacktrace" \
LIBS="-lcrypto -ldl -lz $LUBACKTRACE" \
./configure --disable-dependency-tracking --host=$ARCH-$TOOLNAME --enable-debug
;;
buildroot-release|buildroot-release-nostrip)
Expand All @@ -307,14 +306,14 @@ ConfigureTarget()
CXX="$CROSSCLANG" \
LDFLAGS="-static $STRIP -fuse-ld=lld --target=$ARCH-$TOOLNAME -lc++ -lm --sysroot=$SYSROOT" \
CXXFLAGS="-g --target=$ARCH-$TOOLNAME --sysroot=$SYSROOT -I$SYSROOT/usr/include/c++/v1" \
PKG_CONFIG_LIBDIR="$STAGING/lib/pkgconfig" \
PKG_CONFIG_LIBDIR="$STAGING/usr/lib/pkgconfig" \
./configure --disable-dependency-tracking --host=$ARCH-$TOOLNAME --enable-debug
;;
crossclang-release|crossclang-release-nostrip)
CXX="$CROSSCLANG" \
LDFLAGS="-static $STRIP -fuse-ld=lld --target=$ARCH-$TOOLNAME -lc++ -lm --sysroot=$SYSROOT" \
CXXFLAGS="-O2 $DEBUG --target=$ARCH-$TOOLNAME --sysroot=$SYSROOT -I$SYSROOT/usr/include/c++/v1" \
PKG_CONFIG_LIBDIR="$STAGING/lib/pkgconfig" \
PKG_CONFIG_LIBDIR="$STAGING/usr/lib/pkgconfig" \
./configure --disable-dependency-tracking --host=$ARCH-$TOOLNAME --enable-debug
;;
esac
Expand All @@ -330,7 +329,7 @@ PrecompileHeaders()
fi

$ARCH-$TOOLNAME-g++ -std=c++14 -DHAVE_CONFIG_H \
-I. -I$STAGING/include -I$STAGING/include/libxml2 \
-I. -I$STAGING/usr/include -I$STAGING/usr/include/libxml2 \
-g $OPTIM daemon/main/nzbget.h -o nzbget.h.gch
fi
}
Expand Down
3 changes: 2 additions & 1 deletion linux/build-unpack
Expand Up @@ -121,7 +121,7 @@ for TARGET in $TARGETS; do
fi

case $TARGET in
mipsel|i?86|x86_64)
mipsel|i?86|x86_64|aarch64)
ARCH=$TARGET
ENDIAN=little
;;
Expand Down Expand Up @@ -201,6 +201,7 @@ for TARGET in $TARGETS; do
STRIP=$TOOLPATH/$ARCH-$TOOLNAME-strip \
CXXFLAGS=-O2 \
LDFLAGS=-static \
LIBS=-lpthread \
make -j $COREX $BUILDTARGET
fi

Expand Down

0 comments on commit 54f14f5

Please sign in to comment.