Skip to content
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

Building fat file for libj2objc_main.a #1979

Open
FrankManns opened this issue Dec 6, 2022 · 0 comments
Open

Building fat file for libj2objc_main.a #1979

FrankManns opened this issue Dec 6, 2022 · 0 comments

Comments

@FrankManns
Copy link

FrankManns commented Dec 6, 2022

Problem

The dist/lib/macosx/libj2objc_main.a file that is produced by the jre_emul Makefile only supports the architecture of the machine used to build J2Objc. This causes a linking error when invoking j2objcc.sh on a machine with a different architecture.

ld: warning: ignoring file /Users/example/j2objc/dist/lib/macosx/libj2objc_main.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

I found that I could successfully run j2objcc after I manually compiled jre_emul/Classes/J2ObjCMain.m for x86 and arm64, combined the two libs into a fat file, and then moved the fat file to dist/lib/macosx/libj2objc_main.a.

Given this, does it make sense to update the jre_emul Makefile to produce a fat file for libj2objc_main.a?

Steps to Reproduce

Build

export J2OBJC_ARCHS="macosx macosx64"
make dist

Inspect Libraries

$ find dist/lib/macosx -type f -exec lipo -info {} \;
Architectures in the fat file: dist/lib/macosx/libjre_core.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjunit.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_net.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_time.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_icu.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_file.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_beans.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_concurrent.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_sql.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libmockito.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjsr305.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libxalan.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_security.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_zip.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_xml.a are: x86_64 arm64 
Non-fat file: dist/lib/macosx/libj2objc_main.a is architecture: arm64
Architectures in the fat file: dist/lib/macosx/libjre_util.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_ssl.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjavax_inject.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libguava.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libguavaandroid.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_io.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_channels.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libtruth.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjre_emul.a are: x86_64 arm64 
Architectures in the fat file: dist/lib/macosx/libjson.a are: x86_64 arm64 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant