ios-example-app icon indicating copy to clipboard operation
ios-example-app copied to clipboard

Can't build and run the ios-example-app in xcode due to readonly file asn1rt_nif.so

Open adiibanez opened this issue 10 months ago • 4 comments

The file elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so always ends up with read permissions only at xcodebuild time no matter what I try. Where does the library come from?

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: file: /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so is not writable (Permission denied)

19:28:21.198 [warning] There is no package config defined. Using the generic Elixir App descriptions. Running: /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/elixir-app/_build/ios_prod/rel/default_release/erts-15.2.2/bin/erlexec -emu_name_exit Running: strip -x -S /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/elixir-app/_build/ios_prod/rel/default_release/erts-15.2.2/bin/beam.smp Running: strip -x -S /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: file: /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so is not writable (Permission denied) ** (MatchError) no match of right hand side value: {"", 1} (desktop_deployment 1.0.0) lib/tooling.ex:124: Desktop.Deployment.Tooling.cmd!/2 (desktop_deployment 1.0.0) lib/tooling.ex:80: Desktop.Deployment.Tooling.strip_symbols/1 (desktop_deployment 1.0.0) lib/package/macos.ex:12: anonymous fn/2 in Desktop.Deployment.Package.MacOS.import_extra_files/1 (elixir 1.18.2) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3 (desktop_deployment 1.0.0) lib/package/macos.ex:12: Desktop.Deployment.Package.MacOS.import_extra_files/1 (desktop_deployment 1.0.0) lib/deployment.ex:36: Desktop.Deployment.generate_installer/1 (mix 1.18.2) lib/mix/tasks/release.ex:1079: Mix.Tasks.Release.run_steps/1 (mix 1.18.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5

** BUILD FAILED **

The following build commands failed: PhaseScriptExecution Run\ Script /Users/adrianibanez/Documents/projects/2024_sensor-platform/checkouts/elixir-desktop-ios-example-app/build/todoapp.build/Release-iphoneos/todoapp.build/Script-EC8A1FD6270B4EF900054F1C.sh (in target 'todoapp' from project 'todoapp') (1 failure) adrianibanez@Adrians-MacBook-Pro elixir-desktop-ios-example-app % ls -lah elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so -r--r--r-- 1 adrianibanez staff 51K 26 Feb 19:28 elixir-app/_build/ios_prod/rel/default_release/lib/asn1-5.3.1/priv/lib/asn1rt_nif.so

adiibanez avatar Feb 26 '25 18:02 adiibanez

There is a mixup here in the ios-example-app with the desktop_installer. The desktop_installer is responsible for creating the .exe/.dmg style installers for Windows, Linux, MacOS but it shouldn't be used for the Android and iOS builds. The ios-example-app I believe is not calling into it but rather using the run_mix and has probably a "mobile" target.

That said I think the obvious way to simplify this would be to make the desktop_installer aware of the MIX_TARGET=ios/android targets and then do the "right" thing instead of running the normal macos functions which break your build here.

dominicletz avatar Mar 04 '25 21:03 dominicletz

To be more specific strip from your error output should never be called. This is only needed when packaging the runtime for desktop environments - for mobile environments all needed native binaries are already in the xcode/android studio project.

dominicletz avatar Mar 04 '25 21:03 dominicletz

I got rid of the error by disabling stripping temporarily.

The only elixir / desktop related command included in run_mix is

mix release --overwrite

somehow the desktop_installer is invoked too nevertheless. any specific configuration required? Resp. where is the desktop specific processing triggered?

adiibanez avatar Mar 05 '25 16:03 adiibanez

mix release will trigger the desktop installer if that is hooked in your release target as one of the steps.

dominicletz avatar Mar 13 '25 14:03 dominicletz