-
Notifications
You must be signed in to change notification settings - Fork 158
Add support for Apple M1 build #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I don't think this works.
|
|
Any progress? |
|
@Demogorgon314 I have a build running with these properties https://github.com/marschall/exception-counter/blob/master/src/nar/apple.arm.aol.properties |
898f108 to
d7e6ba9
Compare
|
@Demogorgon314 @marschall Updated the original suggested config from @mondain based on feedback, linker name I still don't have a mac to test it, but seems to be logically more on target now. |
d7e6ba9 to
8e4d842
Compare
|
I would like to be able to produce a Universal Binary on macOS, see: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary I have an existing plugin configuration for building x86_64 on macOS x86_64 like this: <plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.10.2-SNAPSHOT</version>
<extensions>true</extensions>
<executions>
<execution>
<id>compile-native</id>
<phase>compile</phase>
<goals>
<goal>nar-validate</goal>
<goal>nar-compile</goal>
</goals>
<configuration>
<java>
<include>true</include>
<link>false</link>
</java>
<libraries>
<library>
<type>executable</type>
<run>false</run>
<linkCPP>false</linkCPP>
</library>
</libraries>
<c>
<clearDefaultOptions>true</clearDefaultOptions>
<options>
<option>-arch</option>
<option>x86_64</option>
<option>-mmacosx-version-min=10.9</option>
<option>-fobjc-exceptions</option>
<option>-std=c99</option>
<option>-DLIBJLI_DYLIB="${java.home}/jre/lib/jli/libjli.dylib"</option>
<option>-c</option> <!-- NOTE: compile only, don't link at this stage! -->
</options>
</c>
<linker>
<options>
<option>-framework</option>
<option>Cocoa</option>
<option>-mmacosx-version-min=10.9</option>
</options>
</linker>
</configuration>
</execution>
</executions>
</plugin>I am guessing that I should be able to have two compilation executions, one for Whilst it is easy to cross-compile for arm64 macOS on an x86_64 macOS machine, I can't seem to figure out how to do it using the <option>-arch</option>
<option>arm64</option>However I get the following errors: However running file shows that an arm64 binary is produced, i.e.: Any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes are needed in practice
| aarch64.MacOSX.gpp.fortran.includes=**/*.f **/*.for | ||
| aarch64.MacOSX.gpp.fortran.excludes= | ||
|
|
||
| aarch64.MacOSX.gpp.java.include=include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be include;include/darwin
| aarch64.MacOSX.gpp.fortran.compiler=gfortran | ||
| aarch64.MacOSX.gpp.fortran.defines=Darwin GNU_GCC | ||
| aarch64.MacOSX.gpp.fortran.options=-Wall -fno-automatic -fno-second-underscore | ||
| aarch64.MacOSX.gpp.fortran.includes=**/*.f **/*.for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be **/*.f **/*.for **/*.f90
| aarch64.MacOSX.gpp.c.compiler=gcc | ||
| aarch64.MacOSX.gpp.c.defines=Darwin GNU_GCC | ||
| aarch64.MacOSX.gpp.c.options=-Wall -Wno-long-long -Wpointer-arith -Wconversion | ||
| aarch64.MacOSX.gpp.c.includes=**/*.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be **/*.c **/*.m
| aarch64.MacOSX.gpp.cpp.compiler=g++ | ||
| aarch64.MacOSX.gpp.cpp.defines=Darwin GNU_GCC | ||
| aarch64.MacOSX.gpp.cpp.options=-Wall -Wno-long-long -Wpointer-arith -Wconversion | ||
| aarch64.MacOSX.gpp.cpp.includes=**/*.cc **/*.cpp **/*.cxx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be **/*.cc **/*.cpp **/*.cxx **/*.mm
8e4d842 to
89eb856
Compare
As per discussion on #371
@syhily @mondain