Skip to content
Advertisement

CPU you selected doesn’t support x86-64 instruction set

I want to compile a program which has lots of 32-bit static libraries which I cannot recompile to 64-bit because the lack of makefiles but there are some libraries that I should compile to obtain some static libraries to use alongside them.

One of the libraries that I want to compile has a Makefile as follows :

CC = c++

BIN_DIR = ../lib

BIN = $(BIN_DIR)/libsql.a

CFLAGS = -w -O3 -ggdb3 -g3 -std=c++14 -pipe -mtune=i386 -fstack-protector -static

CPP=AsyncSQL.cpp Semaphore.cpp Statement.cpp Tellwait.cpp

all: $(BIN)

clean:
    @echo Delete .obj files
    @rm -f *.o

%.o: %.cpp
    @echo -e "33[0;32m [OK] 33[0m" $<
    @$(CXX) $(CFLAGS) -c $^ -o $@

$(BIN): $(CPP:%.cpp=%.o)
    @ar cru $(BIN) $^
    @ranlib $(BIN)
    @rm -rf *.o

Which results in the following output :

 cc1plus: error: CPU you selected does not support x86-64 instruction set

If I omit the option -mtune=i386 it would compile successfully but then I should compile the rest of the libraries as 64-bit binaries and at the end I won’t be able to link against those static 32-bit ones.

How can I eliminate that error?

Any suggestion would be appreciated.

Advertisement

Answer

To compile 32-bit code on a 64-bit system, use the option -m32 to gcc. -mtune=i386 is not correct.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement