Re: Makefile for external calls on Solaris 9 (64-bit) [message #38773] |
Tue, 30 March 2004 09:25  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Just a guess, but it still doesn't seem like you are linking correctly. I
get the same error (except the 32/64 are swapped) when I try to load a 64bit
dlm in the 32bit version of IDL which is what I would expect. So it seems
that your DLM is still 32-bit?
I don't know, and unfortunately I can't point you to a tool that could tell
you more, but I can suggest using gcc to link instead of ld. I'm compiling
64bit DLMs and I *think* they would work in the 64bit version of IDL and
that is the only real difference that I can see between your makefile and
mine.
CC=gcc
X_CFLAGS=-fPIC -m64 -mcpu=v9
X_LD_FLAGS=-shared -m64
LD=gcc
LD_LIBS=
-Rick
----- Original Message -----
From: "Brandon Whitcher"
Newsgroups: comp.lang.idl-pvwave
Sent: Tuesday, March 30, 2004 1:09 AM
Subject: Re: Makefile for external calls on Solaris 9 (64-bit)
> Michael Wallace wrote...
>> What kind of errors do you see when you try to compile your code on
>> Solaris? Knowing what to do is a little more complicated than including
>> C_FLAGS, LD_FLAGS, etc. Can you provide an example of the makefile
>> you're using?
>>
>> -Mike
>
> Here is example output...
>
> % make
> gcc -O2 -Wall -fPIC -m64 -I/usr/local/idl_6.0/external -c
> simpleExample.c
> gcc -O2 -Wall -fPIC -m64 -I/usr/local/idl_6.0/external -c IDL_Load.c
> IDL_Load.c: In function `IDL_Load':
> IDL_Load.c:14: warning: missing braces around initializer
> IDL_Load.c:14: warning: (near initialization for
> `procedure_addr[0].funct_addr')
> IDL_Load.c:18: warning: missing braces around initializer
> IDL_Load.c:18: warning: (near initialization for
> `function_addr[0].funct_addr')
> ld -64 -G -o simpleExample.so\
> simpleExample.o IDL_Load.o
> ld: fatal: file /usr/ucblib/libucb.so: wrong ELF class: ELFCLASS32
> ld: fatal: file /usr/lib/libresolv.so: wrong ELF class: ELFCLASS32
> ld: fatal: file /usr/lib/libsocket.so: wrong ELF class: ELFCLASS32
> ld: fatal: file /usr/lib/libnsl.so: wrong ELF class: ELFCLASS32
> ld: fatal: file /usr/lib/libelf.so: wrong ELF class: ELFCLASS32
> ld: fatal: File processing errors. No output written to
> simpleExample.so
> *** Error code 1 (ignored)
>
> ... I've added additional libraries like /usr/ucblib/sparcv9 and
> /usr/lib/sparcv9, which gets rid of the linking problems but the code
> fails in IDL...
>
> % SIMPLEFUNCTION: Error loading sharable executable.
> Symbol: IDL_Load, File = simpleExample.so
> ld.so.1:
> /usr/local/idl_6.0/bin/bin.solaris2.sparc64/idl:
> fatal: /usr/ucblib/libucb.so.1: wrong ELF class:
> ELFCLASS32
>
> Example makefile...
>
> IDL_DIR = /usr/local/idl_6.0
> CC = gcc
> CFLAGS =
> C_FLAGS = -O2 -Wall -fPIC -m64 -I$(IDL_DIR)/external -c $(CFLAGS)
> LD = ld
> SHELL = /bin/sh
> X_CFLAGS =
> X_LD_FLAGS = -64 -G
> LD_LIBS = -L /usr/ucblib/sparcv9 -L /usr/lib/sparcv9
> SO_EXT = so
>
>
> .c.o :
> $(CC) $(C_FLAGS) $(X_CFLAGS) $*.c
>
> simpleExample : simpleExample.$(SO_EXT)
> @date
>
> simpleExample.$(SO_EXT) : simpleExample.o IDL_Load.o
> -$(LD) $(X_LD_FLAGS) $(LD_LIBS) -o simpleExample.$(SO_EXT)\
> simpleExample.o IDL_Load.o
>
> clean :
> rm -f *.o *.so so_locations
>
>
> cheers...
> Brandon
|
|
|