1

Here is my recently created macOS app: https://github.com/evillt/macmineable-release
and here is my facing issue: https://github.com/evillt/macmineable-release/issues/18

I built the app on my machine it can run normally on any BigSur device, even M1 devices, but can not run on Catalina(10.15).

So what I want is to build a version that can run on multi-macOS-version with a single app.

Huge thanks for any suggestions!

update

My device is MacBook Pro 2015, Intel I5 chip, Big Sur 11.5.2.

I build this app on my device, it can run normally on:

  • My device
  • MacBook 12-inch Big Sur 11.0
  • Other M1 devices (Big Sur 11.0 or above)

But can not run on MacBook Pro Intel I7 Catalina 10.15.7. The issue here.

That is all I know.

3 Answers 3

2

You need to change the CC compile go uses during your builds.

 go env CC clang 

which most likely uses the version in /usr/bin/clang

if you have Xcode installed - or really just the Command Line Tools you can see a variety of versions for the last few major releases e.g.:

$ find /Library/Developer/CommandLineTools -name clang /Library/Developer/CommandLineTools/usr/bin/clang /Library/Developer/CommandLineTools/usr/lib/clang /Library/Developer/CommandLineTools/usr/lib/swift/clang /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/lib/clang /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/lib/clang /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/lib/clang /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang 

so to build against an older SDK like MaxOSX10.15, set CC to the explicit version you need for your go build like so:

CC=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang go build 
Sign up to request clarification or add additional context in comments.

7 Comments

Thanks but I got permission denied: cgo: C compiler "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang" not found: exec: "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang": permission denied
The error shows the binary is missing. Did you run the find command? It will show what alternative clang binaries are available. You also need to ensure you have the developer command line tools installed (an option available from with the Xcode IDE).
Yes, I have command line tools installed. Run find has similar output.
Try running the clang tool directly. Permission denied error suggests it's permission bits are not set to "executable" or maybe an intermediate path is not accessible from your user account?
run clang with error: no input files . I am new to Go so I do not know what the problem actually is.
|
1

I have good experience building as a Unix executable and packaging as a Mac app, by using the instructions manual at https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5

build Unix exec file go build -o bin/{program} {program} 

Packaging the application on macOS (Big Sur) and installing it on macOS (High Sierra) was successful.

Comments

0

Try the below one after another

  1. go env -w CC=clang
  2. go env -w GO111MODULE=off
  3. go build

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.