Hi,

Below is the makeFile i tried executing on SuSe linux and getting many undefined reference errors. Anybody can shed light on this.

SHELL = /bin/sh


CFLAGS = -O -DSVR4

CC = /usr/bin/cc

SO_LIBS = channel.so

all: $(SO_LIBS)


channel.so:      channel_limit.o chglobals.o chinit_windup.o chprocess.o files_n_pipes.o list.o tree.o
        ld channel_limiting.o chglobals.o \
                        chinit_windup.o chprocess.o files_n_pipes.o \
                        list.o tree.o \
                        -o $(@)

channel_limiting.o:     tree.h list.h channel_limiting.h
chglobals.o:    channel_limiting.h
chinit_windup.o:        channel_limiting.h
chprocess.o:    channel_limiting.h
list.o: list.h
tree.o: tree.h
files_n_pipes.o:        files_n_pipes.h



clean:
        rm -f *.o *.so

]
------------------------------------------------------------------------------------
Error message: 

ld: warning: i386 architecture of input file `chglobals.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `chinit_windup.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `chprocess.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `files_n_pipes.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `list.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `tree.o' is incompatible with i386:x86-64 output
ld: warning: cannot find entry symbol _start; defaulting to 00000000004000f0
channel_limiting.o: In function `_dynamn':
channel_limiting.c:(.text+0x4ec): undefined reference to `memcpy'
channel_limiting.c:(.text+0x535): undefined reference to `puts'
channel_limiting.c:(.text+0x6ed): undefined reference to `printf'
chinit_windup.o: In function `__AIR_showVectorTreeStats':
chinit_windup.c:(.text+0x19): undefined reference to `printf'
chinit_windup.c:(.text+0x3d): undefined reference to `printf'

Recommended Answers

All 4 Replies

Looks like you mixing i386 and x86_64 code according to you error message "ld: warning: i386 architecture of input file `chglobals.o' is incompatible with i386:x86-64 output"

Here's a simple makefile to create a shared object and use a shared object...Hope it helps

test: getsetx.so test.o
  gcc test.o -o test -ldl

test.c: test.o
  gcc -c test.c

getsetx.os: getsetx.o
  ld -shared -o getsetx.so getsetx.o

getsetx.o: getsetx.c
  gcc -fPIC -c getsetx.c

Hi,

I'm running the code on 64 bit machine.
i can force compile the C program using the gcc -o -m32.

But do you know how to create a shared object using the ld (linker)so that it creates a 32 bit shared object?

I'm running the ld on a 64 bit Intel Xeon running on SuSE linux.

Thanks!

Hi,

I'm running the code on 64 bit machine.
i can force compile the C program using the gcc -o -m32.

But do you know how to create a shared object using the ld (linker)so that it creates a 32 bit shared object?

I'm running the ld on a 64 bit Intel Xeon running on SuSE linux.

Thanks!

Just curious, why are you trying to create a 32 bit program for a 64 bit machine?

Because the application the object is intended for can only understand 32 bit code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.