我正在交叉编译一个触摸屏驱动程序,它带有一个 ocaml 校准应用程序。
我正在尝试为 ARM 编译驱动程序和应用程序,特别是运行 Angström 的 Beagleboard。
它是这样的:
^_^[raziel@Bebop zytouch-driver-20081121]$ source /usr/local/angstrom/arm/environment-setup
^_^[raziel@Bebop zytouch-driver-20081121]$ make CC=arm-angstrom-linux-gnueabi-gcc
arm-angstrom-linux-gnueabi-gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wstrict-prototypes -Wmissing-prototypes -c -o daemon/config.o daemon/config.c
arm-angstrom-linux-gnueabi-gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wstrict-prototypes -Wmissing-prototypes -c -o daemon/util.o daemon/util.c
arm-angstrom-linux-gnueabi-gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wstrict-prototypes -Wmissing-prototypes -c -o daemon/debug.o daemon/debug.c
arm-angstrom-linux-gnueabi-gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wstrict-prototypes -Wmissing-prototypes -c -o daemon/zytouch_usb.o daemon/zytouch_usb.c
arm-angstrom-linux-gnueabi-gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wstrict-prototypes -Wmissing-prototypes -c -o daemon/zytouchd.o daemon/zytouchd.c
arm-angstrom-linux-gnueabi-gcc daemon/config.o daemon/util.o daemon/debug.o daemon/zytouch_usb.o daemon/zytouchd.o -lX11 -lXtst -lusb -lm -o zytouch-daemon
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/version.ml -o calibrate/version.cmx
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/util.ml -o calibrate/util.cmx
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/config.ml -o calibrate/config.cmx
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/orientation.ml -o calibrate/orientation.cmx
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/tscalibrate.ml -o calibrate/tscalibrate.cmx
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -I +lablgtk2 -I +cairo -I +extlib -I calibrate extLib.cmxa str.cmxa unix.cmxa lablgtk.cmxa cairo_lablgtk.cmxa cairo.cmxa gtkInit.cmx calibrate/version.cmx calibrate/util.cmx calibrate/config.cmx calibrate/orientation.cmx calibrate/tscalibrate.cmx -o zytouch-calibrate
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: /tmp/camlstartup71ef32.o: Relocations in generic ELF (EM: 3)
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: /tmp/camlstartup71ef32.o: Relocations in generic ELF (EM: 3)
/tmp/camlstartup71ef32.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
make: *** [zytouch-calibrate] Error 2
我陷入了那个Relocations in generic ELF (EM: 3)
错误。
Makefile 看起来像这样:
(...)
OFLAGS = -cc ${CC} -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A
OCAMLOPT = ocamlopt $(OFLAGS)
OCAML_INC = -I +lablgtk2 -I +cairo -I +extlib -I calibrate
OCAML_LIBS = $(OCAML_INC) extLib.cmxa str.cmxa unix.cmxa lablgtk.cmxa cairo_lablgtk.cmxa cairo.cmxa gtkInit.cmx
(...)
config.cmx: util.cmx
orientation.cmx: config.cmx
tscalibrate.cmx: version.cmx util.cmx orientation.cmx config.cmx
%.cmx : %.ml
$(OCAMLOPT) -c $(OCAML_INC) $< -o $@
%.mli : %.ml
$(OCAMLC) -i $(OCAML_INC) $+
作为我的/usr/local/angstrom/arm/environment-setup
PATH/usr/local/angstrom/arm/bin
的第一个元素,我尝试用 ARM 版本替换一些程序
sudo ln -s /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-ar /usr/local/angstrom/arm/bin/ar
sudo ln -s /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-as /usr/local/angstrom/arm/bin/as
sudo ln -s /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-ld /usr/local/angstrom/arm/bin/ld
但是,替换后as
,模块甚至无法编译
ocamlopt -cc arm-angstrom-linux-gnueabi-gcc -cclib -lcairo -cclib -lextlib -cclib -llablgtk2 -warn-error A -c -I +lablgtk2 -I +cairo -I +extlib -I calibrate calibrate/version.ml -o calibrate/version.cmx
/tmp/camlasm41bb77.s: Assembler messages:
/tmp/camlasm41bb77.s:31: Error: alignment too large: 15 assumed
/tmp/camlasm41bb77.s:35: Error: bad instruction `movl $camlVersion__3,%eax'
/tmp/camlasm41bb77.s:36: Error: bad instruction `movl %eax,camlVersion'
/tmp/camlasm41bb77.s:37: Error: bad instruction `movl $camlVersion__2,%eax'
/tmp/camlasm41bb77.s:38: Error: bad instruction `movl %eax,camlVersion+4'
/tmp/camlasm41bb77.s:39: Error: bad instruction `movl $camlVersion__1,%eax'
/tmp/camlasm41bb77.s:40: Error: bad instruction `movl %eax,camlVersion+8'
/tmp/camlasm41bb77.s:41: Error: bad instruction `movl $1,%eax'
/tmp/camlasm41bb77.s:42: Error: bad instruction `ret'
/tmp/camlasm41bb77.s:43: Error: unrecognized symbol type ""
File "calibrate/version.ml", line 1, characters 0-1:
Error: Assembler error, input left in file /tmp/camlasm41bb77.s
make: *** [calibrate/version.cmx] Error 2
我很确定这一定是一个非常愚蠢的错误,但我找不到有关如何正确执行此操作的文档。有谁知道什么可能会失败?
我正在尝试构建的驱动程序的源代码可以在这里找到。