linux - 使用 UBUNTU 和 arm-linux-gnueabi-gcc 为 ARM linux 交叉编译 JamVM - 缺少 zlib

标签 linux arm cross-compiling jamvm

我正在尝试为 FriendlyARM mini 2440 构建 JamVM !(http://www.friendlyarm.net/products/mini2440)

我使用这个命令安装了 ARM GCC:

sudo apt-get install gcc-arm-linux-gnueabi

接下来我做了:

export CROSS_COMPILE=arm-none-linux-gnueabi-
./configure --host=arm-linux-gnueabi
make

我收到这些错误:

  configure: WARNING: If you wanted to set the --build type, don't use --host.
        If a cross compiler is detected then cross compile mode will be used.
    checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnueabi
checking for style of include used by make... GNU
checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabi-gcc accepts -g... yes
checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed
checking dependency style of arm-linux-gnueabi-gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by arm-linux-gnueabi-gcc... /usr/arm-linux-gnueabi/bin/ld
checking if the linker (/usr/arm-linux-gnueabi/bin/ld) is GNU ld... yes
checking for /usr/arm-linux-gnueabi/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/arm-linux-gnueabi-nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking how to run the C preprocessor... arm-linux-gnueabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for arm-linux-gnueabi-g++... arm-linux-gnueabi-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-gnueabi-g++ accepts -g... yes
checking dependency style of arm-linux-gnueabi-g++... gcc3
checking how to run the C++ preprocessor... arm-linux-gnueabi-g++ -E
checking for arm-linux-gnueabi-g77... no
checking for arm-linux-gnueabi-xlf... no
checking for arm-linux-gnueabi-f77... no
checking for arm-linux-gnueabi-frt... no
checking for arm-linux-gnueabi-pgf77... no
checking for arm-linux-gnueabi-cf77... no
checking for arm-linux-gnueabi-fort77... no
checking for arm-linux-gnueabi-fl32... no
checking for arm-linux-gnueabi-af77... no
checking for arm-linux-gnueabi-xlf90... no
checking for arm-linux-gnueabi-f90... no
checking for arm-linux-gnueabi-pgf90... no
checking for arm-linux-gnueabi-pghpf... no
checking for arm-linux-gnueabi-epcf90... no
checking for arm-linux-gnueabi-gfortran... no
checking for arm-linux-gnueabi-g95... no
checking for arm-linux-gnueabi-xlf95... no
checking for arm-linux-gnueabi-f95... no
checking for arm-linux-gnueabi-fort... no
checking for arm-linux-gnueabi-ifort... no
checking for arm-linux-gnueabi-ifc... no
checking for arm-linux-gnueabi-efc... no
checking for arm-linux-gnueabi-pgf95... no
checking for arm-linux-gnueabi-lf95... no
checking for arm-linux-gnueabi-ftn... no
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/arm-linux-gnueabi-nm -B output from arm-linux-gnueabi-gcc object... ok
checking for objdir... .libs
checking for arm-linux-gnueabi-ar... arm-linux-gnueabi-ar
checking for arm-linux-gnueabi-ranlib... arm-linux-gnueabi-ranlib
checking for arm-linux-gnueabi-strip... (cached) arm-linux-gnueabi-strip
checking if arm-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-gnueabi-gcc option to produce PIC... -fPIC
checking if arm-linux-gnueabi-gcc PIC flag -fPIC works... yes
checking if arm-linux-gnueabi-gcc static flag -static works... yes
checking if arm-linux-gnueabi-gcc supports -c -o file.o... yes
checking whether the arm-linux-gnueabi-gcc linker (/usr/arm-linux-gnueabi/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by arm-linux-gnueabi-g++... /usr/arm-linux-gnueabi/bin/ld
checking if the linker (/usr/arm-linux-gnueabi/bin/ld) is GNU ld... yes
checking whether the arm-linux-gnueabi-g++ linker (/usr/arm-linux-gnueabi/bin/ld) supports shared libraries... yes
checking for arm-linux-gnueabi-g++ option to produce PIC... -fPIC
checking if arm-linux-gnueabi-g++ PIC flag -fPIC works... yes
checking if arm-linux-gnueabi-g++ static flag -static works... yes
checking if arm-linux-gnueabi-g++ supports -c -o file.o... yes
checking whether the arm-linux-gnueabi-g++ linker (/usr/arm-linux-gnueabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for arm-linux-gnueabi-gcc... (cached) arm-linux-gnueabi-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether arm-linux-gnueabi-gcc accepts -g... (cached) yes
checking for arm-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
checking dependency style of arm-linux-gnueabi-gcc... (cached) gcc3
checking dependency style of arm-linux-gnueabi-gcc... gcc3
checking for ecj... ecj
checking for pthread_self in -lthr... no
checking for pthread_self in -lpthread... yes
checking for fmod in -lm... yes
checking for dlopen in -ldl... yes
checking for inflate in -lz... no
configure: error: zlib is missing

更新:

如果我使用这些命令:

export CROSS_COMPILE=arm-none-linux-gnueabi-
./configure --host=arm-linux
make

我在 make 之后得到这个错误:

Making all in src
make[1]: Entering directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src'
make  all-recursive
make[2]: Entering directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src'
Making all in os
make[3]: Entering directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os'
Making all in linux
make[4]: Entering directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os/linux'
Making all in arm
make[5]: Entering directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os/linux/arm'
/bin/bash ../../../../libtool   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../../src  -I../../../../src  -I../../../../src -g -O2 -MT callNative.lo -MD -MP -MF .deps/callNative.Tpo -c -o callNative.lo callNative.S
 gcc -DHAVE_CONFIG_H -I. -I../../../../src -I../../../../src -I../../../../src -g -O2 -MT callNative.lo -MD -MP -MF .deps/callNative.Tpo -c callNative.S  -fPIC -DPIC -o .libs/callNative.o
callNativeOABI.S: Assembler messages:
callNativeOABI.S:28: Error: too many memory references for `mov'
callNativeOABI.S:29: Error: no such instruction: `stmfd sp!,{r4,r5,ip,lr}'
callNativeOABI.S:30: Error: too many memory references for `mov'
callNativeOABI.S:31: Error: too many memory references for `mov'
callNativeOABI.S:32: Error: no such instruction: `ldr ip,[r4]@get ostack pntr'
callNativeOABI.S:33: Error: no such instruction: `ldr r2,[r4,'
callNativeOABI.S:34: Error: expecting operand after ','; got nothing
callNativeOABI.S:35: Error: no such instruction: `ldreq r1,[ip],'
callNativeOABI.S:36: Error: no such instruction: `addne r2,r2,'
callNativeOABI.S:37: Error: too many memory references for `sub'
callNativeOABI.S:38: Error: no such instruction: `ble do_call@yes,skip stack push'
callNativeOABI.S:39: Error: too many memory references for `add'
callNativeOABI.S:41: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:42: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:43: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:45: Error: no such instruction: `ldr r3,[lr,r2,lsl'
callNativeOABI.S:46: Error: invalid char '[' beginning operand 2 `[sp'
callNativeOABI.S:47: Error: too many memory references for `sub'
callNativeOABI.S:48: Error: no such instruction: `bne loop'
callNativeOABI.S:51: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:52: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:53: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:55: Error: no such instruction: `ldr r2,[ip]'
callNativeOABI.S:56: Error: no such instruction: `ldr r3,[ip,'
callNativeOABI.S:58: Error: too many memory references for `mov'
callNativeOABI.S:59: Error: no such instruction: `ldr pc,[r4,'
callNativeOABI.S:61: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:62: Error: no such instruction: `ldr r2,[r4]'
callNativeOABI.S:64: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:65: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:66: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:68: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:69: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:70: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:75: Error: expecting operand after ','; got nothing
callNativeOABI.S:77: Error: no such instruction: `strge r0,[r2],'
callNativeOABI.S:78: Error: too many memory references for `mov'
callNativeOABI.S:80: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:81: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:83: Error: no such instruction: `addle pc,pc,r5,lsl'
callNativeOABI.S:85: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:86: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:88: Error: no such instruction: `ldmdb r4,{r4,r5,sp,pc}'
callNativeOABI.S:90: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:91: Error: no such instruction: `ldmdb r4,{r4,r5,sp,pc}'
callNativeOABI.S:95: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:96: Error: no such instruction: `stfd f0,[r0],'
callNativeOABI.S:97: Error: no such instruction: `ldmdb r4,{r4,r5,sp,pc}'
callNativeOABI.S:99: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:100: Error: no such instruction: `stfs f0,[r0],'
callNativeOABI.S:101: Error: no such instruction: `ldmdb r4,{r4,r5,sp,pc}'
callNativeOABI.S:104: Error: junk at end of line, first unrecognized character is `@'
callNativeOABI.S:105: Error: invalid char '[' beginning operand 2 `[r0]'
callNativeOABI.S:106: Error: no such instruction: `ldmdb r4,{r4,r5,sp,pc}'
make[5]: *** [callNative.lo] Error 1
make[5]: Leaving directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os/linux/arm'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os/linux'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src/os'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/ehsun7b/Downloads/jamvm-1.5.4/src'
make: *** [all-recursive] Error 1

最佳答案

借助 necroposting 的力量,我让 JamVM 出现并在 ARM Linux 上运行。

我的先决条件:

  • JamVM 2.0
  • GNU 类路径 0.99
  • 为目标系统构建 root 编译的二进制文件(特别是 libz.so 和相应的 include);

GNU 类路径:

ANTLR_URL=http://www.antlr2.org/download/antlr-2.7.5.jar
ANTLR_JAR=antlr-2.7.5.jar
wget -c ${ANTLR_URL} --directory-prefix=/tmp

export PATH=$PATH:/usr/local/arm-2008q3/bin
export CROSS_COMPILE=arm-none-linux-gnueabi-
export ARCH=arm
export CC=${CROSS_COMPILE}gcc
export LD=${CROSS_COMPILE}ld
export PREFIX=/usr/classpath

./configure --host=arm-linux --without-x --disable-gtk-peer \
  --disable-gconf-peer --with-antlr-jar=/tmp/${ANTLR_JAR} \
  --prefix=${PREFIX}

make -j 4

sudo mkdir -p ${PREFIX}
sudo chown -R ${USER} ${PREFIX}

make install

JamVM:

sudo apt-get install libtool zip

export PATH=$PATH:/usr/local/arm-2008q3/bin
export CROSS_COMPILE=arm-none-linux-gnueabi-
export ARCH=arm
export CC=${CROSS_COMPILE}gcc
export LD=${CROSS_COMPILE}ld

export TARGET_INCLUDE=/buildroot/output/host/usr/include
export TARGET_LIB=/buildroot/output/target/usr/lib
export CPPFLAGS=-I${TARGET_INCLUDE}
export LDFLAGS=-L${TARGET_LIB}

export PREFIX=/usr/jamvm
export CP_PREFIX=/usr/classpath

export CONFIGURE_ARGS="--host=arm-linux \
  --with-classpath-install-dir=${CP_PREFIX} --prefix=${PREFIX}" 

./autogen.sh ${CONFIGURE_ARGS}

make

# Install JamVM to the same paths both on host and target, 
# because I didn't find a configure arguments to distinguish such,
# and JamVM requires an installed GNU Classpath in order to build.

sudo mkdir -p ${PREFIX}
sudo chown -R ${USER} ${PREFIX}

make install

关于您的问题:第一个错误是 -L 路径上的目标平台缺少 libz.so,第二个是错误的平台选择(可能是正确的编译器,但错误的选择了 C 源)。

关于linux - 使用 UBUNTU 和 arm-linux-gnueabi-gcc 为 ARM linux 交叉编译 JamVM - 缺少 zlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12969656/

相关文章:

客户端在 2-3 次成功连接后停止与服务器的连接。 c 中的套接字编程

c - ARM二进制的对齐问题

java - Raspberry Pi 上 Java 3D 中的段错误

linux - 使用 scp 上传到附加/安装的 EBS 卷?

linux - mmap 标志 MAP_UNINITIALIZED 未定义

arm - arm : fatal error: byteswap. h 的 busybox 编译:没有那个文件或目录

c++ - 为什么在交叉编译时 CMAKE_FIND_ROOT_PATH 和 CMAKE_INCLUDE_PATH 不覆盖我的根文件系统?

c++ - 交叉编译c++以解决树莓派std错误

Linux:使用文件描述符查找闪存流

assembly - ARM 汇编中的程序计数器