LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-29-2013, 08:38 AM   #1
miguelg
Member
 
Registered: Oct 2009
Location: UK
Distribution: Xubuntu
Posts: 31

Rep: Reputation: Disabled
g++ vs clang++: odd behavious


Hello Forum,

I'm come across a very strange issue affecting GCC.

If I compile an SO using g++ [0] the library dependencies are totally different than when compiling the same SO with clang++ [1] using the exact same parameters.

I imagine it's something to do with parameter order; can an enlightened guru please shed some light on this?


[0] http://pastebin.com/8Xp9mwwA
[1] http://pastebin.com/xM8NNj4m
 
Old 03-29-2013, 08:50 AM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,018

Rep: Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323Reputation: 1323
I would assume g++ detected those libs are not required, therefore dropped (for example -lpthread).
 
Old 03-29-2013, 09:09 AM   #3
miguelg
Member
 
Registered: Oct 2009
Location: UK
Distribution: Xubuntu
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
I would assume g++ detected those libs are not required, therefore dropped (for example -lpthread).
But the problem is when I run the g++ compiled program it fails due to an undefined symbol (not so with the clang++ version):

out/src/omnis: symbol lookup error: /home/guedesm/prj/omnis/sh/../out/sources/clank/libclank.so: undefined symbol: clang_createIndex


So if the case is it is dropping some libs then it is doing so in error.

Could it be some other reason perhaps?

Last edited by miguelg; 03-29-2013 at 09:09 AM. Reason: improved reply
 
Old 03-29-2013, 12:56 PM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,888

Rep: Reputation: 521Reputation: 521Reputation: 521Reputation: 521Reputation: 521Reputation: 521
My guess is that libomnis.a is completely left out from the shared object.

Perhaps:

Code:
... -o libclank.so objects_modules -Wl,-whole-archive libomnis.a -Wl,-no-whole-archive ...
PS: I think using libtool wouldn't be a bad idea.
 
Old 03-30-2013, 04:59 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by belnac View Post
Hello Forum,

I'm come across a very strange issue affecting GCC.

If I compile an SO using g++ [0] the library dependencies are totally different than when compiling the same SO with clang++ [1] using the exact same parameters.

I imagine it's something to do with parameter order; can an enlightened guru please shed some light on this?


[0] http://pastebin.com/8Xp9mwwA
[1] http://pastebin.com/xM8NNj4m
AFAIK, g++ and clang++ each uses its own standard C++ library coming with each of the compilers.
 
  


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
Building with clang for new C++ standard tron_thomas Programming 2 03-11-2012 04:40 PM
Installation of Just Clang/LLVM Documentation? haziz Debian 1 01-08-2012 05:18 AM
Clang/LLVM Install Within Slackware? haziz Slackware 8 01-03-2012 04:46 AM
Anyone doing much with clang? MBybee Programming 2 12-18-2009 01:43 PM
abnormal behavious in comparison check in 'if' condition. indiancosmonaut Programming 10 04-03-2008 01:10 AM


All times are GMT -5. The time now is 07:32 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration