Hello and my first question (regarding CMAKE_OSX_DEPLOYMENT_TARGET)

Michael Monschau michael at brainydata.co.uk
Sun Feb 27 11:37:16 UTC 2022


Thanks Ryan,

I just realised, I had this email sitting in my Drafts all this time. Never sent it.

I have actually not been able to try your suggestions to this day, as it works if I simply ignore the warnings, so it has not been a problem so far. I will return to this maybe during the summer as spring for me will be very busy.

Anyway, thanks again. I’ll be in touch.

Kind regards,
Michael

> On 6 Oct 2021, at 00:09, Ryan Schmidt <ryandesign at macports.org> wrote:
> 
> On Sep 28, 2021, at 05:09, Michael Monschau wrote:
>> 
>> Background:
>> I recently had the need to resort to some open software to add certain PDF manipulation features to one of my products. The open source tool I am using is podofo-0.9.7. That uses various other libraries including openssl. As part of my own XCode project I have to link against crypto.dylib (linking against the crypto.a library in XCode). 
>> Note: I am using 'port install' with the ‘+universal’ flag as I need universal libraries
>> 
>> The problem:
>> I am building the macports libraries that I need on macOS 11.4. However, I need the deployment target for my own xcode projects to be 10.13 and to avoid hundreds of link warnings which may push out important ones, I need to rebuild openssl with that deployment target set. I understand there is CMAKE_OSX_DEPLOYMENT_TARGET and I can do set(CMAKE_OSX_DEPLOYMENT_TARGET “10.13”), but I don’t know
>>    1. where I do this (I was thinking in '/opt/local/share/cmake-3.20/Modules/Platform/Darwin.cmake' but not sure)
>>    2. how to force the rebuilding from source using cmake of the openssl libraries via 'port install'
> 
> By default MacPorts builds for the current OS deployment target, i.e., if you are on macOS 11.x MacPorts builds for deployment target 11, and if you are on macOS 10.15.x MacPorts builds for deployment target 10.15.
> 
> You can instruct MacPorts to build for a different deployment target by editing macports.conf, e.g.
> 
> macosx_deployment_target 10.13
> 
> If you need to build using a different SDK, you can indicate that too:
> 
> macosx_sdk_version 10.13
> 
> You don't have the 10.13 SDK on a macOS 11 system by default, so you would need to get a copy and put it in the right place (/Library/Developer/CommandLineTools/SDKs/ for ports that build with the command line tools or /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ for ports that build with Xcode).
> 
> Because these are undocumented and seldom-used options, you may encounter ports that do not respect these settings. If so, that would be a bug that we should fix and you could file a bug report or pull request, just be prepared for the likelihood of encountering these problems.
> 
> By default MacPorts fetches binaries for ports when it can. Those binaries were built with default deployment target and SDK settings. If you are trying to create a MacPorts installation using different settings for those values, you should uninstall all ports and, before installing any ports, disable the use of binaries by setting "buildfromsource always" in macports.conf.
> 
> You may want to leave your default prefix /opt/local untouched so that it builds with default settings and receives binaries, and set up a second MacPorts prefix somewhere else, such as /opt/local10.13. That way you remember that you've given /opt/local10.13 special settings, and you retain /opt/local and are still able to receive binaries when installing ports that are unrelated to your 10.13 deployment target project.
> 
> Another option if you are just looking for binaries pre-built for specific OS versions is to download them from our packages server, assuming binaries are available. For example, the latest openssl we compiled for macOS 10.13 is currently http://packages.macports.org/openssl/openssl-1.1.1l_1.darwin_17.x86_64.tbz2
> 



More information about the macports-users mailing list