G
G
Grigory Dikiy2016-10-12 22:39:22
C++ / C#
Grigory Dikiy, 2016-10-12 22:39:22

File was built for archive which is not the architecture being linked (x86_64)?

Good day! I'm trying to set up Soil for a poppy axis. There is the following cmake file:

# SOIL makefile for linux (based on the AngelScript makefile)
# Type 'make' then 'make install' to complete the installation of the library

# For 'make install' to work, set LOCAL according to your system configuration
LOCAL = /opt/local

LIB = libSOIL.a
INC = SOIL.h

SRCDIR = ../../src
LIBDIR = ../../lib
INCDIR = ../../src
OBJDIR = obj

CXX = gcc
CXXFLAGS = -arch x86_64 -Xarch_x86_64 -O2 -s -Wall
DELETER = rm -f
COPIER = cp

SRCNAMES = \
  image_helper.c \
  stb_image_aug.c  \
  image_DXT.c \
  SOIL.c \

OBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRCNAMES:.c=.o)))
BIN = $(LIBDIR)/$(LIB)

all: $(BIN)

$(BIN): $(OBJ)
  ar r $(BIN) $(OBJ)
  ranlib $(BIN)
  @echo -------------------------------------------------------------------
  @echo Done. As root, type 'make install' to install the library.

$(OBJDIR)/%.o: $(SRCDIR)/%.c
  $(CXX) $(CXXFLAGS) -o [email protected] -c $<


clean:
  $(DELETER) $(OBJ) $(BIN)

install: $(BIN)
  @echo Installing to: $(LOCAL)/lib and $(LOCAL)/include...
  @echo -------------------------------------------------------------------
  $(COPIER) $(BIN) $(LOCAL)/lib
  $(COPIER) $(INCDIR)/$(INC) $(LOCAL)/include
  @echo -------------------------------------------------------------------
  @echo SOIL library installed. Enjoy!

uninstall:
  $(DELETER) $(LOCAL)/include/$(INC) $(LOCAL)/lib/$(LIB)
  @echo -------------------------------------------------------------------
  @echo SOIL library uninstalled.

.PHONY: all clean install uninstall

By executing the make install instructions I get the desired library, but when I connect to the project and try to compile I get an error:
ld: warning: ignoring file /opt/local/lib/libSOIL.a, file was built for archive which is not the architecture being linked (x86_64 ): /opt/local/lib/libSOIL.a
It seems that when creating the library, I set the flags: CXXFLAGS = -arch x86_64 -Xarch_x86_64 -O2 -s -Wall
What could be the reason?
P.S El Capital System

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Moseychuk, 2016-10-12
@frilix

These are c++ compiler flags. And your code is in C.
Try this.
In general, architecture and bit depth are different concepts.
CFLAGS=-arch generic -m64 -O2 -s -Wall

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question