Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#36438 closed defect (wontfix)

ports which mirror system libraries can cause +universal ports to fail if they are -universal

Reported by: ahelfer1971@… Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), poorsod@…, ashleynoelhinton@…, 4eppelin@…, larryv (Lawrence Velázquez), cooljeanius (Eric Gallager), tkbrekken@…, deesto (John S. De Stefano Jr.), hapaguy (Brian Kurt Fujikawa), mf2k (Frank Schima), denpashogai@…, macports@…, bosch@…, rmstonecipher@…, ashley@…, tyson@…, schnitzenhymerstine@…, maehne (Torsten Maehne), dstrubbe (David Strubbe), jsm@…, gregmainland@…, iwharry@…, neverpanic (Clemens Lang)
Port: ld64

Description

When attempting an upgrade of gcc47, dependency libgdiplus fails.

Attachments (1)

main.log (9.6 KB) - added by ahelfer1971@… 11 years ago.
libgdiplus buidl log

Download all attachments as: .zip

Change History (63)

Changed 11 years ago by ahelfer1971@…

Attachment: main.log added

libgdiplus buidl log

comment:1 Changed 11 years ago by mf2k (Frank Schima)

Keywords: lion gcc47 libgdiplus removed
Port: libgdiplus added; gcc47 removed
Priority: HighNormal

In the future, please fill in the Port field with the failed port and do not change the Priority field.

The log is incomplete. Please clean libgdiplus and try again, and attach the new main.log.

comment:2 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

What is the output of:

/usr/bin/clang --version
ls /usr/lib/libstdc++*

comment:3 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: jeremyhu@… added

Cc Me!

comment:4 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I can't reproduce this. Please figure out how clang is calling the linker by running the failing link command manually with '-v'

comment:5 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ok, I am now able to reproduce this ...

comment:6 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

The call to ld is:

"/usr/bin/ld" -demangle -dynamic -arch i386 -flat_namespace -macosx_version_min 10.8.0 -undefined suppress -undefined suppress -o /var/folders/kd/lg174pm94bz417bmp5vv57j80000gn/T/testgdi-qVJz5d.out -L/opt/local/lib -L/lib testgdi.o ../src/.libs/libgdiplus.dylib -lpthread /opt/local/lib/libpangocairo-1.0.dylib /opt/local/lib/libcairo.dylib /opt/local/lib/libpixman-1.dylib /opt/local/lib/libxcb-shm.dylib /opt/local/lib/libX11-xcb.dylib /opt/local/lib/libxcb-render.dylib /opt/local/lib/libXrender.dylib -lrt /opt/local/lib/libpangoft2-1.0.dylib /opt/local/lib/libpango-1.0.dylib /opt/local/lib/libgmodule-2.0.dylib /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libgthread-2.0.dylib /opt/local/lib/libffi.dylib /opt/local/lib/libglib-2.0.dylib -lresolv /opt/local/lib/libtiff.dylib -ljbig /opt/local/lib/libjpeg.dylib /opt/local/lib/libgif.dylib /opt/local/lib/libSM.dylib /opt/local/lib/libICE.dylib /opt/local/lib/libX11.dylib /opt/local/lib/libxcb.dylib /opt/local/lib/libXau.dylib /opt/local/lib/libXdmcp.dylib /opt/local/lib/libpng15.dylib /opt/local/lib/libexif.dylib /opt/local/lib/libintl.dylib -lc -lm /opt/local/lib/libfontconfig.dylib /opt/local/lib/libiconv.dylib /opt/local/lib/libfreetype.dylib -lz -lbz2 /opt/local/lib/libexpat.dylib -framework Foundation -framework Carbon -arch_multiple -final_output .libs/testgdi -lSystem /usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.eprintf.a /usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a

which makes me think this is an ld bug ... we're not even telling the linker to use that dylib, but it's still checking it for some reason...

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

<rdar://problem/12450551>

comment:8 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from macports-tickets@… to jeremyhu@…
Port: ld64 added; libgdiplus removed
Status: newassigned

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

