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

Tried to make this work and failed :-( #5

Open
nfrydenholm opened this issue Oct 5, 2021 · 1 comment
Open

Tried to make this work and failed :-( #5

nfrydenholm opened this issue Oct 5, 2021 · 1 comment

Comments

@nfrydenholm
Copy link

Hi

I have tried to follow your impressive blog post to make this arm64 simulator hack work on Googles "AFSNative" framework
(https://developers.google.com/custom-search-ads/ios/afsnative)

I was hoping you might be able to point me in the right direction of where I've failed along the way?

I did the file command and saw the 4 architectures are all there.

The lipo to get the arm64 and extracting that also went just fine.

Now, with the folder full of .o files, I went on doing the following (but to be honest I'm not completely sure if that is in fact the next step).
for file in *.o; do arm64-to-sim $file; done;

I didn't see any errors while doing this, so I went on with this
ar crv ../AFSNative.arm64-reworked *.o

But that part did not go so well. I get this kind of error
object: ../AFSNative.arm64-reworked(aligned_new_bca0ac320467a2457b3e306bfed17856.o) malformed object (section contents at offset 640 with a size of 312, overlaps Mach-O headers at offset 0 with a size of 648)

I did notice your section that says

The process requires performing extensive checks to confirm each object is a valid executable, and, thankfully, yields detailed errors. If we made any mistakes or omissions in our offset reconstructions, ar will tell us which section is faulty and what is it overlapping with. From here, we just need to keep hammering on the edits in our code.

But I'm not really sure what parts to look into changing to fix these errors (or if the errors appear, because I didn't do the initial steps correct 🤷 ).

Any ideas/hints to move on with this would be much appreciated.

@bogo
Copy link
Owner

bogo commented Feb 7, 2022

Sorry for the delay on this! Not sure if you ever got around to fixing this, but it seems like you are trying to apply the static library conversion on the dynamic framework:

/Users/bogo/Downloads/Google-AFSNative-1.0.4/Frameworks/AFSNative.framework/AFSNative: Mach-O universal binary with 4 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] [arm_v7] [arm64]
/Users/bogo/Downloads/Google-AFSNative-1.0.4/Frameworks/AFSNative.framework/AFSNative (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/Users/bogo/Downloads/Google-AFSNative-1.0.4/Frameworks/AFSNative.framework/AFSNative (for architecture i386):	Mach-O dynamically linked shared library i386
/Users/bogo/Downloads/Google-AFSNative-1.0.4/Frameworks/AFSNative.framework/AFSNative (for architecture armv7):	Mach-O dynamically linked shared library arm_v7
/Users/bogo/Downloads/Google-AFSNative-1.0.4/Frameworks/AFSNative.framework/AFSNative (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

The vtool method described in the dylib edition should help!

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

2 participants