Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling A Project That Uses Tao #9

Open
TheDarkula opened this issue May 3, 2022 · 6 comments
Open

Compiling A Project That Uses Tao #9

TheDarkula opened this issue May 3, 2022 · 6 comments
Labels
question Further information is requested

Comments

@TheDarkula
Copy link

I am trying to compile this.

Running this:

env CC="o64-clang" CXX="o64-clang++" cargo build --locked --target x86_64-apple-darwin

yields this error:

error: could not find native static library `carbon_hotkey_binding.a`, perhaps an -L flag is missing?

error: could not compile `tao` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

The relevant C files are here.

I also tried to build that file directly with o64-clang carbon_hotkey_binding.c -o carbon_hotkey_binding.a -v:

Debian clang version 11.0.1-2
Target: x86_64-apple-darwin21.1
Thread model: posix
InstalledDir: /usr/bin
 "/usr/lib/llvm-11/bin/clang" -cc1 -triple x86_64-apple-macosx10.14.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name carbon_hotkey_binding.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-rounding-math -munwind-tables -target-sdk-version=12.0 -fcompatibility-qualified-id-block-type-checking -target-cpu penryn -debugger-tuning=lldb -target-linker-version 609 -v -resource-dir /usr/lib/llvm-11/lib/clang/11.0.1 -isystem /usr/lib/llvm-11/bin/../lib/clang/11.0.1/include -isysroot /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk -cxx-isystem /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/usr/include/c++/v1 -internal-isystem /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/usr/local/include -internal-isystem /usr/lib/llvm-11/lib/clang/11.0.1/include -internal-externc-isystem /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/usr/include -Wno-liblto -fdebug-compilation-dir /root/src/tao-tao-v0.8.3/src/platform_impl/macos/carbon_hotkey -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fmax-type-align=16 -fcolor-diagnostics -o /tmp/carbon_hotkey_binding-873a40.o -x c carbon_hotkey_binding.c
clang -cc1 version 11.0.1 based upon LLVM 11.0.1 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/usr/local/include"
ignoring nonexistent directory "/usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/Library/Frameworks"
ignoring duplicate directory "/usr/lib/llvm-11/bin/../lib/clang/11.0.1/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/llvm-11/bin/../lib/clang/11.0.1/include
 /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/usr/include
 /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/usr/local/osxcross/target/bin/x86_64-apple-darwin21.1-ld" -demangle -lto_library /usr/lib/llvm-11/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 10.14.0 12.0 -syslibroot /usr/local/osxcross/target/bin/../SDK/MacOSX12.0.sdk -o carbon_hotkey_binding.a /tmp/carbon_hotkey_binding-873a40.o -lSystem
Undefined symbols for architecture x86_64:
  "_GetApplicationEventTarget", referenced from:
      _install_event_handler in carbon_hotkey_binding-873a40.o
      _register_hotkey in carbon_hotkey_binding-873a40.o
  "_GetEventParameter", referenced from:
      _hotkey_handler in carbon_hotkey_binding-873a40.o
  "_InstallEventHandler", referenced from:
      _install_event_handler in carbon_hotkey_binding-873a40.o
  "_RegisterEventHotKey", referenced from:
      _register_hotkey in carbon_hotkey_binding-873a40.o
  "_RemoveEventHandler", referenced from:
      _uninstall_event_handler in carbon_hotkey_binding-873a40.o
  "_UnregisterEventHotKey", referenced from:
      _unregister_hotkey in carbon_hotkey_binding-873a40.o
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there something really simple I am missing here?

@joseluisq
Copy link
Owner

joseluisq commented May 4, 2022

It looks like not related with this Docker image but your dependency though.
Maybe what you are looking for is this one https://github.com/tauri-apps/tao/blob/dev/build.rs and this tauri-apps/tao#246

@joseluisq joseluisq added the question Further information is requested label May 4, 2022
@joseluisq
Copy link
Owner

joseluisq commented May 4, 2022

35c121e kind of relates to this issue.
However I have tried ginkou-loader but without success due to Macos Carbon API missing.

$ docker run --rm -it -v $PWD/tao/src/platform_impl/macos/carbon_hotkey/:/root/src \
    joseluisq/rust-linux-darwin-builder:latest \
    sh -c "x86_64-apple-darwin21.1-clang -mmacosx-version-min=10.12 carbon_hotkey_binding.c"
# Undefined symbols for architecture x86_64:
#  "_GetApplicationEventTarget", referenced from:
#      _install_event_handler in carbon_hotkey_binding-c35d9e.o
#      _register_hotkey in carbon_hotkey_binding-c35d9e.o
#  "_GetEventParameter", referenced from:
#      _hotkey_handler in carbon_hotkey_binding-c35d9e.o
#  "_InstallEventHandler", referenced from:
#      _install_event_handler in carbon_hotkey_binding-c35d9e.o
#  "_RegisterEventHotKey", referenced from:
#      _register_hotkey in carbon_hotkey_binding-c35d9e.o
#  "_RemoveEventHandler", referenced from:
#      _uninstall_event_handler in carbon_hotkey_binding-c35d9e.o
#  "_UnregisterEventHotKey", referenced from:
#      _unregister_hotkey in carbon_hotkey_binding-c35d9e.o
#  "_main", referenced from:
#     implicit entry/start for main executable
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)

@TheDarkula
Copy link
Author

I just built an image with your latest Dockerfile.

Following that, I jumped into a container with this: docker run -it joseluisq/rust-linux-darwin-builder:latest /bin/bash.

I ran your command, x86_64-apple-darwin21.1-clang -mmacosx-version-min=10.12 carbon_hotkey_binding.c, which gave the same error that you pasted.

I am confused, though, because here, you include your SDK package, which then ends up in /usr/local/osxcross/target/SDK/MacOSX12.0.sdk

This archive includes the Carbon framework, here: /usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/:

$ ls -la /usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/
total 8
drwxr-xr-x 2 503 root   38 May  4 17:05 .
drwxr-xr-x 5 503 root   72 May  4 17:05 ..
-rw-r--r-- 1 503 root 1078 Nov  2  2021 Carbon.h
-rw-r--r-- 1 503 root  743 Nov  2  2021 Carbon.r

I also installed ripgrep in the container, and ran rg GetApplicationEventTarget /usr/local/osxcross/, which shows this:

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/A/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Carbon.tbd
136:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/A/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon.tbd
136:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/Current/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/Current/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon.tbd
136:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/A/HIToolbox.tbd
64:                       _FrontNonFloatingWindow, _FrontWindow, _GetApplicationEventTarget, 

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/A/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/Headers/MacApplication.h
329: *    GetApplicationEventTarget. In Mac OS X 10.5, you can use this API

/usr/local/osxcross/target/SDK/MacOSX12.0.sdk/System/Library/Frameworks/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEvents.h
14950: *  GetApplicationEventTarget()
14969:GetApplicationEventTarget(void)                               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
15098:      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
15136:        SendEventToEventTarget( (e), GetApplicationEventTarget() )

@TheDarkula
Copy link
Author

Here is something curious.

I ran these two steps:

        - name: Clone Tao
          run: git clone https://github.com/tauri-apps/tao

        - name: Build
          run: pushd tao/src/platform_impl/macos/carbon_hotkey; clang -v -mmacosx-version-min=10.12 carbon_hotkey_binding.c; popd

on a native macos machine, and it gave me the exact same errors.

@joseluisq
Copy link
Owner

Maybe you could try to reach the Tao folk asking for some advice.

@joseluisq
Copy link
Owner

@TheDarkula should we close this issue now that it seems was solved upstream? Isn't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants