By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,557 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,557 IT Pros & Developers. It's quick & easy.

Help to compile C UDFs using gcc on AIX (bldrtn)

P: n/a
Hi,

the following gcc compile/link (in bldrtn) works fine on our Linux
Servers

# Set the runtime path since routines run as setuid.
EXTRA_LFLAG="-Wl,-rpath,$DB2PATH/lib"

# If an embedded SQL program, precompile and bind it.
if [ -f $1".sqc" ]
then
./embprep $1 $2
fi

# Compile the program.
gcc $EXTRA_C_FLAGS -fpic -I$DB2PATH/include -c $1.c -D_REENTRANT

# Link the program and create a shared library
gcc $EXTRA_C_FLAGS -shared -o $1 $1.o $EXTRA_LFLAG -L$DB2PATH/lib -ldb2
-lpthread

However, when I try to use the same on our AIX Server (64bit on 5.3), I
get strange gcc errors on the Link

ld: 0706-012 The -p flag is not recognized.
ld: 0706-012 The -a flag is not recognized.
ld: 0706-012 The -t flag is not recognized.
ld: 0706-012 The -h flag is not recognized.
collect2: ld returned 255 exit status
cp: application_id: No such file or directory

If I leave off the $EXTRA_LFLAG, it compiles/Links fine, but gives
runtime errors so I guess it is needed ...

Anyone else have working gcc commands to use in bldrtn on AIX?
- the default bldrtn on AIX has commands for xlc_r and not gcc

Many thanks.

PaulR.

Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
PaulR wrote:
Hi,

the following gcc compile/link (in bldrtn) works fine on our Linux
Servers ....
However, when I try to use the same on our AIX Server (64bit on 5.3), I
get strange gcc errors on the Link


DB2 for AIX supports the following programming languages and compilers:

C
IBM C for AIX Version 5.0.2.3

IBM C for AIX Version 6.0
C++
IBM VisualAge C++ Version 5.0.2.3 with the March 2003 C++ Runtime PTF:
http://www-1.ibm.com/support/docview...id=swg24004427

IBM VisualAge C++ Version 6.0 with the March 2003 C++ Runtime PTF: 4
http://www-1.ibm.com/support/docview...id=swg24004427
Jan M. Nelken
Nov 12 '05 #2

P: n/a
Jan,.

Thanks for that - Frustrating though it is, considering we only
need it for the userexits and a few UDFs.

Nov 12 '05 #3

P: n/a
Tested an UDF.

Only compiled with gcc (there are advices to use ld even when using gcc
as main compiler), linked with ld, ld is always part of the AIX
distribution.

ld -o myroutine myroutine.o -L$DB2PATH/lib -ldb2 -ldb2apie
-bE:myroutine.exp -e MYROUTINE1 -lc

Bernard Dhooghe

Nov 12 '05 #4

P: n/a
PaulR wrote:
Jan,.

Thanks for that - Frustrating though it is, considering we only
need it for the userexits and a few UDFs.

Don't mind Jan. As long as you don't call him via 1-800-IBM what matters
is what works, not which compiler IBM supports ;-)

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #5

P: n/a
Thanks for the options.

I did try ld, it compiled fine but then gave some horrible run-time
error!

Anyway, we have got the project to cough up the 700 for xlc, and all
is working fine. (cheaper in the long run!)

Thanks again.

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.