Select a 32 bit linker

Hey folks,

I'm a newbie in the context of programming with a console. My operating system is Snow Leopard.
To compile some systemC files I need the following Makefile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# defines all header and sources files
SRCS := main.cpp

# defines the traget file
TARGET := run

# variable for the systemc path
SYSTEMC := /Library/SystemC/systemc-2.2.0
TARGET_ARCH := macosx


INCDIR := -I. -I.. -I$(SYSTEMC)/include
LIBDIR := -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_ARCH)
LIBS   := -lsystemc -lm

CC     := g++
CFLAGS := -g -Wno-deprecated -Wall
OBJS   := $(SRCS:.cpp=.o)

EXE    := $(TARGET)

all: $(EXE)

$(EXE): $(OBJS)
	$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS)



-include $(OBJS:.o=.d)
    
%.o: %.cpp
	$(CC) $(DEBUG) $(CFLAGS) $(INCDIR) -c $*.cpp -o $*.o
	$(CC) -MM $(DEBUG) $(CFLAGS) $(INCDIR) $*.cpp > $*.d
	@mv -f $*.d $*.d.tmp
	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
	  sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
	@rm -f $*.d.tmp
	
wave: $(EXE)
	./run 

clean:
	rm -f $(OBJS) $(OBJS:.o=.d) *~ $(EXE) *.bak $(TARGET).stackdump wave.vcd



My problem is that the linker is a 64 bit linker and the library supports 32 bit.
So I get following message:
g++ -g -Wno-deprecated -Wall -I. -I.. -I/Library/SystemC/systemc-2.2.0/include -L. -L.. -L/Library/SystemC/systemc-2.2.0/lib-macosx -o run main.o -lsystemc -lm
ld: warning: in /Library/SystemC/systemc-2.2.0/lib-macosx/libsystemc.a, missing required architecture x86_64 in file
Undefined symbols:
  "sc_core::sc_signal bla bla bla


Has somebody a hint how I can select another linker?

Greetings from Europe,
Seth Cohen
I'm not a Mac guy but I see in the error that this linker supports x86 and x64, are you sure you're not just missing a switch?
Hey Computergeek01,

thanks for your suggestion. I found following information:
-arch arch_name
Specifies which architecture (e.g. ppc, ppc64, i386, x86_64) the output file should be.



So i typed:
$(CC) -arch i386 $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS)

The new output is:
#g++ -g -Wno-deprecated -Wall -I. -I.. -I/Library/SystemC/systemc-2.2.0/include -L. -L.. -L/Library/SystemC/systemc-2.2.0/lib-macosx -o run main.o -lsystemc -lm
g++ -arch i386 -g -Wno-deprecated -Wall -I. -I.. -I/Library/SystemC/systemc-2.2.0/include -L. -L.. -L/Library/SystemC/systemc-2.2.0/lib-macosx -o run main.o -lsystemc -lm
ld: warning: in main.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_sc_main", referenced from:
      _sc_elab_and_sim in libsystemc.a(sc_main_main.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [run] Error 1



Sorry for my newbie questions...
seth
Topic archived. No new replies allowed.