bugGNUstep - Bugs: bug #33189, Linking broken with subprojects...

Group
 
 

bug #33189: Linking broken with subprojects and Clang

Submitter:  Quentin Mathé <qmathe>
Submitted:  Sun 01 May 2011 03:41:25 PM UTC
   
 
Category:  Makefiles Severity:  5 - Blocker
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 23 May 2011 02:54:14 PM UTC, comment #7: 

Thanks ... hopefully we'll do a 2.6.1 soon.

Thanks

Nicola Pero <nico>
Group Member
Tue 03 May 2011 04:03:31 PM UTC, comment #6: 

The fix is ok. I was able to build Base, Gorm and Étoilé without troubles.

The only minor issue is that at linking time clang logs a warning:
clang: warning: argument unused during compilation: '-shared-libgcc'
But that was the case before, it is not something new.

This comes from:
clang  -shared -Wl,-soname,libgnustep-base.so.1.23  -rdynamic      -shared-libgcc -fexceptions -o ./obj/libgnustep-base.so.1.23.0 obj/libgnustep-base.obj/GSLocale.m.o [snip]

A 2.6.1 release would be great indeed.

Thanks Nicola.

Quentin Mathé <qmathe>
Group Member
Tue 03 May 2011 03:35:49 PM UTC, comment #5: 

Well, according to your config.log, clang is recognized as a
version of gcc, except (as we know) it doesn't behave like gcc
at all when you use the -r flag. :-(

I changed configure in gnustep-make trunk to manually do

 ${CC} --version | grep clang

to determine if the compiler is clang.

Can you test it ?

I'd like to get this fixed, then do a 2.6.1 release with the
fix.

Thanks

Nicola Pero <nico>
Group Member
Tue 03 May 2011 03:06:08 PM UTC, comment #4: 

I get the same output than you with GCC for:

checking for the flag to use to do partial linking... -r

So it looks like there is something wrong going on here.

I attached the config.log so that you can see how I configured gnustep-make.

If I change OBJ_MERGE_CMD_FLAG as you suggested in config.make, everything links just fine :-)

Is it possible to export an environment variable as a workaround to get gnustep-make 2.6 working with Clang?

Thanks,
Quentin.

(file #23342)

Quentin Mathé <qmathe>
Group Member
Mon 02 May 2011 10:35:46 AM UTC, comment #3: 

gnustep-make 2.6.0 is supposed to try and detect if you're using GCC or clang at configure time.

If you're using GCC, it will do the partial linking using -r, while if you're using clang, it will do the partial linking using -Wl,-r.

What is the output of gnustep-make's configure ?  In particular,
the line --

  checking for the flag to use to do partial linking... -r

(that's the output for GCC on my machine).  In the case of
clang, that should read

  checking for the flag to use to do partial linking... -Wl,-r

You can still edit config.make manually and change it to the
other one, but it's all supposed to work automatically.

Thanks

Nicola Pero <nico>
Group Member
Sun 01 May 2011 11:36:00 PM UTC, comment #2: 

I found the same problem too. Unfortunately, I upgraded gnustep-make and clang at the same time, so I don't know what the cause is.

I do know that:

  • clang 2.8 doesn't suffer from this issue
  • clang 2.9 and clang SVN does


I ended up patching clang so that it passes the '-r' option to the linker, which partially removes this problem. I still have runtime errors with clang on builtins (e.g. memset()), so I disabled them too (-fno-builtin).

Chris Armstrong <carmstrong>
Sun 01 May 2011 03:45:26 PM UTC, comment #1: 

I forgot to mention that the issue appeared when I updated my GNUstep core working copy a week ago.
Everything was working fine two or three weeks ago. At this time I was using a two months old GNUstep Make version I think.

Quentin Mathé <qmathe>
Group Member
Sun 01 May 2011 03:41:25 PM UTC, original submission:  

Hi,

GNUstep Base r32961 (yesterday) and Make r32963 (today)
Clang 2.9 rc3
GCC 4.4.3
Ubuntu 10.04

If I try to compile GNUstep Base or various other projects with Clang 2.9 rc3, the linking stage fails. I have to use 'make LD=gcc' rather than just 'make' to get them build correctly.

I observe the problem every time I use subproject.make or aggregate.make in a GNUmakefile to build subprojects located in subdirectories. Simple libraries or apps build just fine though.

Here are the errors I get without LD=gcc:

This is gnustep-make 2.6.0. Type 'make print-gnustep-make-help' for help.
Making all in Source ...
Making all in Additions ...
Making all for subproject Additions...
 Linking subproject Additions ...
clang: warning: argument unused during compilation: '-r'
clang: warning: argument unused during compilation: '-shared-libgcc'
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048120
obj/Additions.obj/GSObjCRuntime.m.o: In function `GSObjCClass':
/home/qmathe/reps/devmodules/core/base/Source/Additions/GSObjCRuntime.m:78: undefined reference
to `object_getClass'
obj/Additions.obj/GSObjCRuntime.m.o: In function `GSObjCSuper':
/home/qmathe/reps/devmodules/core/base/Source/Additions/GSObjCRuntime.m:82: undefined reference
to `class_getSuperclass'
obj/Additions.obj/GSObjCRuntime.m.o: In function `GSObjCIsInstance':
/home/qmathe/reps/devmodules/core/base/Source/Additions/GSObjCRuntime.m:87: undefined reference
to `object_getClass'
[snip]
obj/Additions.obj/Unicode.m.o: In function `GSPrivateDefaultCStringEncoding':
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2678: undefined reference to `getenv'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2683: undefined reference to `strcasecmp'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2684: undefined reference to `strcasecmp'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2691: undefined reference to `stderr'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2694: undefined reference to `fprintf'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2696: undefined reference to `fprintf'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2709: undefined reference to `stderr'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2711: undefined reference to `fprintf'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2713: undefined reference to `fprintf'
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:2723: undefined reference to `objc_msg_lookup'
obj/Additions.obj/Unicode.m.o: In function `.objc_load_function':
/home/qmathe/reps/devmodules/core/base/Source/Additions/Unicode.m:383: undefined reference to `__objc_exec_class'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: * [obj/subproject.o] Error 1
make[3]: * [internal-subproject-all_] Error 2
make[2]: * [Additions.all.subproject.variables] Error 2
make[1]: * [internal-all] Error 2
make: * [internal-all] Error 2

Thanks,
Quentin.

Quentin Mathé <qmathe>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #23342:  config.log added by qmathe (28KiB - text/x-log)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nico (Posted a comment)
  • -email is unavailable- added by carmstrong (Posted a comment)
  • -email is unavailable- added by qmathe (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-05-23 nico Open/ClosedOpen Closed
    2011-05-03 nico Severity4 - Important 5 - Blocker
    2011-05-03 qmathe Attached File- Added config.log, #23342

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code