comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Makefile for external calls on Solaris 9 (64-bit)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38773] Tue, 30 March 2004 09:25 Go to next message
Rick Towler is currently offline  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
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38781 is a reply to message #38773] Tue, 30 March 2004 01:16 Go to previous messageGo to next message
bjwhitcher is currently offline  bjwhitcher
Messages: 4
Registered: March 2004
Junior Member
"Rick Towler" <rtowler@u.washington.edu> wrote in message news:<c49mq5$sec$1@nntp6.u.washington.edu>...
> "Brandon Whitcher" wrote...
>
>> I am relatively new to IDL and have produced some code that calls
>> external C routines according to Ronn Kling's book (1st edition). I
>> had it working under RedHat linux, but have recently acquired a
>> Sunblade workstation and am having trouble compiling the code. I must
>> admit, my knowledge of libraries, makefiles and compiling C code is
>> limited.
>
> What C compiler?
>
>
> Sun or GCC?

gcc

> Do Ronn's examples compile on your Sunblade?

I haven't tried them because I need the appropriate
flags/libraries/etc... for 64-bit compilation.

I could try them in 32-bit mode and then run 32-bit IDL... wait.
No, they don't compile on my Sunblade.

Brandon
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38782 is a reply to message #38781] Tue, 30 March 2004 01:09 Go to previous messageGo to next message
bjwhitcher is currently offline  bjwhitcher
Messages: 4
Registered: March 2004
Junior Member
Michael Wallace <mwallace.removethis@swri.edu.invalid> wrote in message news:<106gm45g9rje7e2@corp.supernews.com>...
> 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
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38795 is a reply to message #38782] Mon, 29 March 2004 09:35 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Brandon Whitcher" wrote...

> I am relatively new to IDL and have produced some code that calls
> external C routines according to Ronn Kling's book (1st edition). I
> had it working under RedHat linux, but have recently acquired a
> Sunblade workstation and am having trouble compiling the code. I must
> admit, my knowledge of libraries, makefiles and compiling C code is
> limited.

What C compiler?

Sun or GCC?

Do Ronn's examples compile on your Sunblade?

-Rick
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38798 is a reply to message #38795] Mon, 29 March 2004 09:10 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
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
Re: Makefile for external calls on Solaris 9 (64-bit) [message #38859 is a reply to message #38773] Wed, 31 March 2004 00:08 Go to previous message
bjwhitcher is currently offline  bjwhitcher
Messages: 4
Registered: March 2004
Junior Member
"Rick Towler" <rtowler@u.washington.edu> wrote in message news:<c4cakp$r6k$1@nntp6.u.washington.edu>...
> 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,

I modified my Makefile, using gcc with your flags instead of ld, and
it works! Thanks for the help.

Brandon
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Generalized Hough Transform
Next Topic: Re: Finding the closest value in an array...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 10:58:03 PDT 2025

Total time taken to generate the page: 0.00446 seconds