All pre-built binaries, headers, and libraries are under cross compiler sysroot in chroot environment.
Sysroot is the default search path of a compiler, so you do not need to provide -I or -L to CFLAGS or LDFLAGS.
If gcc cannot find header or library from the given path, it will then search sysroot/usr/{lib,include}.
Sysroot located in ~/toolkit/build_env/ds.<platform>-<version>/usr/local/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/.
$ lxc start synobuild-focal
$ lxc exec synobuild-focal --force-interactive --user 1000 -- /bin/bash
$ cd ~/toolkit/source/
$ wget -qO- https://nano-editor.org/dist/v8/nano-8.3.tar.gz | gunzip | tar xvf -
$ schroot --chroot=armada38x
$ export LANG=en_US.UTF-8
$ cd nano-8.3/
$ ./configure --with-platform-specific-flags WITH_PLATFORM_SPECIFIC=VARIABLES
$ make
$ make DESTDIR=/home/ubuntu/toolkit/build/armada38x/rootfs/nano-8.3/ install
$ exit [To detach the console, press: <ctrl>+a q]
$ lxc file pull synobuild-focal/home/ubuntu/toolkit/build/armada38x/rootfs/nano-8.3/ build/armada38x/rootfs/ --recursive
$ lxc stop synobuild-focalMost of variable values can be found in /toolkit/build_env/ds.${platform}-${version}/{env.mak,env32/64.mak}.
- CC: path of gcc cross compiler.
- CXX: path of g++ cross compiler.
- LD: path of cross compiler linker.
- CFLAGS: global cflags includes.
- AR: path of cross compiler ar.
- NM: path of cross compiler nm.
- STRIP: path of cross compiler strip.
- RANLIB: path of cross compiler ranlib.
- OBJDUMP: path of cross compiler objdump.
- LDFLAGS: global ldflags includes.
- ConfigOpt: options for configure.
- ARCH: processor architecture.
- SYNO_PLATFORM: Synology platform.
- DSM_SHLIB_MAJOR: major number of DSM (integer).
- DSM_SHLIB_MINOR: minor number of DSM (integer).
- DSM_SHLIB_NUM: build number of DSM (integer).
- ToolChainSysRoot: cross compiler sysroot path.
- SysRootPrefix: cross compiler sysroot concat with prefix /usr.
- SysRootInclude: cross compiler sysroot concat with include_dir /usr/include.
- SysRootLib: cross compiler sysroot concat with lib_dir /usr/lib.
Synology toolkit environment has included selected prebuild projects. You can enter the chroot and use following commands to check if needed header or project is provided by toolkit.
(armada38x)ubuntu@synobuild-focal:~$ dpkg -l # List all dpkg projects.
(armada38x)ubuntu@synobuild-focal:~$ dpkg -L {project dev} # List project install files, e.g `dpkg -L synousb-armada38x-dev`
(armada38x)ubuntu@synobuild-focal:~$ dpkg -S {header/library pattern} # Search header/library pattern, e.g. `dpkg -S libexif`Some open source projects require to use other projects' cross compiled product while building their own. For example, python needs libffi and zlib during configuration stage. We need to provide those two project before building python. You can install the cross compiled product into the destination you want in build script. Please refer to Compile Open Source Project: nmap for more information.
More information can be found here.
file /path/binary.so
readelf -h /path/binary.so
readelf -A /path/binary.so
readelf -a /path/binary.so | grep Shared
readelf -a /path/binary.so | grep interpreter