question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cc.get_define does not work when doing universal builds

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kencucommented, Feb 9, 2021

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.

0reactions
barracuda156commented, Jul 22, 2022

for interest, here are the three cross-files we use so far (the PPC one I haven’t set up yet).

Just to update, we have cross-files for ppc and ppc64 now. That works, mostly. Some issues remain, like with gobject-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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found