Summary: libgdiplus build fails when upgrading gcc47libstdcxx -universal can cause +universal applications to fail to build (even though they don't use libstdcxx)

comment:10 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

#32396 is essentially the same issue for libxml2.dylib

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

Summary: libstdcxx -universal can cause +universal applications to fail to build (even though they don't use libstdcxx)ports which mirror system libraries can cause +universal ports to fail if they are -universal

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

Cc: poorsod@… ashleynoelhinton@… added

Has duplicates #36444 and #36900 about perl5.12.

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

Duplicate #35644 is about libxml2.dylib again.

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

Duplicate #36971 is also about libxml2.dylib.

comment:15 Changed 11 years ago by 4eppelin@…

Cc: 4eppelin@… added

Cc Me!

comment:16 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: larryv@… added

Cc Me!

comment:17 Changed 11 years ago by larryv (Lawrence Velázquez)

I am seeing this (or something vaguely similar, anyway) while trying to configure zsh for i386 with 64-bit libstdcxx installed. It still builds and installs, but none of zsh’s dynamic modules get installed because ./configure gets tripped up:

configure:11810: checking if environ is available in shared libraries
configure:11832: /usr/bin/clang -c -pipe -O2 -arch i386 -I/opt/local/include -fno-common conftest1.c 1>&5
configure:11835: $? = 0
configure:11838: /usr/bin/clang -o conftest1.bundle -v -L/opt/local/lib -Wl,-v -arch i386 -bundle -flat_namespace -undefined suppress conftest1.o -lgdbm -liconv -ldl -lm -lncurses -lc 1>&5
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: i386-apple-darwin12.2.0
Thread model: posix
@(#)PROGRAM:ld  PROJECT:ld64-134.9
configured to support archs: armv6 armv7 armv7s i386 x86_64
Library search paths:
	/opt/local/lib
	/opt/local/lib
	/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/
ld: in /opt/local/lib/libstdc++.6.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libstdc++.6.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:11841: $? = 1
configure:11929: result: no
Last edited 11 years ago by larryv (Lawrence Velázquez) (previous) (diff)

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

Has duplicate #38858.

comment:19 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:20 Changed 11 years ago by tkbrekken@…

Cc: tkbrekken@… added

Cc Me!

comment:21 Changed 11 years ago by deesto (John S. De Stefano Jr.)

Cc: deesto@… added

Cc Me!

comment:22 Changed 11 years ago by hapaguy (Brian Kurt Fujikawa)

Cc: brian.fujikawa@… added

Cc Me!

comment:23 Changed 11 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:24 Changed 11 years ago by denpashogai@…

Is there a known workaround for this? I can't upgrade perl, and "upgrade outdated" now aborts at that point.

comment:25 Changed 11 years ago by denpashogai@…

Cc: denpashogai@… added

Cc Me!

comment:26 Changed 11 years ago by 4eppelin@…

denpashogai@…

Remove all and install again.

comment:27 in reply to:  24 ; Changed 11 years ago by larryv (Lawrence Velázquez)

Replying to denpashogai@…:

Is there a known workaround for this? I can't upgrade perl, and "upgrade outdated" now aborts at that point.

Force-deactivate libstdcxx for the duration of the upgrade.

sudo port -f deactivate libstdcxx
sudo port upgrade perl5.12
sudo port activate libstdcxx

comment:28 in reply to:  27 Changed 11 years ago by denpashogai@…

Replying to larryv@…:

Force-deactivate libstdcxx for the duration of the upgrade.

sudo port -f deactivate libstdcxx
sudo port upgrade perl5.12
sudo port activate libstdcxx

That seems to have done the trick. Thanks! :)

comment:29 in reply to:  24 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to denpashogai@…:

Is there a known workaround for this? I can't upgrade perl, and "upgrade outdated" now aborts at that point.

Another workaround is to install libstdcxx with +universal

comment:30 Changed 11 years ago by larryv (Lawrence Velázquez)

Has duplicate #38890 against perl5.12.

comment:31 Changed 11 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:32 Changed 11 years ago by mf2k (Frank Schima)

Has duplicate #38904 about perl5.12.

comment:33 Changed 11 years ago by bosch@…

Cc: bosch@… added

Cc Me!

comment:34 in reply to:  27 Changed 11 years ago by ivl1705

Replying to larryv@…:

Force-deactivate libstdcxx for the duration of the upgrade.

sudo port -f deactivate libstdcxx
sudo port upgrade perl5.12
sudo port activate libstdcxx

Thanks, that solved the issue for me.

comment:35 Changed 11 years ago by rmstonecipher@…

Cc: rmstonecipher@… added

Cc Me!

comment:36 Changed 11 years ago by rmstonecipher@…

Jeremy,
Would making +universal a default variant for libstdcxx and other ports plagued by this problem be an acceptable solution?

Ryan Stonecipher

comment:37 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Yeah, I was thinking that, but it's a long list. Here's from just the ports that I have installed:

/opt/local/lib $ for f in *; do [[ -f /usr/lib/$f ]] && port provides /opt/local/lib/$f; done | sed 's/.*: //' | sort -u
apr
apr-util
bzip2
curl
cyrus-sasl2
expat
kerberos5
libarchive
libcomerr
libedit
libffi
libiconv
libpcap
libstdcxx-devel
libxml2
libxslt
ncurses
neon
net-snmp
openldap
openssl
pcre
python27
readline
ruby
serf1
sqlite3
subversion
zlib

comment:38 in reply to:  27 ; Changed 11 years ago by stevej@…

Replying to larryv@…:

Replying to denpashogai@…:

Is there a known workaround for this? I can't upgrade perl, and "upgrade outdated" now aborts at that point.

Force-deactivate libstdcxx for the duration of the upgrade.

sudo port -f deactivate libstdcxx
sudo port upgrade perl5.12
sudo port activate libstdcxx

When I try sudo port -f deactivate libstdcxx, I get "Error: port deactivate failed: Image error: port libstdcxx is not active." I am trying to resolve (apparently) the same issue described in this bug though. Trying to upgrade perl 5.12 says...

:info:build ld: in '/opt/local/lib/libstdc++.6.dylib', file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libstdc++.6.dylib for architecture i386
Last edited 11 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:39 in reply to:  38 ; Changed 11 years ago by larryv (Lawrence Velázquez)

Replying to stevej@…:

When I try sudo port -f deactivate libstdcxx, I get "`Error: port deactivate failed: Image error: port libstdcxx is not active.`" I am trying to resolve (apparently) the same issue described in this bug though. Trying to upgrade perl 5.12 says...

:info:build ld: in '/opt/local/lib/libstdc++.6.dylib', file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libstdc++.6.dylib for architecture i386

Do you have libstdcxx-devel installed? Try the same thing using libstdcxx-devel instead of libstdcxx.

Last edited 11 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:40 Changed 11 years ago by ashley@…

Cc: ashley@… added
Last edited 11 years ago by ashley@… (previous) (diff)

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

Has duplicate #38946.

comment:42 Changed 11 years ago by larryv (Lawrence Velázquez)

Has duplicate #38949 against perl5.12.

comment:43 Changed 11 years ago by tyson@…

Cc: tyson@… added

Cc Me!

comment:44 in reply to:  39 Changed 11 years ago by stevej@…

Aha. In my case, I needed to deactivate/activate libstdcxx-devel instead of libstdcxx.

Replying to larryv@…:

Replying to stevej@…:

When I try sudo port -f deactivate libstdcxx, I get "`Error: port deactivate failed: Image error: port libstdcxx is not active.`" I am trying to resolve (apparently) the same issue described in this bug though. Trying to upgrade perl 5.12 says...

:info:build ld: in '/opt/local/lib/libstdc++.6.dylib', file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libstdc++.6.dylib for architecture i386

Do you have libstdcxx-devel installed? Try the same thing using libstdcxx-devel instead of libstdcxx.

comment:45 Changed 11 years ago by schnitzenhymerstine@…

Cc: schnitzenhymerstine@… added

Cc Me!

comment:46 Changed 11 years ago by maehne (Torsten Maehne)

Cc: Torsten.Maehne@… added

Cc Me!

comment:47 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: dstrubbe@… added

Has duplicate #39016 against perl5.12.

comment:48 in reply to:  36 Changed 11 years ago by cooljeanius (Eric Gallager)

Replying to rmstonecipher@…:

Jeremy,
Would making +universal a default variant for libstdcxx and other ports plagued by this problem be an acceptable solution?

I vote for either this or... actually nvm, just this.

comment:49 Changed 11 years ago by jsm@…

Cc: jsm@… added

Cc Me!

comment:50 Changed 11 years ago by gregmainland@…

Cc: gregmainland@… added

Cc Me!

comment:51 Changed 11 years ago by iwharry@…

Cc: iwharry@… added

Cc Me!

comment:52 in reply to:  27 Changed 11 years ago by boydb@…

Replying to larryv@…:

Force-deactivate libstdcxx for the duration of the upgrade.

sudo port -f deactivate libstdcxx
sudo port upgrade perl5.12
sudo port activate libstdcxx

For me this did not work off the bat, but if I cleaned my perl5.12 install it then fixed the issue for me.

So, if perl5.12 still fails to build for you after trying the above, here's one more process to try:

sudo port -f deactivate libstdcxx
sudo port clean perl5.12
sudo port upgrade perl5.12
sudo port activate libstdcxx

comment:53 Changed 11 years ago by cooljeanius (Eric Gallager)

Actually I just came up with another idea: would throwing something like the following into perl5's universal variant work?

if {![catch "registry_active libstdcxx"]} {
    depends_lib-append path:lib/.libstdcxx:libstdcxx
    require_active_variants path:lib/.libstdcxx:libstdcxx universal
}

This is with including the active_variants 1.1 port group somewhere earlier in the portfile of course. Also I'm adding the dependency on libstdcxx because I'm assuming that require_active_variants only works with ports that are already in a port's dependency list.

comment:54 in reply to:  53 Changed 11 years ago by larryv (Lawrence Velázquez)

Replying to egall@…:

Actually I just came up with another idea: would throwing something like the following into perl5's universal variant work?

if {![catch "registry_active libstdcxx"]} {
    depends_lib-append path:lib/.libstdcxx:libstdcxx
    require_active_variants path:lib/.libstdcxx:libstdcxx universal
}

This is with including the active_variants 1.1 port group somewhere earlier in the portfile of course. Also I'm adding the dependency on libstdcxx because I'm assuming that require_active_variants only works with ports that are already in a port's dependency list.

  1. As a dependency of a universal port, MacPorts would already make sure that libstdcxx was installed universal. So active_variants-1.1 would not be necessary.
  2. So then perl5.12 +universal would be recorded as being a dependent of libstdcxx, which it doesn’t use at all? No, this is not a viable workaround.

comment:55 in reply to:  53 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to egall@…:

Actually I just came up with another idea: would throwing something like the following into perl5's universal variant work?

if {![catch "registry_active libstdcxx"]} {
    depends_lib-append path:lib/.libstdcxx:libstdcxx
    require_active_variants path:lib/.libstdcxx:libstdcxx universal
}

This is with including the active_variants 1.1 port group somewhere earlier in the portfile of course. Also I'm adding the dependency on libstdcxx because I'm assuming that require_active_variants only works with ports that are already in a port's dependency list.

No. perl doesn't even use the libstdcxx port, so it should not be a dependency.

comment:56 in reply to:  37 ; Changed 11 years ago by neverpanic (Clemens Lang)

Cc: cal@… added

Replying to rmstonecipher@…:

Would making +universal a default variant for libstdcxx and other ports plagued by this problem be an acceptable solution?

This would however require people to build a lot of universal code they might not want or need. I'd like to object this proposal.

Replying to jeremyhu@…:

/opt/local/lib $ for f in *; do [[ -f /usr/lib/$f ]] && port provides /opt/local/lib/$f; done | sed 's/.*: //' | sort -u

This lists _all_ ports that provide libraries also shipped with OS X. Note that we only need to consider those that are being used without a dependency being specified. zlib or kerberos5 are not affected, because ports using them should declare a dependency on them, which would cause MacPorts to ensure they are present in the required architecture(s).

It seems we should rather find out why the linker is trying to use libstdc++. Is it an indirect dependency of something in the perl build process? Is it hard-coded into the ld64 source? While there are some hardcoded paths in the source, they point to /usr/lib and don't seem to cause this.

comment:57 in reply to:  56 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to cal@…:

Replying to rmstonecipher@…:

Would making +universal a default variant for libstdcxx and other ports plagued by this problem be an acceptable solution?

This would however require people to build a lot of universal code they might not want or need. I'd like to object this proposal.

Replying to jeremyhu@…:

/opt/local/lib $ for f in *; do [[ -f /usr/lib/$f ]] && port provides /opt/local/lib/$f; done | sed 's/.*: //' | sort -u

This lists _all_ ports that provide libraries also shipped with OS X. Note that we only need to consider those that are being used without a dependency being specified.

Not really. As I mentioned earlier, perl doesn't use libstdcxx. One of its dependencies (a *host* framework) uses the host libstdc++.dylib.

It seems we should rather find out why the linker is trying to use libstdc++. Is it an indirect dependency of something in the perl build process?

I forget what it was specifically, but something in either /usr/lib or /System/Library/Frameworks that perl was linking against has a link against /usr/lib/libstdc++.6.dylib

Is it hard-coded into the ld64 source?

What is the "it" that you are asking about here?

While there are some hardcoded paths in the source, they point to /usr/lib and don't seem to cause this.

It's the use of -L/opt/local/lib that is causing ld to resolve the /usr/lib/libstdc++.6.dylib link in an existing library to /opt/local/lib/libstdc++.6.dylib in much the same way that DYLD_LIBRARY_PATH operates at runtime for dyld.

comment:58 Changed 11 years ago by larryv (Lawrence Velázquez)

r105987 should fix this for perl5.12.

comment:59 Changed 11 years ago by larryv (Lawrence Velázquez)

r105992 is a preemptive strike against the other Perls. America wins again.

comment:60 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: wontfix
Status: assignedclosed

There's not really anything we can do about this. This is how the toolchain works...

libstdc++.6.dylib is one of the more common culprits, and with the libgcc change, I've moved it out of ${prefix}/lib into ${prefix}/lib/libgcc. For now, however, we still have a symlink present in ${prefix}/lib, so that doesn't help us (but maybe eventually we can get rid of the symlink).

comment:61 Changed 10 years ago by dstrubbe (David Strubbe)

Cc: dstrubbe@… added; dstrubbe@… removed

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

Duplicate #57541 is about libxar.1.dylib while building gts.

Note: See TracTickets for help on using tickets.