[MacPorts] #54332: Support for setting Deployment Target and Base SDK

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
#54332: Support for setting Deployment Target and Base SDK
-------------------------+-------------------
 Reporter:  ssisak       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  base         |    Version:  2.4.1
 Keywords:               |       Port:
-------------------------+-------------------
 I'm using macports to build static libraries (i.e. ffmpeg and its
 dependencies) which will eventually be linked into an embedded framework
 in an application that may be deployed on multiple platforms, including
 systems older than the one I'm building on. In this case I'd like to build
 on 10.12 and deploy on 10.9 or later.

 In Xcode, I'd just set MACOSX_DEPLOYMENT_TARGET=10.9 and be done.

 It appears that macports had a similar macports.conf feature
 (universal_target) which was removed, linking back to
 https://trac.macports.org/changeset/30396

 Looking for a way to set this so that I don't get errors linking static
 libraries built with macorts into a framework with a different deployment
 target for instance:

 {{{
 ld: warning: object file
 (/Users/sgs/GotoReplay/Source/gotoreplay/Common/IOXMediaFoundation/FFmpeg/local/lib/libavutil.a(dict.o))
 was built for newer OSX version (10.12) than being linked (10.9)
 }}}

 There are also valid reasons to set SDKROOT

--
Ticket URL: <https://trac.macports.org/ticket/54332>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+--------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  closed
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:  invalid      |   Keywords:
      Port:               |
--------------------------+--------------------
Changes (by ryandesign):

 * status:  new => closed
 * resolution:   => invalid


Old description:

> I'm using macports to build static libraries (i.e. ffmpeg and its
> dependencies) which will eventually be linked into an embedded framework
> in an application that may be deployed on multiple platforms, including
> systems older than the one I'm building on. In this case I'd like to
> build on 10.12 and deploy on 10.9 or later.
>
> In Xcode, I'd just set MACOSX_DEPLOYMENT_TARGET=10.9 and be done.
>
> It appears that macports had a similar macports.conf feature
> (universal_target) which was removed, linking back to
> https://trac.macports.org/changeset/30396
>
> Looking for a way to set this so that I don't get errors linking static
> libraries built with macorts into a framework with a different deployment
> target for instance:
>
> {{{
> ld: warning: object file
> (/Users/sgs/GotoReplay/Source/gotoreplay/Common/IOXMediaFoundation/FFmpeg/local/lib/libavutil.a(dict.o))
> was built for newer OSX version (10.12) than being linked (10.9)
> }}}
>
> There are also valid reasons to set SDKROOT

New description:

 I'm using macports to build static libraries (i.e. ffmpeg and its
 dependencies) which will eventually be linked into an embedded framework
 in an application that may be deployed on multiple platforms, including
 systems older than the one I'm building on. In this case I'd like to build
 on 10.12 and deploy on 10.9 or later.

 In Xcode, I'd just set MACOSX_DEPLOYMENT_TARGET=10.9 and be done.

 It appears that macports had a similar macports.conf feature
 (universal_target) which was removed, linking back to r30396

 Looking for a way to set this so that I don't get errors linking static
 libraries built with macorts into a framework with a different deployment
 target for instance:

 {{{
 ld: warning: object file
 (/Users/sgs/GotoReplay/Source/gotoreplay/Common/IOXMediaFoundation/FFmpeg/local/lib/libavutil.a(dict.o))
 was built for newer OSX version (10.12) than being linked (10.9)
 }}}

 There are also valid reasons to set SDKROOT

--

