views:

60

answers:

2

When I try to compile a copy of my project on my local machine, I get an error stating that it 's skipping over incompatible libraries. This isn't the case when I'm messing around with the live version hosted on the server at work [it makes perfectly there].

Various other sites have lead me to believe that this might be an environment issue, as I'm developing on a 64-bit distro of Ubuntu and I assume the server version is running on 32-bit. Nevertheless, after setting my environment variables to:

CFLAGS+=" -m32"
CXXFLAGS+=" -m32"

I still receive the same compile error of:

/usr/bin/ld: skipping incompatible /dvlpmnt/libPI-Http.a when searching for -lPI-Http

Can haz tutorial?

==Edit==

This was the output I recieved when I followed Jonathan's advice:

http.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

Apparently, the library in question is 32-bit after all?

A: 

Normally, that is not an error per se; it is a warning that the first file it found that matches the -lPI-Http argument to the compiler/linker is not valid. The error occurs when no other library can be found with the right content.

So, you need to look to see whether /dvlpmnt/libPI-Http.a is a library of 32-bit object files or of 64-bit object files - it will likely be 64-bit if you are compiling with the -m32 option. Then you need to establish whether there is an alternative libPI-Http.a or libPI-Http.so file somewhere else that is 32-bit. If so, ensure that the directory that contains it is listed in a -L/some/where argument to the linker. If not, then you will need to obtain or build a 32-bit version of the library from somewhere.

To establish what is in that library, you may need to do:

mkdir junk
cd junk
ar x /dvlpmnt/libPI-Http.a
file *.o
cd ..
rm -fr junk

The 'file' step tells you what type of object files are in the archive. The rest just makes sure you don't make a mess that can't be easily cleaned up.

Jonathan Leffler
Huh, that's weird, this step is now showing me that all the Libraries in question are, in fact, 32-bit. o__o
kelly.dunn
@defaultstring: What is the actual linking command line? Does it include the `-m32` flag? Add that as extra information in the question, rather than as an extra comment here, please.
Jonathan Leffler
A: 

That message isn't actually an error - it's just a warning that the file in question isn't of the right architecture (e.g. 32-bit vs 64-bit, wrong CPU architecture). The linker will keep looking for a library of the right type.

Of course, if you're also getting an error along the lines of can't find lPI-Http then you have a problem :-)

It's hard to suggest what the exact remedy will be without knowing the details of your build system and makefiles, but here are a couple of shots in the dark:

  1. Just to check: usually you would add flags to CFLAGS rather than CTAGS - are you sure this is correct? (What you have may be correct - this will depend on your build system!)
  2. Often the flag needs to be passed to the linker too - so you may also need to modify LDFLAGS

If that doesn't help - can you post the full error output, plus the actual command (e.g. gcc foo.c -m32 -Dxxx etc) that was being executed?

psmears
I'm sorry, you're right. I used CFLAGS instead of CTAGS :P
kelly.dunn