Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#15750 closed defect (fixed)

build libxml2 with two-level namespace

Reported by: ghosthound Owned by: ghosthound
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc: 0xced (Cédric Luthi), ryandesign (Ryan Schmidt), rene@…
Port:

Description

Attached patch makes libxml2 build with two-level namespace (at least for me, on 10.5.3 x86). This will likely fix the problems reported in tickets #14063 and #15263.

Attachments (1)

libxml2.fixTwoLevel.diff (571 bytes) - added by ghosthound 9 years ago.
patch file for libxml2 Portfile

Download all attachments as: .zip

Change History (24)

Changed 9 years ago by ghosthound

patch file for libxml2 Portfile

comment:1 Changed 9 years ago by jmroot (Joshua Root)

  • Cc cedric.luthi@… added
  • Milestone set to Port Bugs

Cc maintainer.

comment:2 Changed 9 years ago by 0xced (Cédric Luthi)

Wow, seems like magic :-) Can you please point out exactly what is the consequence of re-running the autotools that solves tickets #14063 and #15263 ? Have you done a diff of the produced configure and Makefiles that would explain what is fixed ?

comment:3 Changed 9 years ago by ghosthound

Well, it is related to auto*/configure/libtool, so it is kinda magic (the dark kind...).

Something in the libxml2 package (sorry, I'm not remembering what it was for libxml2, been diving into too many different packages recently) doesn't understand which rev. of Mac OS X (darwin) its running on (and doesn't seem to pick up MACOSX_DEPLOYMENT_TARGET to know), so sets -flat_namespace. This results in binaries linked against MP libxml2 that will pull in both MP libxml2 (via the linking they have) and the system-installed libxml2 (via other libs they use, including system frameworks). Then while running the binary will call functions in the "wrong" libxml2, resulting in crashes.

Redoing the autoconf stuff teaches/fixes "it" (configure or libtool I think) to not include -flat_namespace, and all is good.

You can check if a dylib is built with two-level namespace with:

otool -hv PATH/TO/LIBRARY

and look in the 'flags' section, there should be a 'TWOLEVEL' word in there if it was built with two-level namespace.

-eric

comment:4 Changed 9 years ago by 0xced (Cédric Luthi)

Thanks for the explanation Eric. Except for the misalignment of "yes" and "autoreconf", the patch is OK for me ;-)

comment:5 Changed 9 years ago by ghosthound

Err, 'misalignment' of "yes" and "autoreconf"? Are you saying you'd like the autoreconf.cmd line to be above the use_autoconf line? I can commit the fix if you'd like, let me know.

comment:6 Changed 9 years ago by ghosthound

  • Owner changed from macports-tickets@… to ricci@…
  • Status changed from new to assigned

comment:7 follow-up: Changed 9 years ago by ghosthound

  • Resolution set to fixed
  • Status changed from assigned to closed

committed patch as-is in r38015, please let me know if something should be changed ('misalignment' ?)

comment:8 Changed 9 years ago by jmroot (Joshua Root)

The misalignment referred to is that the right hand column in the autoconf.cmd and use_autoconf lines is two spaces to the left of the right hand columns in the rest of the file.

comment:9 Changed 9 years ago by ghosthound

Ah. Fixed in r38022 (as I said there: (no, I don't know how I didn't see that before, thnx to those who pointed it out))

comment:10 in reply to: ↑ 7 Changed 9 years ago by ryandesign (Ryan Schmidt)

Replying to ricci@macports.org:

committed patch as-is in r38015

This fixed #15263 as well.

comment:11 Changed 9 years ago by ghosthound

  • Resolution fixed deleted
  • Status changed from closed to reopened

Just helped somebody out w/ building libxml2 - they didn't have libtool installed by macports, and the libxml2 build failed (configure was all sorts of unhappy). Installing libtool (from MP) resolved the problem. Unless there's an objection, I'll add a dependency on libtool to libxml2.

comment:12 Changed 9 years ago by 0xced (Cédric Luthi)

I think libtool should be installed and/or updated by MacPorts itself when a port has use_autoconf yes. I thought it was the case, but it was not (cf your previous message and #15900).

comment:13 Changed 9 years ago by ghosthound

  • Resolution set to fixed
  • Status changed from reopened to closed

fixed in r38175

comment:14 Changed 9 years ago by 0xced (Cédric Luthi)

Wow, not that many time to object. ;-) But in the mean time, adding the dependency is indeed a good idea!

comment:15 Changed 9 years ago by ghosthound

Well, it was mostly your clearance I was looking for. With another ticket open on it, no rebuild issues (revision bump or anything like that), and it fixes a build problem for people, it seemed like the right idea. We can always back it out if there's a problem with it.

comment:16 Changed 9 years ago by 0xced (Cédric Luthi)

Yes sure, it was the right thing to do for now. I just meant that ports using use_autoconf yes should not have to explicitly also declare depends_build port:libtool because this should be handled by MacPorts itself. We should file another ticket for that.

comment:17 Changed 9 years ago by ryandesign (Ryan Schmidt)

  • Cc ryandesign@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

I don't know whether libxml2 needs a dependency on libtool. I know that it does need a build-time dependency on port:autoconf since you're now using the autoreconf command that the autoconf port provides.

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

  • Resolution set to fixed
  • Status changed from reopened to closed

Changed the dependency from libtool to autoconf in r39322.

comment:19 Changed 9 years ago by rene@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

I just installed libxml2 with a fresh MP installation. The port libxml2 failed to build due to the lack of libtool related macros for autoconf. Installing port:libtool fixed it. I think the libtool dependency is required since it provides share/aclocal/libtool.m4.

comment:20 Changed 9 years ago by rene@…

  • Cc rene@… added

CC me!

comment:21 Changed 9 years ago by ryandesign (Ryan Schmidt)

Sorry about that. I won't be able to readd the libtool dependency until tomorrow night. If someone else can commit the change before then, please do.

comment:22 Changed 9 years ago by rene@…

  • Resolution set to fixed
  • Status changed from reopened to closed

Committed in r39551.

comment:23 Changed 8 years ago by anonymous

  • Milestone Port Bugs deleted

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.