-1

I'm trying to get rid of linker-signed out of my xxx.dylib. So according to this, I added -no_adhoc_codesign to linker flag with -DCMAKE_SHARED_LINKER_FLAGS="-no_adhoc_codesign" but it seems clang has no idea about this flag. ld does have this option

clang: error: unknown argument: '-no_adhoc_codesign'

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --version
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
isudfv
  • 179
  • 1
  • 9
  • How exactly are you invoking clang? Can you show the actual command. – john Aug 02 '22 at 08:10
  • `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -fuse-ld=ld -stdlib=libc++ .... -dynamiclib -Wl,-headerpad_max_install_names -no_adhoc_codesign -o output/xxx.dylib` It's from Clion run – isudfv Aug 02 '22 at 08:12
  • 1
    try `-Wl,-no_adhoc_codesign` to pass the option directly to the linker – Alan Birtles Aug 02 '22 at 08:12

1 Answers1

0

You can use -Wl,-no_adhoc_codesign to pass the option directly to the linker if the compiler doesn't support adding the option itself.

Alan Birtles
  • 32,622
  • 4
  • 31
  • 60