LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2011, 07:56 PM   #1
ninofattore
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Rep: Reputation: Disabled
Post to build a shared library on linux using same command used for solaris


I am able to build a shared library under solaris with
/usr/local/bin/g++ -G -o output.so file1.o file2.o file3.o.
How do I build the shared library under linux using the same files?
I have tried to use the same command /usr/local/bin/g++ -g -o but I got some undefined references, even if those references are defined in one of the object files.

Any suggestion?
Thanks
 
Old 06-22-2011, 08:34 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
As far as I'm aware -G takes a numeric argument that you
seem to be missing; what version of g++ are you using on
Solaris, which one on Linux?



Cheers,
Tink
 
Old 06-24-2011, 01:35 PM   #3
ninofattore
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the immediate reply. Your comment about the -G option made me think more, and
I found out that on SOlaris it is used to compile for a shared library, and on Linux has
a different meaning and as you said need an argument. I modified my Linux makefile to include
the -shared option and everything compiled without errors.
Thanks again,
Nino
 
Old 06-24-2011, 07:40 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Most welcome. Glad you got it sorted, and thanks for coming back
telling us how you fixed it - it may help others in future searches.


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc link shared library against another shared library qcp Linux - Newbie 1 07-25-2008 12:15 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
Command to Show Which Build of Solaris Armor Solaris / OpenSolaris 4 01-11-2007 01:37 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM


All times are GMT -5. The time now is 04:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration