Re: Compiling shared libraries
Howdy John et al, Thanks to everyone who sent me an email, after "playing" all night, I came up with the following two make files. The first builds my shared library, the second links the MQ C++ shared libraries (and mine) into a test program. I sugest you file this one away because it is bound to be usefull. Sid #- # Build my various Classes into a shared library # CC=g++ TARGET = /opt/mqlink/lib/libmqlink.so INCLUDE = -I/opt/pgp/headers -I/opt/mqm/inc OBJECTS = Log.o DataFile.o HL7.o Segment.o MQSupport.o MQAdmin.o BaseXML.o MD5Hash.o Crypto.o #DEBUG = -D_DEBUG DEBUG= LIBFLAGS= -fPIC -shared -rdynamic CFLAGS= -fPIC .cpp.o: $(CC) $(CFLAGS) -c $(INCLUDE) $(DEBUG) 2>&1 $< all: $(MAKE) $(TARGET) $(MAKE) lib $(TARGET): $(OBJECTS) lib: $(CC) $(LIBFLAGS) -o $(TARGET) $(OBJECTS) clean: rm -f *.o [rm -f $(TARGET) -8< # # Build our test program and link in the shared libraries # # Note: use "ldd" to confirm whats been linked in. # Make sure the LD_LIBRARY_PATH is set to include our library. CC=g++ TARGET=test OBJS = test.o LIBS = -ldl -L/opt/mqlink/lib -lmqlink -limqs23gl -limqb23gl # # Our Archives (static) # ARCS = /opt/pgp/libraries/static/release/libPGPsdk.a INCLUDE = -I/opt/pgp/headers -I/opt/mqlink/src/commoncode -I/opt/mqm/inc LDFLAGS= #DEBUG= -D_DEBUG DEBUG= CFLAGS=-fPIC -rdynamic .cc.o: $(CC) -c $< $(INCLUDE) $(LIBS) $(ARCS) $(DEBUG) 2>&1 all: $(MAKE) $(TARGET) # Compile program, # $(TARGET): $(ARCS) $(OBJS) $(LIBS) $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(INCLUDE) -o $(TARGET) 2>&1 $< lib: @cd /opt/mqlink/src/commoncode; if ls *.o >/dev/null 2>&1; then $(MAKE) lib; fi clean: @echo "Cleaning up" rm -f *.o rm -f $(TARGET) --8<- -Original Message- From: Roger Lacroix [mailto:[EMAIL PROTECTED] Sent: Saturday, 31 May 2003 2:04 AM To: [EMAIL PROTECTED] Subject: Re: Compiling shared libraries Here is a makefile for Linux. This makefile compiles test1.c into a shared library of test1.so + cut here ++ # Makefile CC = cc CFLAGS = -G -I. -DUNIX CFLAGS_COMPILE_ONLY = -c -DUNIX LIBS = -lmqm # .c.o: ${CC} ${CFLAGS_COMPILE_ONLY} ${CFLAGS} $< OBJ = test1.o all: test1.so test1.so: ${OBJ} ${CC} ${CFLAGS} -G -o $@ ${OBJ} ${LIBS} + cut here ++ Make sure when you cut and paste this makefile that the indented lines use a single tab and NOT spaces. later Roger... At 10:53 AM 5/30/2003, you wrote: >It has been a while since I compiled on Linux, so you may want to check the >help. I assume you are using GNU C++ compiler so try doing gcc --help I >believe. If my guess it right it is '-G' or similar. > >Hope this helps. > >Roger, since you have a Linux system could you help this fellow ;-) > >Chris > > >-Original Message- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Sent: Friday, May 30, 2003 7:30 AM >To: [EMAIL PROTECTED] >Subject: Compiling shared libraries > > >Howdy all, > >I am porting some C++ MQ code from Win32 to Linux and have never used shared >libraries. > >While I can comile my MQ code, I cannot figure out how to link the shared >libraries (static libraries are ok). > >Can anyone give me some usefull pointers ? > > >Sid > >Instructions for managing your mailing list subscription are provided in >the Listserv General Users Guide available at http://www.lsoft.com >Archive: http://vm.akh-wien.ac.at/MQSeries.archive > >Instructions for managing your mailing list subscription are provided in >the Listserv General Users Guide available at http://www.lsoft.com >Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: Compiling shared libraries
Here is a makefile for Linux. This makefile compiles test1.c into a shared library of test1.so + cut here ++ # Makefile CC = cc CFLAGS = -G -I. -DUNIX CFLAGS_COMPILE_ONLY = -c -DUNIX LIBS = -lmqm # .c.o: ${CC} ${CFLAGS_COMPILE_ONLY} ${CFLAGS} $< OBJ = test1.o all: test1.so test1.so: ${OBJ} ${CC} ${CFLAGS} -G -o $@ ${OBJ} ${LIBS} + cut here ++ Make sure when you cut and paste this makefile that the indented lines use a single tab and NOT spaces. later Roger... At 10:53 AM 5/30/2003, you wrote: It has been a while since I compiled on Linux, so you may want to check the help. I assume you are using GNU C++ compiler so try doing gcc --help I believe. If my guess it right it is '-G' or similar. Hope this helps. Roger, since you have a Linux system could you help this fellow ;-) Chris -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 7:30 AM To: [EMAIL PROTECTED] Subject: Compiling shared libraries Howdy all, I am porting some C++ MQ code from Win32 to Linux and have never used shared libraries. While I can comile my MQ code, I cannot figure out how to link the shared libraries (static libraries are ok). Can anyone give me some usefull pointers ? Sid Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: Compiling shared libraries
Try linking with the gcc -G option (gcc -G module1.o module2.o etc.) I think that creates shared libraries on Linux. Try gcc --help or search the web fore details on gcc. Regards John. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 30 May 2003 11:30 To: [EMAIL PROTECTED] Subject: Compiling shared libraries Howdy all, I am porting some C++ MQ code from Win32 to Linux and have never used shared libraries. While I can comile my MQ code, I cannot figure out how to link the shared libraries (static libraries are ok). Can anyone give me some usefull pointers ? Sid Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive ** Click here to visit the Argos home page http://www.argos.co.uk The information contained in this message or any of its attachments may be privileged and confidential, and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you are not the intended addressee, any disclosure, reproduction, distribution, dissemination or use of this communication is not authorised. If you have received this message in error, please advise the sender by using your reply facility in your e-mail software. All messages sent and received by Argos Ltd are monitored for virus, high risk file extensions, and inappropriate content. As a result users should be aware that mail maybe accessed. ** Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: Compiling shared libraries
It has been a while since I compiled on Linux, so you may want to check the help. I assume you are using GNU C++ compiler so try doing gcc --help I believe. If my guess it right it is '-G' or similar. Hope this helps. Roger, since you have a Linux system could you help this fellow ;-) Chris -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 7:30 AM To: [EMAIL PROTECTED] Subject: Compiling shared libraries Howdy all, I am porting some C++ MQ code from Win32 to Linux and have never used shared libraries. While I can comile my MQ code, I cannot figure out how to link the shared libraries (static libraries are ok). Can anyone give me some usefull pointers ? Sid Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive