[英]make command gives Incompatible i386 architecture(i386x86-64)
Im having trouble using my make file for a program i am writing in a linux environment. 我在Linux环境中编写的程序使用make文件遇到麻烦。 The program is a fern fractal that uses bitmapImage.h and bitmapImage.so given to me by my professor.
该程序是蕨类的分形,使用我的教授给我的bitmapImage.h和bitmapImage.so。 Whenever i attempt to run the make file i get a long string of errors, the main one being :
每当我尝试运行make文件时,都会出现一长串错误,主要错误是:
make
g++ -c -o fern.o fern.cpp
g++ -c -o fernType.o fernType.cpp
g++ -m32 -o fern fern.o fernType.o bitmapImage.so
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status
make: *** [spiro] Error 1
my guess is that the bitmapImage.so is designed for a 32 bit system, but my virtual machine ubuntu runs 64-bit. 我的猜测是bitmapImage.so是为32位系统设计的,但是我的虚拟机ubuntu运行64位。 How do i go about fixing this so i can compile my program?
我该如何解决这个问题,以便我可以编译程序? Thanks!
谢谢!
EDIT: updated my old post to show the current error i am getting 编辑:更新了我的旧帖子,以显示我得到的当前错误
MakeFile: 生成文件:
# Make file for spirograph program
## note, uses bitmapImage shared object file (library).
OBJS = fern.o fernType.o
CC = g++ -m32
DEPS1 = fernType.h
DEPS2 = bitmapImage.h
all: spiro
spiro: $(OBJS)
$(CC) -m32 -o fern $(OBJS) bitmapImage.so
spiro.o: fern.cpp $(DEPS1)
$(CC) -m32 -c fern.cpp
spiroType.o: fernType.cpp $(DEPS1) $(DEPS2)
$(CC) -m32 -c fernType.cpp
# -----
# clean by removing object files.
clean:
rm $(OBJS)
Add the -m32
option to your compilation lines, that forces everything to be compiled for a 32-bit address space. 将
-m32
选项添加到编译行中,这将强制为32位地址空间编译所有内容。 (It will still run on a 64-bit system.) (它仍将在64位系统上运行。)
Yes, that's exactly the problem -- you can't link a 32-bit object file with a 64-bit object file. 是的,这就是问题所在-您无法将32位目标文件与64位目标文件链接在一起。 You need to either:
您需要:
file
to see if, indeed, the shared lib is 32-bit. file
查看共享库是否确实是32位的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.