cc.get_define does not work when doing universal builds
See original GitHub issueDescribe the bug
cc.get_define uses $CFLAGS with -E. That is not legal. You should only be using $CPPFLAGS when using $CC -E.
Using $CFLAGS causes configure to fail when building a fat binary, eg mesa does:
cc.get_define('ETIME', prefix : '#include <errno.h>')
We setup our CFLAGS and run meson, eg:
$ CFLAGS="-arch x86_64 -arch arm64" meson build/
but this fails with the following shown in the meson log:
Command line: cc /var/folders/99/yp4q7wrs6ts8mlgwy6njn6280000gn/T/tmpl8i1u1kl/testfile.c -pipe -E -P -arch x86_64 -arch arm64 -P -O0 -std=c11
Code:
#include <errno.h>
#ifndef ETIME
# define ETIME
#endif
"MESON_GET_DEFINE_DELIMITER"
ETIME
Compiler stdout:
Compiler stderr:
clang: error: cannot use 'cpp-output' output with multiple -arch options
system parameters
- Is this a cross build or just a plain native build (for the same computer)? Native
- what operating system? macOS 11
- what Python version? 3.8.7
- what
meson --version
? 0.55.3 - what
ninja --version
if it’s a Ninja build ? 1.10.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Xcode won't build for universal binary - Apple Developer
I am porting a macOS Objective-C app from just Intel silicon to universal binary -- Intel and Apple silicon both -- using Xcode...
Read more >https://tangentsoft.com/pidp8i/vpatch?from=7ce3553...
+ +If you do not give this flag at `configure` time with these hardware ... +define defaultprefix /opt/pidp8i + +use cc + +options...
Read more >Universal make-based build system design - Stack Overflow
I have begin to develop a similar system for my own C projects, but the logic I use does rely on some features...
Read more >Universal Storage 1.4.0.0 (For KSP 1.4.x) 13th March 2018 - Page 25
Update on the elektron (and other generators, which is currently the Sabatier and the Fuel Cell). I can fix the small numbers problem...
Read more >Diff - 8671348b81b95fc603505dfc881b45103bee1731^1 ...
To make sure UTF-8 is + # always used, use `io.open(filename, mode, ... + "comparing object representation of type %0 which does not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
On MacPorts we use your existing cross-file system, and set up one build for each arch, with cross-files for each arch we support. Then we lipo them together at the end.
This works for now, for us.
But if you made it work transparently such that cross-files were not needed, all the better.
Just to update, we have cross-files for
ppc
andppc64
now. That works, mostly. Some issues remain, like withgobject-introspection
on 10.5.8 (ppc+ppc64) and on 10.6.8 (ppc via Rosetta).See for example: https://github.com/mesonbuild/meson/pull/10442 A suboptimal fix for Rosetta build: https://github.com/mesonbuild/meson/issues/10351#issuecomment-1131530681