Setting environment and support of older OS/arch

Ken Cunningham ken.cunningham.webuse at
Fri Mar 17 13:07:27 UTC 2023

If you are doing your own compilation using the compilers and libraries from MacPorts, you need to direct your build to use the specified tools, headers, and libraries.

You can look at what MacPorts sets up itself for each build for a clue, for example this is setup for a generic build of something on an arm64 system running Ventura. 

You'd tweak this for a system running some other system like Leopard or Tiger, of course -- you can't just use this one.

you need to export all these environment variables in the shell before you start running your configure or make steps, so perhaps you might preface each one with "export " and make a shell script of this, to make it easier.

CFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64'
CPPFLAGS='-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk'
CXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64'
F90FLAGS='-pipe -Os -m64'
FCFLAGS='-pipe -Os -m64'
FFLAGS='-pipe -Os -m64'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64'
OBJCFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64'
OBJCXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64'

Now you might rightly say this is harder than putting everything in /usr/local, and why did MacPorts put everything in /opt/local and make it so hard to use?

And there you would see the primary reason that homebrew came to exist, 10 or 15 years ago.

But putting everything in /opt/local is actually defendable better in a number of ways, although does require a deeper level of understanding about what is doing on to make it work.

And don't even get me started about how to make MacPorts work with Xcode -- :>

Good luck, ask questions when you get stuck.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list