[LV2] OT: 32-bit Build on OSX

Robin Gareus robin at gareus.org
Wed Nov 26 12:27:46 PST 2014


On 11/26/2014 08:25 PM, David Robillard wrote:
> On 2014-11-26 09:29, Michael R. Fisher wrote:
> [...]
>> Hello you want these flags pretended to your waf configure command:
>>
>> CFLAGS="-arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" ./waf configure ......
>>
>> This will give you a universal binary compatible with 32bit and 64 bit hosts. If you want 32bit only just remove the appropriate -arch flags.

even though PPC is rare these days to be "universal" you at least need
-arch i386 -arch ppc -arch x86_64
and -arch -ppc64 for good measure.

> Thanks, Michael.  I will look into adding --32 --64 and --universal
> options to the configure script so it's obvious how to do this from the
> help output.  Perhaps universal should be the default for OSX?

Why? A local user does not need it. People building it as dylib for
inclusion in project-bundles will (or should) know better.

Well, one can always use lipo(1) to strip architectures from a .dylib
again. That's useful for big projects where libs+binaries for one
architecture alone are > 100MB. (a universal build would blow that up to
400MB or more). Besides most people these days only want (or need) x86_64.

Sadly, waf does not have a properly maintained abstraction for OSX
builds. Something self-made is bound to be more trouble than useful.
It took auto* years to get all this right. Even cmake is not quite there
yet. I recommend against adding this to the wscript (or autowaf)
of a specific project unless you're prepared to go all the way and
maintain it as well.

Related things that come to mind:

arch permutations of i386 x86_64 ppc ppc64

-headerpad_max_install_names link-flag if the libraries are intended for
re-location or to become part of an app-bundle where you need to change
the ID. see install_name_tool(1).

permutations of C/CXXFLAGS
-DMAC_OS_X_VERSION_MAX_ALLOWED=1040 -mmacosx-version-min=10.4
to currently
-DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -mmacosx-version-min=10.8
depending on deployment target and build-host clang vs gcc peculiarities.

If the lib in question has python bindings it's even a bit more
complicated (-arch does not work there, you need
VERSIONER_PYTHON_PREFER_32_BIT etc as well).


What's wrong with using CFLAGS LDFLAGS CC CXX and other
environment-variable with waf?

Expecting ./waf configure --generic # to do the right thing for a
library is IMHO foolish.

If you don't like it, create an xcode project. the Xcode GUI has
options for all of the above and more.  The only other viable
alternative for libraries today would be autotools+m4.


> Anyone know what the corresponding flags are for MSVC?

Same thing really. add a MSCV project or leave it to the user of the
library to things sort out via variables.

2c,
robin


More information about the Devel mailing list