Opened 4 years ago

Closed 4 years ago

#42843 closed defect (fixed)

dmalloc @5.5.2 +universal: dylibs are not actually universal

Reported by: cooljeanius (Eric Gallager) Owned by: tobypeterson
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc:
Port: dmalloc

Description

I have the +universal variant active:

Local-Admins-MacBook-Pro:~ ericgallager$ port installed dmalloc
The following ports are currently installed:
  dmalloc @5.5.2_0+universal (active)

but only some the files that it installs are actually universal:

Local-Admins-MacBook-Pro:~ ericgallager$ port -q contents dmalloc | xargs /usr/bin/file
/opt/local/bin/dmalloc:               Mach-O universal binary with 2 architectures
/opt/local/bin/dmalloc (for architecture x86_64):	Mach-O 64-bit executable x86_64
/opt/local/bin/dmalloc (for architecture i386):	Mach-O executable i386
/opt/local/include/dmalloc.h:         ASCII c program text
/opt/local/lib/libdmalloc.a:          Mach-O universal binary with 2 architectures
/opt/local/lib/libdmalloc.a (for architecture x86_64):	current ar archive random library
/opt/local/lib/libdmalloc.a (for architecture i386):	current ar archive random library
/opt/local/lib/libdmalloc.dylib:      Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libdmallocth.a:        Mach-O universal binary with 2 architectures
/opt/local/lib/libdmallocth.a (for architecture x86_64):	current ar archive random library
/opt/local/lib/libdmallocth.a (for architecture i386):	current ar archive random library
/opt/local/lib/libdmallocth.dylib:    Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libdmallocthcxx.a:     Mach-O universal binary with 2 architectures
/opt/local/lib/libdmallocthcxx.a (for architecture x86_64):	current ar archive random library
/opt/local/lib/libdmallocthcxx.a (for architecture i386):	current ar archive random library
/opt/local/lib/libdmallocthcxx.dylib: Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libdmallocxx.a:        Mach-O universal binary with 2 architectures
/opt/local/lib/libdmallocxx.a (for architecture x86_64):	current ar archive random library
/opt/local/lib/libdmallocxx.a (for architecture i386):	current ar archive random library
/opt/local/lib/libdmallocxx.dylib:    Mach-O 64-bit dynamically linked shared library x86_64

double-checking with lipo -info shows similar results:

Local-Admins-MacBook-Pro:~ ericgallager$ port -q contents dmalloc | xargs /usr/bin/file | grep "Mach-O" | cut -d: -f1 | cut -d\  -f1 | uniq | xargs lipo -info
Architectures in the fat file: /opt/local/bin/dmalloc are: x86_64 i386 
Architectures in the fat file: /opt/local/lib/libdmalloc.a are: x86_64 i386 
Architectures in the fat file: /opt/local/lib/libdmallocth.a are: x86_64 i386 
Architectures in the fat file: /opt/local/lib/libdmallocthcxx.a are: x86_64 i386 
Architectures in the fat file: /opt/local/lib/libdmallocxx.a are: x86_64 i386 
Non-fat file: /opt/local/lib/libdmalloc.dylib is architecture: x86_64
Non-fat file: /opt/local/lib/libdmallocth.dylib is architecture: x86_64
Non-fat file: /opt/local/lib/libdmallocthcxx.dylib is architecture: x86_64
Non-fat file: /opt/local/lib/libdmallocxx.dylib is architecture: x86_64

This makes it difficult to make other ports with +universal variants build properly against dmalloc.

Change History (5)

comment:1 follow-up: Changed 4 years ago by ryandesign (Ryan Schmidt)

  • Cc toby@… removed
  • Owner changed from macports-tickets@… to toby@…

I see that -arch flags are used by the build, except when building the dylibs. This is the typical behavior of a configure script that was generated with a version of autoconf too old to know about universal binaries. The normal solution would be to add "use_autoreconf yes" to the Portfile. There are two issues preventing this:

  1. The port has a patch for the configure script. It looks like this could be easily changed to patch configure.ac instead.
  2. autoreconf fails.

comment:2 in reply to: ↑ 1 Changed 4 years ago by cooljeanius (Eric Gallager)

Replying to ryandesign@…:

I see that -arch flags are used by the build, except when building the dylibs. This is the typical behavior of a configure script that was generated with a version of autoconf too old to know about universal binaries. The normal solution would be to add "use_autoreconf yes" to the Portfile. There are two issues preventing this:

  1. The port has a patch for the configure script. It looks like this could be easily changed to patch configure.ac instead.

Yup.

  1. autoreconf fails.

Looking into this now, and the configure.ac file seems to have a lot of custom logic in it that messes with the defaults... sigh... anyways, working on it...

comment:3 Changed 4 years ago by tobypeterson

Yeah, I suspect autoreconf is a bit much for this, patching configure directly is probably a lot easier.

comment:4 Changed 4 years ago by tobypeterson

r118267 - bumped revision because it changes how the dylibs are linked even if you aren't using +universal

comment:5 Changed 4 years ago by tobypeterson

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.