[Ilugc] convert dynamic link to static link using GCC compile for C++

  • From: yogeshk@xxxxxxxxx (Yogesh Kumar K)
  • Date: Tue Nov 13 12:43:20 2007

hi,

in my project i need to create the executable file in the static library file 
to be share instead of dynamic , 
i made the changes of code as follows 


  make file content is before change
  ************************
  
g++ -c -O0 -g -pthread -DCASINO_TWIST  -DTARGET_UNIX -DTARGET_LINUX -DMYSQL4 
-I.. -I../src -I../lib  -I/usr/include/mysql -o ../lib/sql/mMySQL.o 
../lib/sql/mMySQL.cpp
  g++ -c -O0 -g -pthread -DCASINO_TWIST  -DTARGET_UNIX -DTARGET_LINUX -DMYSQL4 
-I.. -I../src -I../lib  -I/usr/include/mysql -o ../lib/thread/m_thread.o  
../lib/thread/m_thread.cpp
  
make file content is after change
************************
g++ -static -static-libgcc -c -O0 -g -pthread -DCASINO_TWIST -DTARGET_UNIX 
-DTARGET_LINUX -DMYSQL4 -I.. -I../src -I../lib -I/usr/include/mysql -o 
../lib/sql/mMySQL.o ../lib/sql/mMySQL.cpp
g++ -static -static-libgcc -c -O0 -g -pthread -DCASINO_TWIST -DTARGET_UNIX 
-DTARGET_LINUX -DMYSQL4 -I.. -I../src -I../lib -I/usr/include/mysql -o 
../lib/thread/m_thread.o ../lib/thread/m_thread.cpp


[root@redhat unix]# make -f Makefile_server_twistcasino 
  g++ -static-libgcc -o server -O0 -g -pthread -DCASINO_TWIST  -DTARGET_UNIX 
-DTARGET_LINUX -DMYSQL4 -L/usr/lib/mysql -L/usr/lib  -lmysqlclient 
../lib/m_string.o ../lib/m_except.o ../lib/http/m_http.o  ../lib/mail/m_mail.o 
../lib/utils/m_datetime.o ../lib/array/m_classes.o  ../lib/file/m_file.o 
../lib/map/m_map.o ../lib/utils/m_utils.o  ../lib/xml/m_xmlparser.o 
../lib/convert/mConvert.o ../lib/sql/mSQL.o  ../lib/sql/mMySQL.o 
../lib/thread/m_thread.o ../lib/socket/m_socket.o  ../lib/ssi/m_block.o 
../lib/ssi/mf_ssi.o ../lib/ssi/mf_ssi_parser.o  ../src/common/mCashUtils.o 
../src/server/mCommon.o  ../src/server/mMain.o ../src/server/mServer.o 
../src/server/mUser.o  ../src/server/mCash.o ../src/server/mMoney.o 
../src/server/mGame.o  ../src/server/table/mGameRoulette.o 
../src/server/other/mGameKeno.o  ../src/server/slots_vabank/mGameSlots5line.o  
../src/server/slots_vabank/mGameSlotsFruit.o  
../src/server/videopoker/mGameVideopokerTenorbetter.o  
../src/server/videopoker/mGameVideopokerJokerpoker.o  
../src/server/cards/mGameCards.o  ../src/server/cards/mGameCardsBaccarat.o  
../src/server/cards/mGameCardsBlackjack.o  
../src/server/cards/mGameCardsCaribbeanPoker.o  
../src/server/cards/mGameCardsOasisPoker.o  
../src/server/cards/mGameCardsLetItRide.o  
../src/server/cards/mGameCardsPaiGowPoker.o  
../src/server/cards/mGameCardsReddog.o  
../src/server/cards/mGameCardsCasinoWar.o

 
iam compiling like this , this is not creating the file with the static library 
for the file server 

  [root@redhat unix]# ldd server 
            libmysqlclient.so.14 => /usr/lib/mysql/libmysqlclient.so.14 
(0x00294000)
            libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00101000)
            libm.so.6 => /lib/tls/libm.so.6 (0x00aee000)
            libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00c04000)
            libc.so.6 => /lib/tls/libc.so.6 (0x009c3000)
            libcrypt.so.1 => /lib/libcrypt.so.1 (0x0089c000)
            libnsl.so.1 => /lib/libnsl.so.1 (0x007ca000)
            libz.so.1 => /usr/lib/libz.so.1 (0x00b19000)
            libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00db3000)
            /lib/ld-linux.so.2 (0x009a6000)
    [root@redhat unix]# 
    
    can any one tell how to compile the file to be in the static library files 
instead of dynamic linking files .

because i need to use the this file , where there is no gcc compiler .


Thanks & Regards
Yogesh K 


DISCLAIMER:
This communication may be confidential and privileged and the views expressed 
herein may be personal and are not necessarily the views of ReDIM.
It is for the exclusive use of the intended recipient. If you are not the 
intended recipient, please note that any distribution,
copying or use of this communication or the  information in it is strictly 
prohibited.If you have received this communication 
in error, please notify us by email (info@xxxxxxxxx) and then delete the email 
and any copies of it.

Other related posts:

  • » [Ilugc] convert dynamic link to static link using GCC compile for C++ - Yogesh Kumar K