简体   繁体   English

make命令给出了不兼容的i386架构(i386x86-64)

[英]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: 您需要:

  • Compile on a 32-bit machine (real or virtual), 在32位计算机(真实或虚拟)上编译,
  • Ask your professor for a 64-bit library, or 向您的教授索要64位库,或者
  • Ask for the source code to the library so you can compile it all yourself 向库索取源代码,以便您自己进行编译
  1. Use file to see if, indeed, the shared lib is 32-bit. 使用file查看共享库是否确实是32位的。
  2. If it is, you'll have to acquire a 64-bit copy of it somehow. 如果是这样,则必须以某种方式获取它的64位副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GDB 错误:所选架构 i386 与报告的目标架构 i386:x86-64 不兼容 - GDB error: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 如何在os x上制作Boost dylibs通用(i386和x86_64)? - How to make Boost dylibs universal (i386 & x86_64) on os x? 机器类型(C ++ librairies):i386 vs x86_64 - machine type (C++ librairies) : i386 vs x86_64 架构 i386 的未定义符号: - Undefined symbols for architecture i386: OSX:找不到体系结构i386的符号 - OSX : Symbols not found for architecture i386 是什么决定了在64位机器上构建的32位库是否需要x86_64或i386依赖? - What determines if a 32-bit library built on a 64-bit machine needs x86_64 or i386 dependencies? 为i386编译x264 - Compiling x264 for i386 尽管编译了通用库和i386版本的库,但未为体系结构i386找到符号 - Symbol(s) not found for architecture i386 despite compiling universal and i386 versions of library iOS:找不到架构i386的sin()符号 - iOS: sin() Symbols not found for architecture i386 在构建用于多种架构(x86_64,armv7,armv7s,arm64,i386)的C ++共享库时面临的问题 - Facing issues in building a C++ shared library for multiple architectures (x86_64, armv7, armv7s, arm64, i386)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM