Linking error when cross-compiling for x86_64 iOS through Ansible

I'm attempting to cross-compile x86_64 iOS on either an x86_64 Mac, or an arm64 Mac through Ansible. When I manually ssh to one of my Mac machines, my cargo build executes successfully:

	rustup target add x86_64-apple-ios
	IPHONEOS_DEPLOYMENT_TARGET=15.0 cargo build \
		--target=x86_64-apple-ios \
		--release \
		--no-default-features

However, when I try running through Ansible on either machine, I get this error when trying to build my custom crate:

   error: linking with `cc` failed: exit status: 1
      |
...
libraries
...
Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
      = note: Undefined symbols for architecture x86_64:
                "_opendir$INODE64", referenced from:
                    _OPENSSL_DIR_read in libopenssl_sys-e6ef6c0b2f836fec.rlib(libcrypto-lib-o_dir.o)
                "_readdir$INODE64", referenced from:
                    _OPENSSL_DIR_read in libopenssl_sys-e6ef6c0b2f836fec.rlib(libcrypto-lib-o_dir.o)
              ld: symbol(s) not found for architecture x86_64
              clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've compared everything I can think of between my ssh and Ansible envs and have found them to be the same: Path var, xcodebuild sdks, OpenSSL, C path, Library path, perl, gcc, Rust version. There are no config files in the .cargo path in either scenario. Arm64 iOS has been building successfully in both scenarios. What could be wrong with x86_64 iOS?

Seems like the issue is that SDKROOT is being set to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk. I'll have to figure out what's doing this, and unset it.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.