Discussion:
Fixes for Darwin in bootstrap-mk-files
Xiyue Deng
2014-05-29 00:59:32 UTC
Permalink
Hi,

Building libexecinfo on my Mac OS X 10.9 it fails. After some digging
it looks like pkgsrc doesn't handle Darwin correctly. I have proposed
a serious of fixes in PR/48842. A summary of changes is the following:

* Add OBJECT_FMT "MACH-O", and replace all misused "ELF" on Darwin.
* Fix flags (-dynamiclib, -force_load) and extensions (.dylib).

The relevant patches are attached here as well.

This is a rather big change to the infrastructure, and obviously it
needs more work. Comments are very welcome.

Thanks.
PHO
2014-05-29 04:39:49 UTC
Permalink
From: Xiyue Deng <***@gmail.com>
Subject: [pkgsrc-users] Fixes for Darwin in bootstrap-mk-files
Date: Wed, 28 May 2014 17:59:32 -0700
Post by Xiyue Deng
Hi,
Building libexecinfo on my Mac OS X 10.9 it fails. After some digging
it looks like pkgsrc doesn't handle Darwin correctly. I have proposed
* Add OBJECT_FMT "MACH-O", and replace all misused "ELF" on Darwin.
* Fix flags (-dynamiclib, -force_load) and extensions (.dylib).
The relevant patches are attached here as well.
This is a rather big change to the infrastructure, and obviously it
needs more work. Comments are very welcome.
Thanks.
Looks almost good, but -force_load is not really equivalent to
--whole-archive. While --whole-archive is a nullary switch to start
including every object in archive files until --no-whole-archive
comes, -force_load is an unary option takes one archive file at a
time, so

(GNU) % ld --whole-archive libfoo.a libbar.a libbaz.a --no-whole-archive

is equivalent to

(Apple) % ld -force_load libfoo.a -force_load libbar.a -force_load libbaz.a

Secondly, Apple ld came with old MacOS X (< 10.6; I think) didn't have
the -force_load option. GNU Libtool emulates it by manually unpacking
archives and passing objects directly to the linker in that case:
http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n7727


Thanks,
_______________________________________________________
- PHO - http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254 4D1A 14E7 9CA7 1A86 EF72
Xiyue Deng
2014-05-29 09:41:37 UTC
Permalink
Hi,
Post by PHO
Subject: [pkgsrc-users] Fixes for Darwin in bootstrap-mk-files
Date: Wed, 28 May 2014 17:59:32 -0700
Post by Xiyue Deng
Hi,
Building libexecinfo on my Mac OS X 10.9 it fails. After some digging
it looks like pkgsrc doesn't handle Darwin correctly. I have proposed
* Add OBJECT_FMT "MACH-O", and replace all misused "ELF" on Darwin.
* Fix flags (-dynamiclib, -force_load) and extensions (.dylib).
The relevant patches are attached here as well.
This is a rather big change to the infrastructure, and obviously it
needs more work. Comments are very welcome.
Thanks.
Looks almost good, but -force_load is not really equivalent to
--whole-archive. While --whole-archive is a nullary switch to start
including every object in archive files until --no-whole-archive
comes, -force_load is an unary option takes one archive file at a
time, so
(GNU) % ld --whole-archive libfoo.a libbar.a libbaz.a --no-whole-archive
is equivalent to
(Apple) % ld -force_load libfoo.a -force_load libbar.a -force_load libbaz.a
Understood. For this particular case, it looks like ${SOLIB} can only
be one static library so it should be safe (correct me if I'm wrong).
Post by PHO
Secondly, Apple ld came with old MacOS X (< 10.6; I think) didn't have
the -force_load option. GNU Libtool emulates it by manually unpacking
http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n7727
It looks like bootstrap/README.MacOSX marks version 10.5 and below as
IGNORED, though I'm open to suggestions to support those systems.
Frankly, I suppose software should use
autotools/cmake/other-more-robust-build-systems instead.

Thanks for the comments.
Post by PHO
Thanks,
_______________________________________________________
- PHO - http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254 4D1A 14E7 9CA7 1A86 EF72
PHO
2014-05-31 05:51:11 UTC
Permalink
Hi,


From: Xiyue Deng <***@gmail.com>
Subject: Re: [pkgsrc-users] Fixes for Darwin in bootstrap-mk-files
Date: Thu, 29 May 2014 02:41:37 -0700
Post by Xiyue Deng
Post by PHO
Looks almost good, but -force_load is not really equivalent to
--whole-archive. While --whole-archive is a nullary switch to start
including every object in archive files until --no-whole-archive
comes, -force_load is an unary option takes one archive file at a
time, so
(GNU) % ld --whole-archive libfoo.a libbar.a libbaz.a --no-whole-archive
is equivalent to
(Apple) % ld -force_load libfoo.a -force_load libbar.a -force_load libbaz.a
Understood. For this particular case, it looks like ${SOLIB} can only
be one static library so it should be safe (correct me if I'm wrong).
Indeed. You're right.
Post by Xiyue Deng
Frankly, I suppose software should use
autotools/cmake/other-more-robust-build-systems instead.
That's so true. libexecinfo should be libtoolized. There's no point in
spending much effort duplicating its functionality IMO.


Thanks,
_______________________________________________________
- PHO - http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254 4D1A 14E7 9CA7 1A86 EF72
Amitai Schlair
2014-07-05 15:45:06 UTC
Permalink
Post by PHO
That's so true. libexecinfo should be libtoolized. There's no point in
spending much effort duplicating its functionality IMO.
I've done this mechanically and without thinking. It seems to be good
enough to help on OS X 10.9, but definitely hurts on NetBSD 6.1:

http://www.netbsd.org/~schmonz/libexecinfo-libtoolize.diff

If anyone would like to prepare a more thoughtful diff, that would be
quite welcome!
Amitai Schlair
2014-07-05 20:27:30 UTC
Permalink
Post by Amitai Schlair
Post by PHO
That's so true. libexecinfo should be libtoolized. There's no point in
spending much effort duplicating its functionality IMO.
I've done this mechanically and without thinking. It seems to be good
With a tiny bit of thinking I managed to do much better, and committed:

http://mail-index.netbsd.org/pkgsrc-changes/2014/07/05/msg108196.html

Fixing the .mk files we provide for Darwin as the OP proposed is
probably also still a good idea, since there are still other packages
using BSD-style makefiles.
PHO
2014-07-19 14:59:32 UTC
Permalink
From: Amitai Schlair <***@schmonz.com>
Subject: Re: [pkgsrc-users] Fixes for Darwin in bootstrap-mk-files
Date: Sat, 5 Jul 2014 16:27:30 -0400
Post by Amitai Schlair
Post by Amitai Schlair
Post by PHO
That's so true. libexecinfo should be libtoolized. There's no point in
spending much effort duplicating its functionality IMO.
I've done this mechanically and without thinking. It seems to be good
http://mail-index.netbsd.org/pkgsrc-changes/2014/07/05/msg108196.html
Great! It worked properly on my Darwin/PPC 9.8.0 box.

Thanks,
_______________________________________________________
- PHO - http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254 4D1A 14E7 9CA7 1A86 EF72

Loading...