[clug] 32/64 bit compile

Brad Hards bradh at frogmouth.net
Sat Feb 16 03:08:10 GMT 2008


On Saturday 16 February 2008 12:09:40 pm Brian wrote:
> Hi all,
> I am compiling a prog on a 64bit AMD, currently runs on a 32bit machine.
>
> I change to the programs source dir and run
>  make -C /usr/src/linux SUBDIRS=$PWD modules
>  and it compiles/loads fine.
I'm a bit worried by the -C argument. If this is really a kernel thing, 
everything I've said below is bogus.

> When I go to run it it says,
>
> Error in startup script: couldn't load file "/opt/apogee/lib/libccd.so":
> /opt/apogee/lib/libccd.so: wrong ELF class: ELFCLASS64
>     while executing
> "load $libs/libccd.so"
>
>
>
> Naturally the libccd.so is there.
> Searching the web most pointers for the  ELFCLASS64 problem say
> recompile as 32bit.
>
> Is that my best option, if so how do I change the above make to force a
> compile in 32bit?
Typically you need to change some CFLAGS or CXXFLAGS. I think you possibly 
want -m32. From the gcc man page:
       -m32
       -m64
           Generate code for a 32-bit or 64-bit environment.  The 32-bit 
environment sets int, long and pointer to 32 bits and generates code that 
runs on any i386 system.  The 64-bit environment sets int to 32 bits and long 
and pointer to 64 bits and generates code for AMD’s x86-64 architecture.

Alternatively, perhaps you need to set the linker path differently.

In any case, this is actually a bug in the configure script - it should deal 
with this.

> It is compiled on a SUSE 10.3, 2.6.22.17-0.1-default and uses MODPOST.
Sorry, don't know MODPOST.

Brad


More information about the linux mailing list