Opened 4 years ago

Last modified 4 years ago

#62537 assigned defect

blueutil @2.8.0: Undefined symbols for architecture x86_64

Reported by: cooljeanius (Eric Gallager) Owned by: DanielO (Daniel O'Connor)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur Cc:
Port: blueutil

Description

I am on Big Sur using Xcode 12.4 and see the following error when attempting to build blueutil:

/usr/bin/clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=10.9 -framework Foundation -framework IOBluetooth -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64  blueutil.m   -o blueutil
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_NSJSONSerialization", referenced from:
      objc-class-ref in blueutil-a21618.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [blueutil] Error 1

Perhaps there is a missing linker flag or something?

Attachments (2)

blueutilmain.log (11.0 KB) - added by cooljeanius (Eric Gallager) 4 years ago.
main.log for blueutil
CLT_Library_Frameworks.txt (1.0 MB) - added by cooljeanius (Eric Gallager) 4 years ago.
terminal output from running some commands in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks

Download all attachments as: .zip

Change History (15)

comment:1 Changed 4 years ago by DanielO (Daniel O'Connor)

I tested the version I submitted on Big Sur with Xcode 12.4. I also just did a 'port selfupdate' and 'port build -s blueutil' and it built fine - the line which failed for you runs fine on my system.

comment:2 Changed 4 years ago by kencu (Ken)

make sure your command line tools match your Xcode. It's really easy to get out of sync.

comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: bigsur added

comment:4 Changed 4 years ago by mf2k (Frank Schima)

Cc: DanielO removed
Owner: set to DanielO
Status: newassigned

comment:5 in reply to:  2 Changed 4 years ago by cooljeanius (Eric Gallager)

Replying to DanielO:

I tested the version I submitted on Big Sur with Xcode 12.4. I also just did a 'port selfupdate' and 'port build -s blueutil' and it built fine - the line which failed for you runs fine on my system.

If that's the case then I wonder why the buildbot hasn't created a binary for me to download?

Replying to kencu:

make sure your command line tools match your Xcode. It's really easy to get out of sync.

OK I just did that and it still fails with the same error.

comment:6 Changed 4 years ago by kencu (Ken)

time to see the main.log

Changed 4 years ago by cooljeanius (Eric Gallager)

Attachment: blueutilmain.log added

main.log for blueutil

comment:7 Changed 4 years ago by kencu (Ken)

this jumps out mmacosx-version-min=10.9 and MACOSX_DEPLOYMENT_TARGET='11.2' both being set to different values, and there is an extra -isysroot (that shouldn't matter), but what I do in practice for these is go into the directory:

cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_blueutil/blueutil/work/toy-blueutil-f1ca51b

and then run the command manually, figuring out what works and what doesn't. Use sudo or chmod the files to make them writeable:

/usr/bin/clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=10.9 -framework Foundation -framework IOBluetooth -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64  blueutil.m   -o blueutil

comment:8 in reply to:  7 Changed 4 years ago by cooljeanius (Eric Gallager)

Replying to kencu:

this jumps out mmacosx-version-min=10.9 and MACOSX_DEPLOYMENT_TARGET='11.2' both being set to different values, and there is an extra -isysroot (that shouldn't matter), but what I do in practice for these is go into the directory:

cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_blueutil/blueutil/work/toy-blueutil-f1ca51b

and then run the command manually, figuring out what works and what doesn't. Use sudo or chmod the files to make them writeable:

/usr/bin/clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=10.9 -framework Foundation -framework IOBluetooth -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64  blueutil.m   -o blueutil

I did sudo su to log in as root and tried editing the command; adding some verbosity flags produces this:

$ /usr/bin/clang -g -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=11.2 -framework Foundation -framework IOBluetooth -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk blueutil.m -v -Wl,-v -o blueutil
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.2.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name blueutil.m -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.1 -target-cpu penryn -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 609.8 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Os -Wall -Wextra -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdebug-compilation-dir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_blueutil/blueutil/work/toy-blueutil-f1ca51b -ferror-limit 19 -fmessage-length 252 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.2.0 -fobjc-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/blueutil-62de69.o -x objective-c blueutil.m
clang -cc1 version 12.0.0 (clang-1200.0.32.29) default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 11.2.0 11.1 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o blueutil -framework Foundation -framework IOBluetooth -headerpad_max_install_names -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/blueutil-62de69.o -v -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld  PROJECT:ld64-609.8
BUILD 15:07:46 Dec 18 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_NSJSONSerialization", referenced from:
      objc-class-ref in blueutil-62de69.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$

Adding -Wl,-F/System/Library/Frameworks/ seems to work:

/usr/bin/clang -g -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=11.2 -framework Foundation -framework IOBluetooth -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-F/System/Library/Frameworks/ blueutil.m -v -Wl,-v -o blueutil
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.2.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name blueutil.m -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.1 -target-cpu penryn -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 609.8 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Os -Wall -Wextra -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdebug-compilation-dir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_blueutil/blueutil/work/toy-blueutil-f1ca51b -ferror-limit 19 -fmessage-length 252 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.2.0 -fobjc-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/blueutil-49ceee.o -x objective-c blueutil.m
clang -cc1 version 12.0.0 (clang-1200.0.32.29) default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 11.2.0 11.1 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o blueutil -framework Foundation -framework IOBluetooth -headerpad_max_install_names -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -F/System/Library/Frameworks/ /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/blueutil-49ceee.o -v -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld  PROJECT:ld64-609.8
BUILD 15:07:46 Dec 18 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
	/Library/Frameworks/
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil" -o blueutil.dSYM blueutil
$

Note that the -Wl, before the -F/System/Library/Frameworks/ is necessary because otherwise it fails with a different error:

$ /usr/bin/clang -g -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -Wall -Wextra -mmacosx-version-min=11.2 -framework Foundation -framework IOBluetooth -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -F/System/Library/Frameworks/ blueutil.m -v -Wl,-v -o blueutil
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.2.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name blueutil.m -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.1 -target-cpu penryn -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 609.8 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -F/System/Library/Frameworks/ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Os -Wall -Wextra -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdebug-compilation-dir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_blueutil/blueutil/work/toy-blueutil-f1ca51b -ferror-limit 19 -fmessage-length 252 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.2.0 -fobjc-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/blueutil-23f30c.o -x objective-c blueutil.m
clang -cc1 version 12.0.0 (clang-1200.0.32.29) default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /System/Library/Frameworks (framework directory)
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
blueutil.m:13:9: fatal error: 'IOBluetooth/IOBluetooth.h' file not found
#import <IOBluetooth/IOBluetooth.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
blueutil.m:13:9: note: did not find header 'IOBluetooth.h' in framework 'IOBluetooth' (loaded from '/System/Library/Frameworks')
1 error generated.
$

comment:9 Changed 4 years ago by kencu (Ken)

Any idea what is wrong here?

 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks

that seems to exist and should be giving you the same thing as

-Wl,-F/System/Library/Frameworks/

comment:10 Changed 4 years ago by kencu (Ken)

I vaguely recall some other person bringing up an issue with his system frameworks in the SDK in the past few weeks on BigSur. Can't recall right now who or what exactly.

comment:11 in reply to:  9 Changed 4 years ago by cooljeanius (Eric Gallager)

Replying to kencu:

Any idea what is wrong here?

 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks

that seems to exist and should be giving you the same thing as

-Wl,-F/System/Library/Frameworks/

Let me attach some terminal output...

Changed 4 years ago by cooljeanius (Eric Gallager)

Attachment: CLT_Library_Frameworks.txt added

terminal output from running some commands in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks

comment:12 Changed 4 years ago by cooljeanius (Eric Gallager)

Update: Trying to install blueutil today resulted in MacPorts successfully grabbing a binary of it from the build server... should I close this, or try building from source again to see if it still fails to build on my computer?

comment:13 Changed 4 years ago by kencu (Ken)

Well something seems to be not right, and as far as we can tell, it's limited to your system.

Who knows what? I could not tell from your console output what was wrong.

I would definitely try reinstalling from source, and if that fails again, reinstall Xcode or the CLTs or ??? until it is fixed locally... these things have a way of just coming around again...

Note: See TracTickets for help on using tickets.