Comment:

 You can set `macosx_deployment_target` and `macosx_sdk_version` in
 macports.conf. They're undocumented because not all ports honor these
 settings.

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
In reply to this post by MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+----------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  reopened
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------
Changes (by ssisak):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 Replying to [comment:1 ryandesign]:
 > You can set `macosx_deployment_target` and `macosx_sdk_version` in
 macports.conf. They're undocumented because not all ports honor these
 settings.

 Thanks, gave it a try and doesn't appear reliable: someone is linking
 agains the wrong C++ libraries (see errors below).

 In general, this is something that ports shouldn't have to be aware of as
 it's at the compiler/linker level.

 The problem is that Apple guarantees forward, but not backward ABI
 compatibilty unless the deployment target is set for the oldest supported
 OS.

 I'll reopen as a feature request, but understand if resolution is "Can't
 do it because CMAKE sucks".

 Showing All Errors Only
    "vtable for __cxxabiv1::__si_class_type_info", referenced from:


       typeinfo for x265::SEIContentLightLevel in libx265.a(encoder.cpp.o)


       typeinfo for x265::SEIMasteringDisplayColorVolume in
 libx265.a(encoder.cpp.o)


       typeinfo for x265::SEIuserDataUnregistered in
 libx265.a(encoder.cpp.o)


       typeinfo for x265::SEIActiveParameterSets in
 libx265.a(encoder.cpp.o)


       typeinfo for x265::Bitstream in libx265.a(bitstream.cpp.o)


       typeinfo for x265::WorkerThread in libx265.a(threadpool.cpp.o)


       typeinfo for x265::SEIBufferingPeriod in
 libx265.a(ratecontrol.cpp.o)


       ...


   NOTE: a missing vtable usually means the first non-inline virtual member
 function has no definition.


   "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:


       typeinfo for x265::SEI in libx265.a(encoder.cpp.o)


       typeinfo for x265::SEI in libx265.a(ratecontrol.cpp.o)


       typeinfo for x265::FrameEncoder in libx265.a(frameencoder.cpp.o)


       typeinfo for x265::SEI in libx265.a(frameencoder.cpp.o)


       typeinfo for x265::FrameFilter::ParallelFilter in
 libx265.a(framefilter.cpp.o)


   NOTE: a missing vtable usually means the first non-inline virtual member
 function has no definition.


   "operator delete[](void*)", referenced from:


       x265::Encoder::destroy() in libx265.a(encoder.cpp.o)


       x265::FrameEncoder::destroy() in libx265.a(frameencoder.cpp.o)


       x265::Frame::destroy() in libx265.a(frame.cpp.o)


       x265::Lookahead::destroy() in libx265.a(slicetype.cpp.o)


       x265::FrameFilter::destroy() in libx265.a(framefilter.cpp.o)


       x265::FrameData::destroy() in libx265.a(framedata.cpp.o)


       x265::SAOParam::~SAOParam() in libx265.a(framedata.cpp.o)


       ...


   "operator delete(void*)", referenced from:


       _x265_encoder_open_116 in libx265.a(api.cpp.o)


       _x265_encoder_close in libx265.a(api.cpp.o)


       x265::Encoder::destroy() in libx265.a(encoder.cpp.o)


       x265::Encoder::encode(x265_picture const*, x265_picture*) in
 libx265.a(encoder.cpp.o)


       x265::Encoder::computeSPSRPSIndex() in libx265.a(encoder.cpp.o)


       x265::SEIContentLightLevel::~SEIContentLightLevel() in
 libx265.a(encoder.cpp.o)


 x265::SEIMasteringDisplayColorVolume::~SEIMasteringDisplayColorVolume() in
 libx265.a(encoder.cpp.o)


       ...


   "operator new[](unsigned long)", referenced from:


       x265::Encoder::encode(x265_picture const*, x265_picture*) in
 libx265.a(encoder.cpp.o)


       x265::ThreadPool::allocThreadPools(x265_param*, int&, bool) in
 libx265.a(threadpool.cpp.o)


       x265::FrameEncoder::init(x265::Encoder*, int, int) in
 libx265.a(frameencoder.cpp.o)


       x265::FrameEncoder::threadMain() in libx265.a(frameencoder.cpp.o)


       x265::FrameEncoder::compressFrame() in libx265.a(frameencoder.cpp.o)


       x265::SAO::allocSaoParam(x265::SAOParam*) const in
 libx265.a(sao.cpp.o)


       x265::Frame::create(x265_param*, float*) in libx265.a(frame.cpp.o)


       ...


   "operator new(unsigned long)", referenced from:


       _x265_encoder_open_116 in libx265.a(api.cpp.o)


       x265::Encoder::create() in libx265.a(encoder.cpp.o)


       x265::Encoder::encode(x265_picture const*, x265_picture*) in
 libx265.a(encoder.cpp.o)


       x265::Encoder::computeSPSRPSIndex() in libx265.a(encoder.cpp.o)


       x265::FrameEncoder::init(x265::Encoder*, int, int) in
 libx265.a(frameencoder.cpp.o)


       x265::FrameEncoder::threadMain() in libx265.a(frameencoder.cpp.o)


       x265::SAO::startSlice(x265::Frame*, x265::Entropy&) in
 libx265.a(sao.cpp.o)


       ...


   "___cxa_guard_acquire", referenced from:


       x265::RateControl::rateEstimateQscale(x265::Frame*,
 x265::RateControlEntry*) in libx265.a(ratecontrol.cpp.o)


       x265::Deblock::getBoundaryStrength(x265::CUData const*, int,
 unsigned int, unsigned char const*) in libx265.a(deblock.cpp.o)


   "___cxa_guard_release", referenced from:


       x265::RateControl::rateEstimateQscale(x265::Frame*,
 x265::RateControlEntry*) in libx265.a(ratecontrol.cpp.o)


       x265::Deblock::getBoundaryStrength(x265::CUData const*, int,
 unsigned int, unsigned char const*) in libx265.a(deblock.cpp.o)


   "___cxa_pure_virtual", referenced from:


       vtable for x265::BondedTaskGroup in libx265.a(frameencoder.cpp.o)


       vtable for x265::Thread in libx265.a(threading.cpp.o)


       vtable for x265::BondedTaskGroup in libx265.a(slicetype.cpp.o)


       vtable for x265::BondedTaskGroup in libx265.a(framefilter.cpp.o)


       vtable for x265::BondedTaskGroup in libx265.a(search.cpp.o)


       vtable for x265::BondedTaskGroup in libx265.a(analysis.cpp.o)


       vtable for x265::WaveFront in libx265.a(wavefront.cpp.o)


       ...


   "___dynamic_cast", referenced from:


       x265::FrameEncoder::threadMain() in libx265.a(frameencoder.cpp.o)


       x265::Entropy::finishSlice() in libx265.a(frameencoder.cpp.o)


   "_clock_gettime", referenced from:


       _av_gettime_relative in libavutil.a(time.o)


       _av_gettime_relative in libavutil.a(time.o)


       _av_gettime_relative_is_monotonic in libavutil.a(time.o)


   "_kVDADecoderConfiguration_Height", referenced from:

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
In reply to this post by MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+----------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  reopened
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------

