iOS Build Environment Help Center

fatal error: could not build module 'Foundation', error: redefinition of module 'libxml2', and more

append delete mobiledeveloper

Windows Version: Windows 10 22H2 Build 19045.3448
Builder Version: 3.59
iOS SDK Version: 17.0
Unity Version 2022.3.10f1

I'm trying to build my iOS game using the builder (like everyone else), and the build fails every time. I've tested this on a real Mac device, and it builds perfectly. My game uses no external SDKs or CocoaPods, just stock Unity with a few assets installed that are written in C#. It doesn't use ads or in-app purchases, and doesn't use any special iOS permissions (as far as I know).

I've tried:
- disabling code stripping in Unity and building a development build instead of a release one
- disabling the compiler cache and the "use all CPU cores" option in the builder
- switching from a release to a debug build in the builder

all of those just give me the same errors when I build.

Here are the build logs:
https://pmbaty.com/paste/?18ad0e1c086735d8#EsKe4YyBa1E7HQyaXNLU5s21GUkyJubiPTxZv3Wq53cg

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Hello

There are identified problems with the iOS 17 SDK, it's buggy because it defines the libxml module in several places. The next update of the builder will fix it. In the meantime, here's how to fix it yourself:

In the builder's install directory, overwrite the file called "SDK\usr\include\libxml2\libxml\module.modulemap" (which is a module *definition* file) with the "SDK\usr\include\libxml2\module.modulemap" one (which is a module *redirection* file). This way the compiler knows that libxml, libxml2 and libxml2\libxml are in fact the same module.

append delete #2. mobiledeveloper

Thanks for your help! When I build my game, it now gets past the original errors I was having. However, now it's failing with different errors, something like "Dependency not found".

Here are my build logs:
https://pmbaty.com/paste/?590169889e7bca11#7kpxwFjnQnxy7u47XWXtDPLuW6qAMdBnDBmz1d5hDJnb

append delete #3. Pierre-Marie Baty

Okay. This one is a "false positive", i.e. the dependency tool should not print that. Thank you for signaling me this problem. The reason is that a dynamic library used by your game claims a dependency on files at certain paths. But because on iOS, paths like xxxxx.framework/Versions/A/xxxxx are in fact a "symbolic link" to the xxxxx.framework/xxxxx files, and because on Windows, the iOS SDK is extracted without these symbolic links, such a dependency check fails.

I have added a test case in the validatedeps.exe tool so that it redirects those checks to the right place. Please download this fixed version from the URL below and put it in the builder's Toolchain directory, overwriting the old one. Then rebuild and let me know if the problem is solved.

Updated dependency checker: https://www.pmbaty.com/iosbuildenv/validatedeps.zip

append delete #4. mobiledeveloper

Windows Defender and VirusTotal both flag this file as a trojan. It's probably just a false positive but do you know why this might have been flagged?

https://www.virustotal.com/gui/file/7b79c81ee57043816e2547dfab304a5644063d73beec94eff25e1aae2889eddb/detection

append delete #5. Pierre-Marie Baty

Totally certainly a false positive.

These virus scanners rely on heuristics. Here they're coming across a file they never heard of yet, that contains references to paths to various iOS system libraries (necessarily, because the purpose of this tool is to check for iOS library dependencies). That's enough for these junk scanners to flag it as malware.

Sheesh.

If you want, I can provide you its source code (it's quite short) and you compile it yourself...

:: @Pierre-Marie Baty added on 22 Sep ’23 · 16:36

*edit* I'll recompile it and sign it digitally. Signed executables are usually much better tolerated by virus scanners.

:: @Pierre-Marie Baty added on 22 Sep ’23 · 16:40

*edit 2* Here it is, signed by me. You can download it again at the same URL. Let me know.

append delete #6. mobiledeveloper

Alright, I installed the new file. I'm now only getting one error.
Build logs: https://pmbaty.com/paste/?82edb97e52986c54#EsDUxwcxBNrRdyD5a7p2gnuHBU26DoyMYHbBvKNvtuc8

Thank you so much for your time.

append delete #7. Pierre-Marie Baty

Okay. I assumed that all symlinks patterns were .../Versions/A/... but looks like they enjoy using other letters of the alphabet :/ I have to handle that too.

The next one will be the right one ! Please get the 3rd version (same URL) and let me know if it passes this time.

append delete #8. mobiledeveloper

Thank you so much! It's fully working now, the build completed without errors.

append delete #9. Pierre-Marie Baty

Deployed and running OK too ?

append delete #10. mobiledeveloper

Works fine on my iPhone 7. I was using a development provisioning profile if that makes a difference.

append delete #11. Pierre-Marie Baty

Excellent. The fix will be in the next update. Meanwhile, those affected can download the fixed binary from this thread.

append delete #12. Oneday

Hello, simply chiming in to add that I was running into the same issues, and that the steps provided here also correctly worked for me. Thank you!

append delete #13. Pierre-Marie Baty

Version 3.60 should fix this problem automatically (provided you migrate the SDK with the updated migration assistants).

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty