Author |
Message
|
noles321 |
Posted: Wed Feb 21, 2007 7:50 am Post subject: Compiling and Linking a simple program on LINUX |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
I have a simple getmsg.c program that is being ported from AIX. I am new to LINUX and can't seem to figure out how to compile and link the correct libraries. The program was a simple get program that ran on an AIX 5.3 queue manager and is being ported to LINUX 6.0 queue manager. I simply used a
cc getmsg -o getmsg.c /usr/mqm/lib/libmqm.a to compile and link on the AIX
I can't seem to get the appropriate parameters for
gcc on the LINUX.
Thanks in advance for the help. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Feb 21, 2007 7:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Which distro of Linux are you using? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
noles321 |
Posted: Wed Feb 21, 2007 7:56 am Post subject: we are using |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
We are using Redhat RHEL 4 on an intel platform. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 21, 2007 8:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
Vitor |
Posted: Wed Feb 21, 2007 8:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
You might have more luck with a make file. Can I shamlessly plug the efforts of a fellow poster, which you'll find at:
http://www.capitalware.biz/unix_general.html
Far greater knowledge of such matters than me  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
noles321 |
Posted: Wed Feb 21, 2007 8:09 am Post subject: i have read this |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
I have read this and tried it and still can't seem to get anywhere. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 21, 2007 8:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So you ran
Quote: |
C server application, 32-bit, non-threaded
gcc -m32 -o amqsput_32 amqsput0.c -I/opt/mqm/inc -L/opt/mqm/lib -Wl,
-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -lmqm
|
And got... what? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
noles321 |
Posted: Wed Feb 21, 2007 8:17 am Post subject: |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
gcc: unrecognized option `-rpath=/opt/mqm/lib'
gcc: unrecognized option `-rpath=/usr/lib' |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 21, 2007 8:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you using the GCC that came with RHEL 4? Or did you install one yourself from source or something? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
noles321 |
Posted: Wed Feb 21, 2007 9:10 am Post subject: |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
yes I am using the gcc compiler that came with RHEL 4 |
|
Back to top |
|
 |
noles321 |
Posted: Wed Feb 21, 2007 9:37 am Post subject: got past last problem |
|
|
Apprentice
Joined: 15 Nov 2004 Posts: 43
|
[jgovert@shldvmq0 source]$ gcc -m32 -o /home/jgovert/source/getmsg /home/jgovert/source/getmsg.c -I/opt/mqm/inc -L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib/ -lmqm
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
Any ideas? |
|
Back to top |
|
 |
dgolding |
Posted: Wed Feb 21, 2007 9:54 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
This has nothing to do with loading the MQ libraries - it's crt1.o you're missing.
I googled it and it seems quite a common problem - you need to install this library libc-devel-2.3.3-74.i386
But as I say just look at the search results, there's some good ones. Isn't Google wonderful?  |
|
Back to top |
|
 |
|