Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

clang cannot be opened

Discussion in 'Editor & General Support' started by fabiotgarcia, Oct 13, 2019.

  1. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    After Update to MacOS Catalina I'm got this message when building on 2018.4.11 - NDK 16r

    “clang++” cannot be opened because the developer cannot be verified.

    How can we fix this?

    Best Regards,

    Fabio
     
  2. Billionaire91

    Billionaire91

    Joined:
    Jun 13, 2019
    Posts:
    2
    Same issue here.
     
  3. Billionaire91

    Billionaire91

    Joined:
    Jun 13, 2019
    Posts:
    2
    I just found the solution.

    It's a tedious process but:
    1. MacOS: Open up System Preferences
    2. MacOS: Go to Security & Privacy (keep this one open, you'll need it for the entire process)
    3. Unity: Go and build your project. When the error appears click "Cancel"
    4. MacOS: In the Security & Privacy window - go and click "Allow" near the "clang" error - so that the MacOS system will recognize the app and utilise it.
    5. Unity: The error will appear again, but this time will ask you to "Open" it. Click "Open"
    6. Unity: The build will fail several times due to various dependencies, but it will fail with different files that you will need to allow as in the previous steps.
    7. Unity: Build again your app.
    8. If it fails, do the steps again, until it stops failing. Every single error you get with the file not being recognized will be different each time
     
  4. TerrenceRao

    TerrenceRao

    Joined:
    Jun 19, 2015
    Posts:
    5
    Indeed Catalina is more strict about the permission of software, especially for those that you've downloaded from internet. MacOS Catalina is requiring participation in Apple's developer program specifically.
    so try this:

    Code (Shell):
    1. sudo spctl --master-disable
    to allow apps downloaded from Anywhere
     
    ocnenued, impark and phong-genix like this.
  5. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    The solution I found:

    Download Unity 2019.2.9 with Android SDK & NDK Tools + OpenJDK

    Open it and set the External Tools.

    Now you can open Unity 2018.4.11 and use the same paths.
     
    SweatyChair likes this.
  6. Squirenetic

    Squirenetic

    Joined:
    Nov 8, 2016
    Posts:
    4
    Easier way to go about it:

    Search in finder for clang & clang++ . You might find a couple of instances of each. Alt-option right-click on the file and press open. You will be presented with the same warning, but with the option to run the file anyway. From now on, it will run without warnings
     
  7. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    Thank you!
     
  8. phong-genix

    phong-genix

    Joined:
    Oct 28, 2015
    Posts:
    128
    Thank you.
     
  9. aurelien-morel-ubiant

    aurelien-morel-ubiant

    Joined:
    Sep 27, 2017
    Posts:
    275
    Some from unity provided this script to fix the issue :


    Code (CSharp):
    1. #!/bin/bash
    2. echo "Resetting Extended Attributes"
    3. sudo xattr -cr toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
    4. sudo xattr -cr toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
    5. sudo xattr -cr toolchains/llvm/prebuilt/darwin-x86_64/lib64/libc++.dylib
    6. sudo xattr -cr toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/ld.bfd
    7. sudo xattr -cr toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/ld.gold
    8. sudo xattr -cr toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-objcopy
    9. sudo xattr -cr toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip
    10. sudo xattr -cr toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.bfd
    11. sudo xattr -cr toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.gold
    12. sudo xattr -cr toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-objcopy
    13. sudo xattr -cr toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip
    14. sudo xattr -cr toolchains/x86-4.9/prebuilt/darwin-x86_64/i686-linux-android/bin/ld.bfd
    15. sudo xattr -cr toolchains/x86-4.9/prebuilt/darwin-x86_64/i686-linux-android/bin/ld.gold
    16. sudo xattr -cr toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-objcopy
    17. sudo xattr -cr toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-strip
    18. sudo xattr -cr toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-objcopy
    19. sudo xattr -cr toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-strip
    20. echo "Fixing NDK Signing"
    21. sudo codesign --force --deep --sign - toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
    22. sudo codesign --force --deep --sign - toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
    23. sudo codesign --force --deep --sign - toolchains/llvm/prebuilt/darwin-x86_64/lib64/libc++.dylib
    24. sudo codesign --force --deep --sign - toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/ld.bfd
    25. sudo codesign --force --deep --sign - toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/ld.gold
    26. sudo codesign --force --deep --sign - toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-objcopy
    27. sudo codesign --force --deep --sign - toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip
    28. sudo codesign --force --deep --sign - toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.bfd
    29. sudo codesign --force --deep --sign - toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.gold
    30. sudo codesign --force --deep --sign - toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-objcopy
    31. sudo codesign --force --deep --sign - toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip
    32. sudo codesign --force --deep --sign - toolchains/x86-4.9/prebuilt/darwin-x86_64/i686-linux-android/bin/ld.bfd
    33. sudo codesign --force --deep --sign - toolchains/x86-4.9/prebuilt/darwin-x86_64/i686-linux-android/bin/ld.gold
    34. sudo codesign --force --deep --sign - toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-objcopy
    35. sudo codesign --force --deep --sign - toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-strip
    36. sudo codesign --force --deep --sign - toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-objcopy
    37. sudo codesign --force --deep --sign - toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-strip
    put this at the root of the Android NDK folder and execute it with a terminal and it will be the end of your troubles.
     
    s_s_k, Gillissie and lucasblucas like this.
  10. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    645
    The issue is the quarantine extended attribute, which was ignored for command-line programs prior to macOS 10.15 but now triggers a signature check when the program is first run.

    The signing in the Unity provided example above is completely unnecessary, as it's only using an ad-hoc certificate, which does not meet Apple's requirements.

    All you need to do is removing the quarantine attribute. If the attribute doesn't exist, macOS does not verify signatures. The resetting code in Unity's example works but it's simpler to just do:
    Code (csharp):
    1. xattr -rd com.apple.quarantine PATH_TO_NDK
     
  11. aurelien-morel-ubiant

    aurelien-morel-ubiant

    Joined:
    Sep 27, 2017
    Posts:
    275
    But it works for us...
    And for us that kind of command was to use each time we reboot the Mac os. That's why we didn't so that kind of thing.
     
  12. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    200
    None of the suggestions in this thread have worked for me.

    There's no 'alt' key on a Mac.

    The clang error doesn't show up in the security & privacy window for me, nothing changes.

    I'm having to use the downloaded r19 NDK due to the one packaged in the latest version of the Unity in the Hub being wrong, this just gives a lot of file not found errors running it in the root. There is no clang file in darwin-x86_64/bin folder.
     
  13. OwlSoftware

    OwlSoftware

    Joined:
    Aug 10, 2019
    Posts:
    2
    Hi guys,

    I just ran into the same problem after updating to Catalina 10.5.4 for deploying on iOS phones ( I had to install xcode11.5 for the signature). For me the fix worked with
    sudo spctl --master-disable
    taking into consideration that I use Unity 2018.3.8f1
     
  14. phong-genix

    phong-genix

    Joined:
    Oct 28, 2015
    Posts:
    128
    This solution also works for me.
    macOS Catalina
    Unity 2018
     
    aurelien-morel-ubiant likes this.
  15. kimcatq

    kimcatq

    Joined:
    Jun 11, 2019
    Posts:
    9
    This also works for me too.
    - Unity 2018.4.10f1
    - Android NDK r16 (via Unity Editor above)
    - MacOS 10.15.4 (Catalina)
     
  16. hereoofthewild

    hereoofthewild

    Joined:
    Mar 27, 2020
    Posts:
    2
    What worked for me:

    - Open System Preferences
    - Open Security and Privacy
    - General Tab
    - (Bottom of Dialog was showing clang) Click Allow Anyways
     
  17. onelly23

    onelly23

    Joined:
    Sep 13, 2018
    Posts:
    4
    I'm having this error in windows, is there a script like this for windows pc?
     
  18. belghazi7

    belghazi7

    Joined:
    Aug 2, 2019
    Posts:
    1
    Thank you @Adrian, it worked for me
     
  19. veedub88

    veedub88

    Joined:
    Feb 21, 2018
    Posts:
    2
    I had to go into apple security a couple times to allow permissions. Including for ld.gold. After that, it worked.
     
  20. denisealex

    denisealex

    Joined:
    Dec 16, 2019
    Posts:
    1
    Thank you, @Billionaire91 !!
     
unityunity