Opened 12 years ago

Closed 12 years ago

#32041 closed defect (fixed)

apple-gcc42: build fails when libunwind-headers is installed

Reported by: dave@… Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: haspatch Cc: royliu@…, ryandesign (Ryan Carsten Schmidt), mfeiri, timdiab@…, drkp (Dan Ports)
Port: apple-gcc42

Description

This is on Lion.

This thread led me to try uninstalling libunwind-headers (I was getting the same compilation errors in my build log as shown there), after which apple-gcc42 built and installed flawlessly: http://gcc.gnu.org/ml/gcc-help/2008-04/msg00099.html

Attachments (3)

main.log.bz2 (121.4 KB) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
apple-gcc42.diff (674 bytes) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
proposed patch
apple-gcc42.patch (1.4 KB) - added by drkp (Dan Ports) 12 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Milestone: MacPorts 2.0.4
Owner: changed from macports-tickets@… to jeremyhu@…
Port: apple-gcc42 added
Summary: Having libunwind-headers installed prevents apple-gcc42 from buildingapple-gcc42: build fails when libunwind-headers is installed

comment:2 Changed 12 years ago by royliu@…

@dave,

Did the apple-gcc42 port get updated for you recently (after November 11)? The build failure may be related to a change I made.

-Roy

comment:3 Changed 12 years ago by dave@…

I'm afraid I don't know; this was discovered as part of my port rebuild during a Lion upgrade

comment:4 Changed 12 years ago by royliu@…

What was the approximate build failure time?

@jeremyhu, I say we close this and wait for more reports like this one to crop up. What do you think?

comment:5 Changed 12 years ago by dave@…

Approximately the time at which I reported the bug

comment:6 in reply to:  4 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: royliu@… ryandesign@… added

Replying to royliu@…:

@jeremyhu, I say we close this and wait for more reports like this one to crop up. What do you think?

I wouldn't close it until the problem is resolved. It's a real problem; I experienced it too on Snow Leopard with Xcode 3.2.6, and solved it by deactivating libunwind-headers, as indicated here. See also #32224 which may be the same problem or related. apple-gcc42 should either be fixed to install properly even when libunwind-headers is installed, or it should fail with a nice error message when libunwind-headers is installed telling the user to deactivate it first; see the ImageMagick Portfile for a nice reusable pre-configure block that can be used to do the latter.

comment:7 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: jeremyhu@… added
Owner: changed from jeremyhu@… to mfeiri@…
Port: libunwind-headers added; apple-gcc42 removed

If this is "fixed" by removing libunwind-headers, then the bug is in libunwind-headers.

comment:8 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Are you sure? Couldn't it just as easily be that apple-gcc42 is placing -I${prefix}/include before -I. in its CPPFLAGS?

comment:9 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

No, I can't be sure, because nobody has provided me with a build log, and I'm not inclined to spend too much of my increasingly rare spare time working on a 5 year old compiler on a 4 year old OS. If someone attaches a build log, or the pre-processed source for the failure, I'll look at it, but based on what little information I have, I'm punting to libunwind-headers.

comment:10 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Then you're saying that even if you have libunwind-headers installed, apple-gcc42 builds correctly for you on Lion?

I'll get you a log of the failure from Snow Leopard.

comment:11 Changed 12 years ago by mfeiri

Cc: mfeiri@… added; jeremyhu@… removed
Owner: changed from mfeiri@… to jeremyhu@…
Port: apple-gcc42 added; libunwind-headers removed

I managed to reproduce the bug on a snow leopard system. What happens is that unwind.h from libunwind(-headers) shadows the internal unwind.h in gcc. I consider this a bug in gcc though. The gcc build scripts should properly arrange the order of the include dirs. Indeed this seems fixed in gcc43 and all newer versions of gcc. But I don't see myself spending time and effort backporting these fixes from gcc43 to apple-gcc42 (which would also trigger gplv3 concerns). My recommendation is to simply mark apple-gcc42 as "conflicts libunwind-headers" (or maybe even as "replaced_by clang").

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log.bz2 added

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: apple-gcc42.diff added

proposed patch

comment:12 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Replying to ryandesign@…:

I'll get you a log of the failure from Snow Leopard.

Here it is: attachment:main.log.bz2

Replying to mfeiri@…:

I managed to reproduce the bug on a snow leopard system. What happens is that unwind.h from libunwind(-headers) shadows the internal unwind.h in gcc. I consider this a bug in gcc though. The gcc build scripts should properly arrange the order of the include dirs. Indeed this seems fixed in gcc43 and all newer versions of gcc.

That's what I assumed the problem was.

But I don't see myself spending time and effort backporting these fixes from gcc43 to apple-gcc42 (which would also trigger gplv3 concerns). My recommendation is to simply mark apple-gcc42 as "conflicts libunwind-headers"

No; the conflicts keyword models activation-time conflicts (as in, two ports trying to install a file of the same name); it does not model nor prevent build-time conflicts. This must be handled as I already indicated above:

Replying to ryandesign@…:

or it should fail with a nice error message when libunwind-headers is installed telling the user to deactivate it first; see the ImageMagick Portfile for a nice reusable pre-configure block that can be used to do the latter.

I've now implemented this in attachment:apple-gcc42.diff; Jeremy, please consider committing it.

(or maybe even as "replaced_by clang").

No; the entire reason the apple-gcc42 port exists is to provide a usable compiler for those ports that cannot be compiled with either clang or llvm-gcc-4.2. Since Xcode 4.2 no longer provides any version of gcc, we need a port containing a working version of Apple gcc for those ports to use. See ProblemHotlist#compiler and PortfileRecipes#compiler for how we're currently using this port, in many places.

comment:13 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: timdiab@… added

Has duplicate #32224.

comment:14 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed

comment:15 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Thanks... the sooner we are off of gcc, the better...

comment:16 Changed 12 years ago by 521E328E-2A13-4749-826A-E4EF4F22A0F1@…

I just ran into this issue on Lion while updating my installed ports (port selfupdate && port sync) using:

% port upgrade -u outdated
--->  Computing dependencies for apple-gcc42
--->  Building apple-gcc42
Error: apple-gcc42 cannot be built while libunwind-headers is active.
Error: Please deactivate libunwind-headers and try again.
Error: You can reactivate libunwind-headers again later.
Error: Target org.macports.build returned: libunwind-headers is installed
Log for apple-gcc42 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_apple-gcc42/apple-gcc42/main.log
Error: Problem while installing apple-gcc42
To report a bug, see <http://guide.macports.org/#project.tickets>

Should the fix be available to me (after port sync)?

comment:17 in reply to:  16 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to 521E328E-2A13-4749-826A-E4EF4F22A0F1@…:

The error message you are looking at is the fix: it tells you how to work around the issue:

Error: Please deactivate libunwind-headers and try again.

Cleaning apple-gcc42 before trying again would also be a good idea:

sudo port clean apple-gcc42

comment:18 Changed 12 years ago by drkp (Dan Ports)

Cc: dports@… added

Can't we make this work with libunwind-headers installed just by doing something like this? (see attached patch) We can avoid putting ${prefix} into the include path since we're not using any libraries from there -- mpfr and gmp are for Fortran only and we're not building that.

This works for me on Lion.

Changed 12 years ago by drkp (Dan Ports)

Attachment: apple-gcc42.patch added

comment:19 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: closedreopened

comment:20 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Thanks. I need to revbump apple-gcc42 to fix the path to ld64 and also want to add in a symlink to as, so it will use our as provided by cctools. I'll do this at the same time.

comment:21 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.