chase / awrit

A full graphical web browser for Kitty terminal with mouse and keyboard support
Other
431 stars 14 forks source link

Build failing on macOS #27

Closed laher closed 8 months ago

laher commented 11 months ago

This is on a Silicon mac (Ventura 13.5.2).

Build dependencies as follows:

$ brew list --versions |egrep '(cmake|ninja)'
cmake 3.27.6
ninja 1.11.1
$ xcodebuild -version 
Xcode 15.0
Build version 15A240d

The Ninja command succeeded (cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -S . -B build).

Then:

$ cmake --build build

[5/218] Building CXX object libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o
FAILED: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCEF_USE_SANDBOX -DWRAPPING_CEF_SHARED -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I/Users/xxx/dl/awrit/build/_deps/cef_minimal-src -O3 -DNDEBUG -std=gnu++20 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.13 -fno-strict-aliasing -fstack-protector -funwind-tables -fvisibility=hidden -Wall -Werror -Wextra -Wendif-labels -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter -mmacosx-version-min=10.13 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fobjc-call-cxx-cdtors -fvisibility-inlines-hidden -std=c++17 -Wno-narrowing -Wsign-compare -Wno-undefined-var-template -O3 -MD -MT libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -MF libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o.d -o libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -c /Users/xxx/dl/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc
In file included from /Users/xxx/dl/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc:5:
In file included from /Users/xxx/dl/awrit/build/_deps/cef_minimal-src/include/base/cef_ref_counted.h:53:
/Users/xxx/dl/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:7: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);
      ^
/Users/xxx/dl/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:32: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);

I tried upgrading CEF_VERSION in CMakeLists.txt and following my nose. It seemed to get a bit further but I soon gave up once there weren't any more helpful messages.

chase commented 11 months ago

Bumping CEF or downgrading to an older SDK are your two options. If after upgrading CEF to the latest it still provides that exact same log, assume you have to use an older SDK. That error is caused by Apple deprecating something CEF uses.

If you're unfamiliar with how to use multiple versions of the SDK, the least intrusive way is to download Xcode 14.3 then before you run any commands, use export DEVELOPER_DIR=/Applications/Xcode14.3.app/Contents/Developer where /Applications/Xcode14.3.app is the path to the extracted Xcode.

laher commented 11 months ago

Hi Chase, I think you're right, Apple have been changing their SDKs. They did recently update their default linker to something called 'ldprime' so maybe that's part of the problem. I don't know though, I have never tried building this project before. Possibly it'd be enough just to ignore the warnings for now - I don't know how you do that though.

By the way - just to share some enthusiasm - this project looks amazing and I hope to use it to embed some browser-based functionality into some terminal apps. At the moment I'm launching an external browser and it's a bit clunky....

So I did try to upgrade CEF, but I didn't get far. For the record, this is what I tried:

  1. Updating the CEF version in CMakeLists.txt

    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    -set(CEF_VERSION 113.1.4+g327635f+chromium-113.0.5672.63)
    +set(CEF_VERSION 116.0.27+gd8c85ac+chromium-116.0.5845.190)
    # TODO: fetch the checksum from the CDN itself
    set(CEF_WIN_64_SHA 7717bbae3043ce99b761764e7754430b079dea7a)
    set(CEF_LINUX_64_SHA fc51b4b80cdf961947b386407fe411a32cc043fa)
    -set(CEF_MAC_ARM64_SHA a537fea97d388131a0718b3b4622b02260bcd9ae)
    +set(CEF_MAC_ARM64_SHA 8f1f296da1ad24cebd4543e75a6175a9ad502884)
  2. cmake complained about an unrecognised type char16 and recommended char16_t, so I did this:

--- a/awrit/input_event_handler.cc +++ b/awrit/input_event_handler.cc @@ -119,7 +119,7 @@ if(['textarea', 'input'].includes(document.activeElement.tagName.toLowerCase()))

  1. This is what it tells me. I'm out of my depth at this point, so I'll leave it up to someone more knowledgable:
    [1/1] Linking CXX executable awrit/Release/awrit.app/Contents/MacOS/awrit
    FAILED: awrit/Release/awrit.app/Contents/MacOS/awrit
    &&
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
    -O3 -DNDEBUG -arch arm64 -isysroot .... [truncated]
    ld: warning: ignoring duplicate libraries: 'awrit/string/libstring.a'
    ninja: build stopped: subcommand failed.

Cheers

On Sun, 24 Sept 2023 at 09:29, Chase Colman @.***> wrote:

Might have to bump the CEF version to the latest, seems like basically Apple deprecated an API it uses. If that works, I'd appreciate a PR.

— Reply to this email directly, view it on GitHub https://github.com/chase/awrit/issues/27#issuecomment-1732403347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA6XFLUG7U6W7WN66PNENLX35BBXANCNFSM6AAAAAA5DY5LEE . You are receiving this because you authored the thread.Message ID: @.***>

blueneogeo commented 10 months ago

same issue on M1 mac. perhaps for the meantime provide a release build that was built on an older platform if possible?

chase commented 10 months ago

I have an M2 with macOS 12, it builds fine. The SDK needs to be set to Xcode 14.3.1 with: export DEVELOPER_DIR=/Applications/Xcode14.3.1.app/Contents/Developer. Sonoma breaks a lot of things in general, so that might be a part of it.