Comment (by raimue):

 Since this is an undocumented option in macports.conf, you should also not
 expect this to be tested much. In this case, it looks like you have to
 dive into x265 to find out why it is being linked the wrong way. Note the
 cmake port group already passes `-DCMAKE_OSX_DEPLOYMENT_TARGET=...` and
 `-DCMAKE_OSX_SYSROOT=...`. Check that these configure options have the
 values you expect. Of course, patches to make ports honor the SDK
 selection are welcome and will be applied.

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
In reply to this post by MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+----------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  reopened
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------

Comment (by ssisak):

 Replying to [comment:3 raimue]:
 >Of course, patches to make ports honor the SDK selection are welcome and
 will be applied.

 Thanks -- will give that a try eventually. Note that this was a small
 chunk of the errors, there are multiple ports misbehaving.

 Need to evaluate if it will be quicker for my own need so just build the
 binary on a machine running 10.9 or require a MacPorts install on the
 target machine (which means I can't just ship an application).

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
In reply to this post by MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+--------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  closed
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:  invalid      |   Keywords:
      Port:               |
--------------------------+--------------------
Changes (by raimue):

 * status:  reopened => closed
 * resolution:   => invalid


Comment:

 As I noticed x265 has no other dependencies, I just gave it a spin and it
 works for me.

 {{{
 macosx_deployment_target 10.9
 macosx_sdk_version 10.12
 }}}

 {{{
 ports/multimedia/x265 $ sudo port -v destroot
 ...
 ports/multimedia/x265 $ otool -l work/destroot/opt/local/lib/libx265.dylib
 |grep -B1 -A3 LC_VERSION_MIN_MACOSX
 Load command 8
       cmd LC_VERSION_MIN_MACOSX
   cmdsize 16
   version 10.9
       sdk 10.12
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54332: Support for setting Deployment Target and Base SDK

MacPorts
In reply to this post by MacPorts
#54332: Support for setting Deployment Target and Base SDK
--------------------------+--------------------
  Reporter:  ssisak       |      Owner:
      Type:  enhancement  |     Status:  closed
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.4.1
Resolution:  invalid      |   Keywords:
      Port:               |
--------------------------+--------------------

Comment (by ssisak):

 It BUILDS fine -- those errors come from linking the static .a into a
 private Framework that deploys on 10.9

 (Errors are from linking the .a with the framework)

 The test would be to link the .a built by MacPorts into an application
 built targeting 10.9

 My intent here is to build a static copy of FFmpeg into an embeddable
 framework (including some nice Objective-C/Swift wrappers) which can be
 open-sourced to comply with GPL2.

 I also occurred to me that some of those errors might be the result of the
 framework not having C++, so let me check that as well.

--
Ticket URL: <https://trac.macports.org/ticket/54332#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS