Compile against root file system | ||
---|---|---|
Prev | Created by Bayou. | Index |
I once had to compile Etnaviv for a device I was porting. I used Debian Stretch
(later migrated to Buster) with the mainstream Linux 4.19 kernel.
I used the libdrm-armada and xf86-video-armada, but will focus to libdrm-armada in this article.
PACKAGE_DIR=libdrm-armada
ROOTFS_DIR=/path/to/rootfs
OUTPUT_DIR=/path/to/some/dir/bin
CROSS_COMPILE=~/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
$ autoreconf -f -i -I${ROOTFS_DIR}/usr/share/aclocal ${PACKAGE_DIR}
$ cd ${ROOTFS_DIR}
./configure --prefix=${OUTPUT_DIR} --host=$(basename ${CROSS_COMPILE:-=})
$ make
$ make install
Add --sysroot=/path/to/rootfs to LDFLAGS
$ ./configure --prefix=${OUTPUT_DIR} --host=$(basename ${CROSS_COMPILE:-=}) \
LDFLAGS=--sysroot=${ROOTFS_DIR}
That's because the pkg-config from the host is used instead of the root file system.
$ ./configure --prefix=${OUTPUT_DIR} --host=$(basename ${CROSS_COMPILE:-=}) \
LDFLAGS=--sysroot=${ROOTFS_DIR} KG_CONFIG_PATH="${ROOTFS_DIR}/usr/lib/arm-linux-gnueabihf/pkgconfig/"
Include paths are missing at CFLAGS.
$ find ${ROOTFS_DIR} -name Xprotostr.h
${ROOTFS_DIR}/usr/include/X11/Xprotostr.h
$ ./configure --prefix=${OUTPUT_DIR} --host=$(basename ${CROSS_COMPILE:-=}) \
LDFLAGS=--sysroot=${ROOTFS_DIR} KG_CONFIG_PATH="${ROOTFS_DIR}/usr/lib/arm-linux-gnueabihf/pkgconfig/" \
CFLAGS=-I$(OUTPUT_DIR)/include
Prev | Home | Next |
Index | Up | Index |