same issue on M1 mac. perhaps for the meantime provide a release build that was built on an older platform if possible?

Not possible at the moment. You'll have to wait until Q1 2024. https://github.com/actions/runner-images/issues/8439#issuecomment-1755601587

Will M1 runners be available for free for public projects? I just tried to use it and got:

The job was not started because recent account payments have failed or your spending limit needs to be increased. Please check the 'Billing & plans' section in your settings.

This will happen but the date is TBD. GitHub is responsible for the provisioning of all Mac hardware in Azure data centers. Our team is ramping up capacity in preparation for GA in Jan-Mar 2024 timeframe. Once we reach the GA milestone, we will start working on additional plans to support open source, along with new macOS runners.

blueneogeo commented 10 months ago

Thank you for checking and the response.

VSuryaPrashanth commented 9 months ago

Thanks, I got it working using that method

blueneogeo commented 9 months ago

How did you guys do this? I tried downloading 14.3.1 from Apple Developer and set export DEVELOPER_DIR=/Applications/Xcode14.3.1.app/Contents/Developer but I still get these errors when trying to build:

❯ cmake --build build
[1/211] Building CXX object libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o
FAILED: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCEF_USE_SANDBOX -DWRAPPING_CEF_SHARED -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I/Users/christian/development/awrit/build/_deps/cef_minimal-src -O3 -DNDEBUG -std=gnu++20 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.13 -fno-strict-aliasing -fstack-protector -funwind-tables -fvisibility=hidden -Wall -Werror -Wextra -Wendif-labels -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter -mmacosx-version-min=10.13 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fobjc-call-cxx-cdtors -fvisibility-inlines-hidden -std=c++17 -Wno-narrowing -Wsign-compare -Wno-undefined-var-template -O3 -MD -MT libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -MF libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o.d -o libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -c /Users/christian/development/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc
In file included from /Users/christian/development/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc:5:
In file included from /Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_ref_counted.h:53:
/Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:7: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);
      ^
/Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:32: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);
chase commented 9 months ago

How did you guys do this? I tried downloading 14.3.1 from Apple Developer and set export DEVELOPER_DIR=/Applications/Xcode14.3.1.app/Contents/Developer but I still get these errors when trying to build:

❯ cmake --build build
[1/211] Building CXX object libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o
FAILED: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCEF_USE_SANDBOX -DWRAPPING_CEF_SHARED -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I/Users/christian/development/awrit/build/_deps/cef_minimal-src -O3 -DNDEBUG -std=gnu++20 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.13 -fno-strict-aliasing -fstack-protector -funwind-tables -fvisibility=hidden -Wall -Werror -Wextra -Wendif-labels -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter -mmacosx-version-min=10.13 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fobjc-call-cxx-cdtors -fvisibility-inlines-hidden -std=c++17 -Wno-narrowing -Wsign-compare -Wno-undefined-var-template -O3 -MD -MT libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -MF libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o.d -o libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_ref_counted.cc.o -c /Users/christian/development/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc
In file included from /Users/christian/development/awrit/build/_deps/cef_minimal-src/libcef_dll/base/cef_ref_counted.cc:5:
In file included from /Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_ref_counted.h:53:
/Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:7: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);
      ^
/Users/christian/development/awrit/build/_deps/cef_minimal-src/include/base/cef_template_util.h:176:32: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
      __has_trivial_copy(T) && __has_trivial_destructor(T);

From that log, it seems like you either did not install 14.3.1, did not rename it to Xcode14.3.1, or did not export immediately before the cmake commands.

/Applications/Xcode.app/Contents/Developer is the developer directory it is using. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk is not the correct SDK

blueneogeo commented 9 months ago

I did rename it, and did the export, however I cannot run XCode 14.3.1, and that may be the reason that it was not installed. Trying to run it, I get this error:

image
chase commented 9 months ago

I did rename it, and did the export, however I cannot run XCode 14.3.1, and that may be the reason that it was not installed. Trying to run it, I get this error:

You don't need to open it. You could try using xcode-select --switch /Applications/Xcode14.3.1.app, although that's what DEVELOPER_DIR does in a more temporary manner.

blueneogeo commented 9 months ago

It worked after xcode-select and clearing and rebuilding my build directory. Thank you for the assist.

blueneogeo commented 9 months ago

As an aside, as it does work and I realise this was written mostly for Kitty, on Wezterm I see "BAD SIZE 1036800" repeated on every mouse move, on a black terminal screen (no visuals). I noticed it is actually registering clicks because I see the terminal title change to different pages I can blindly click through. The bad size number I see seems related to the start screen size.

blueneogeo commented 9 months ago
image
chase commented 9 months ago

As an aside, as it does work and I realise this was written mostly for Kitty, on Wezterm

Yes, it was written for Kitty. Wezterm is not supported by default, last I checked you have to enable Kitty image protocol support and Kitty keyboard escape protocol support: https://wezfurlong.org/wezterm/config/lua/config/enable_kitty_keyboard.html?h=kitty

However that may break things in other software for Wezterm.

I don't really have time to maintain this project for Wezterm, since it's not the terminal I use. If you do get it working using whatever image protocol and keyboard protocol is supported in Wezterm, feel free to contribute a PR.