SH4交叉编译

时间:2019-03-21 07:37:27

标签: gcc cross-compiling

我正在尝试为SH4平台手动交叉编译lirc。我设法通过Audioniek构建系统(https://github.com/Audioniek/buildsystem)做到了这一点:

$ PATH=/home/pablocool/git/Audioniek/buildsystem/tufsbox/cross/bin:$PATH \
CC=sh4-linux-gcc CXX=sh4-linux-g++ \
LD=sh4-linux-ld NM=sh4-linux-nm AR=sh4-linux-ar \
AS=sh4-linux-as RANLIB=sh4-linux-ranlib STRIP=sh4-linux-strip \
OBJCOPY=sh4-linux-objcopy OBJDUMP=sh4-linux-objdump LN_S="ln -s" \
CFLAGS="-pipe -Os  -ffunction-sections -fdata-sections -I/home/pablocool/git/Audioniek/buildsystem/tufsbox/cdkroot/usr/include -D__KERNEL_STRICT_NAMES" \
CPPFLAGS='-pipe -Os  -ffunction-sections -fdata-sections -I/home/pablocool/git/Audioniek/buildsystem/tufsbox/cdkroot/usr/include' \
LDFLAGS='-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/pablocool/git/Audioniek/buildsystem/tufsbox/cdkroot/usr/lib -L/home/pablocool/git/Audioniek/buildsystem/tufsbox/cdkroot/usr/lib -L/home/pablocool/git/Audioniek/buildsystem/tufsbox/cdkroot/lib -Wl,--gc-sections' \
./configure --build=x86_64-pc-linux-gnu --host=sh4-linux -q ac_cv_path_LIBUSB_CONFIG='' \
--build=x86_64-pc-linux-gnu --host=sh4-linux --prefix=/usr --sbindir=/usr/bin --mandir=/.remove \
--with-kerneldir=/home/pablocool/git/Audioniek/buildsystem/build_tmp/linux-sh4-2.6.32.71_stm24_0217 \
--without-x --with-devdir=/dev --with-moduledir=/lib/modules --with-major=61 --with-driver=userspace --enable-debug --with-syslog=LOG_DAEMON --enable-sandboxed


$ PATH=/home/pablocool/git/Audioniek/buildsystem/tufsbox/cross/bin:$PATH \
make

但是我想通过以下方式使它与STM软件包devkit一起使用:

$ PATH=/opt/STM/STLinux-2.4/devkit/sh4/bin:$PATH \
CC=sh4-linux-gcc CXX=sh4-linux-g++ \
LD=sh4-linux-ld NM=sh4-linux-nm AR=sh4-linux-ar \
AS=sh4-linux-as RANLIB=sh4-linux-ranlib STRIP=sh4-linux-strip \
OBJCOPY=sh4-linux-objcopy OBJDUMP=sh4-linux-objdump LN_S="ln -s" \
CFLAGS="-pipe -Os  -ffunction-sections -fdata-sections -I/opt/STM/STLinux-2.4/devkit/sh4/target/usr/include -D__KERNEL_STRICT_NAMES" \
CPPFLAGS='-pipe -Os  -ffunction-sections -fdata-sections -I/opt/STM/STLinux-2.4/devkit/sh4/target/usr/include' \
LDFLAGS='-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -L/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -L/opt/STM/STLinux-2.4/devkit/sh4/target/lib -Wl,--gc-sections' \
./configure --build=x86_64-pc-linux-gnu --host=sh4-linux -q ac_cv_path_LIBUSB_CONFIG='' \
--build=x86_64-pc-linux-gnu --host=sh4-linux --prefix=/usr --sbindir=/usr/bin --mandir=/.remove \
--with-kerneldir=/home/pablocool/git/Audioniek/buildsystem/build_tmp/linux-sh4-2.6.32.71_stm24_0217 \
--without-x --with-devdir=/dev --with-moduledir=/lib/modules --with-major=61 --with-driver=userspace --enable-debug --with-syslog=LOG_DAEMON --enable-sandboxed


$ PATH=/opt/STM/STLinux-2.4/devkit/sh4/bin:$PATH \
make

但是生成的Makefile在某种程度上不同于Audioniek的devkit方式。区别在于启用了HAVE_ALSA_SB_RC且make命令失败:

/bin/sh ../libtool --tag=CC   --mode=link sh4-linux-gcc  -pipe -Os  -ffunction-sections -fdata-sections -I/opt/STM/STLinux-2.4/devkit/sh4/target/usr/include -D__KERNEL_STRICT_NAMES  -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -L/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -L/opt/STM/STLinux-2.4/devkit/sh4/target/lib -Wl,--gc-sections -o irrecord irrecord.o config_file.o dump_config.o input_map.o transmit.o libhw_module.a -lasound           -lpthread
libtool: link: sh4-linux-gcc -pipe -Os -ffunction-sections -fdata-sections -I/opt/STM/STLinux-2.4/devkit/sh4/target/usr/include -D__KERNEL_STRICT_NAMES -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -Wl,--gc-sections -o irrecord irrecord.o config_file.o dump_config.o input_map.o transmit.o  -L/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib -L/opt/STM/STLinux-2.4/devkit/sh4/target/lib libhw_module.a /usr/lib/libasound.so -lm -ldl -lrt -lpthread
/usr/lib/libasound.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:513: irrecord] Błąd 1
make[3]: Opuszczenie katalogu '/home/pablocool/Archive/lirc/lirc-0.9.0/daemons'
make[2]: *** [Makefile:375: all] Błąd 2
make[2]: Opuszczenie katalogu '/home/pablocool/Archive/lirc/lirc-0.9.0/daemons'
make[1]: *** [Makefile:333: all-recursive] Błąd 1
make[1]: Opuszczenie katalogu '/home/pablocool/Archive/lirc/lirc-0.9.0'
make: *** [Makefile:262: all] Błąd 2

我无法弄清楚为什么libtool在主机文件系统中而不是/opt/STM/STLinux-2.4/devkit/sh4/target/usr/lib/libasound.so中寻找/usr/lib/libasound.so

我希望有人可以提供帮助

0 个答案:

没有答案