Syntactic Fructose
Syntactic Fructose

Reputation: 20084

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. The program is a fern fractal that uses bitmapImage.h and bitmapImage.so given to me by my professor. Whenever i attempt to run the make file i get a long string of errors, the main one being :

    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. 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)

Upvotes: 2

Views: 1880

Answers (3)

Keith Randall
Keith Randall

Reputation: 23265

Add the -m32 option to your compilation lines, that forces everything to be compiled for a 32-bit address space. (It will still run on a 64-bit system.)

Upvotes: 5

bmargulies
bmargulies

Reputation: 100051

  1. Use file to see if, indeed, the shared lib is 32-bit.
  2. If it is, you'll have to acquire a 64-bit copy of it somehow.

Upvotes: 0

Adam Rosenfield
Adam Rosenfield

Reputation: 400324

Yes, that's exactly the problem -- you can't link a 32-bit object file with a 64-bit object file. You need to either:

  • Compile on a 32-bit machine (real or virtual),
  • Ask your professor for a 64-bit library, or
  • Ask for the source code to the library so you can compile it all yourself

Upvotes: 0

Related Questions