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

Fixed MacOS build #893

Merged
merged 1 commit into from
Oct 19, 2024
Merged

Fixed MacOS build #893

merged 1 commit into from
Oct 19, 2024

Conversation

jokesper
Copy link
Contributor

@jokesper jokesper commented Sep 26, 2024

This fixes #885.

It contained two problems:

  1. MAC_OS_X_VERSION_12_0 is not set (why? It was before).
  2. The last stack install in the build instructions detects, that the flag kmonad:dext / kmonad:kext is not set and would recompile without it.

I could not test this PR since I don't have access to a mac. (Therefore marked as Draft)

(sorry Github but I am testing this via the CI)

@jokesper jokesper force-pushed the fix-macos-build-errors branch 6 times, most recently from 51522e6 to bbf9185 Compare September 26, 2024 14:26
Copy link

@Cardosaum Cardosaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation succeeds, and a working binary is generated! \o/ 🎉

There's still an error message being emitted during the compilation step though, I made a comment in the relevant code and will leave to your discretion the decision if this completely solves #885.


Thank you so much for such promptly reply and fix! 🙇‍♂️🙏

@Cardosaum
Copy link

Hmm, weird my comment on the code was not added. sending here again.


Compilation succeeds, but the changes in the header file do not get rid of the error messages being emitted during the installation step.

I'm not sure if this is a major problem since the end goal is accomplished, so will leave to your discretion deciding if it fixes #885 or not.

$ stack install --flag kmonad:dext --extra-include-dirs=c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/include/pqrs/karabiner/driverkit:c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/src/Client/vendor/include
Preparing to install GHC to an isolated location. This will not interfere with any system-level installation.
Downloaded ghc-9.6.6.                                      
ld: unknown option: --version                                                
/Users/mcs/.stack/programs/aarch64-osx/ghc-9.6.6.temp/ghc-9.6.6-aarch64-apple-darwin/configure: line 7006: FP_PROG_LD_BUILD_ID: command not found
Installed GHC.     
[1 of 3] Compiling Main             ( /Users/mcs/.stack/setup-exe-src/setup-DY68M0FN.hs, /Users/mcs/.stack/setup-exe-src/setup-DY68M0FN.o )
[2 of 3] Compiling StackSetupShim   ( /Users/mcs/.stack/setup-exe-src/setup-shim-DY68M0FN.hs, /Users/mcs/.stack/setup-exe-src/setup-shim-DY68M0FN.o )
[3 of 3] Linking /Users/mcs/.stack/setup-exe-cache/aarch64-osx/tmp-Cabal-simple_DY68M0FN_3.10.3.0_ghc-9.6.6

# ... snip more logs ... #
                      
/Users/mcs/git/github/jokesper/kmonad/In file included from c_src/mac/dext.cpp:3:0: error: 
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:168:39: error:
     warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        kr = IOServiceGetMatchingServices(kIOMainPortDefault,
                                          ^~~~~~~~~~~~~~~~~~
                                          kIOMainPortDefault
    |                 
168 |     kr = IOServiceGetMatchingServices(kIOMainPortDefault,
    |                                       ^
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:13:32: error:
     note: expanded from macro 'kIOMainPortDefault'
        #define kIOMainPortDefault kIOMasterPortDefault
                                   ^
   |                  
13 |     #define kIOMainPortDefault kIOMasterPortDefault
   |                                ^
                      
/Users/mcs/git/github/jokesper/kmonad//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: error:
     note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
    |                 
133 | const mach_port_t kIOMasterPortDefault
    |                   ^
const mach_port_t kIOMasterPortDefault
                  ^   
                      
/Users/mcs/git/github/jokesper/kmonad/In file included from c_src/mac/dext.cpp:3:0: error: 
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:177:72: error:
     warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
                                                                           ^~~~~~~~~~~~~~~~~~
                                                                           kIOMainPortDefault
    |                 
177 |     IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
    |                                                                        ^
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:13:32: error:
     note: expanded from macro 'kIOMainPortDefault'
        #define kIOMainPortDefault kIOMasterPortDefault
                                   ^
   |                  
13 |     #define kIOMainPortDefault kIOMasterPortDefault
   |                                ^
                      
/Users/mcs/git/github/jokesper/kmonad//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: error:
     note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
    |                 
133 | const mach_port_t kIOMasterPortDefault
    |                   ^
const mach_port_t kIOMasterPortDefault
                  ^   
2 warnings generated. 
                      
/Users/mcs/git/github/jokesper/kmonad/In file included from c_src/mac/dext.cpp:3:0: error: 
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:168:39: error:
     warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        kr = IOServiceGetMatchingServices(kIOMainPortDefault,
                                          ^~~~~~~~~~~~~~~~~~
                                          kIOMainPortDefault
    |                 
168 |     kr = IOServiceGetMatchingServices(kIOMainPortDefault,
    |                                       ^
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:13:32: error:
     note: expanded from macro 'kIOMainPortDefault'
        #define kIOMainPortDefault kIOMasterPortDefault
                                   ^
   |                  
13 |     #define kIOMainPortDefault kIOMasterPortDefault
   |                                ^
                      
/Users/mcs/git/github/jokesper/kmonad//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: error:
     note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
    |                 
133 | const mach_port_t kIOMasterPortDefault
    |                   ^
const mach_port_t kIOMasterPortDefault
                  ^   
                      
/Users/mcs/git/github/jokesper/kmonad/In file included from c_src/mac/dext.cpp:3:0: error: 
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:177:72: error:
     warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
                                                                           ^~~~~~~~~~~~~~~~~~
                                                                           kIOMainPortDefault
    |                 
177 |     IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
    |                                                                        ^
                      
/Users/mcs/git/github/jokesper/kmonad/c_src/mac/keyio_mac.hpp:13:32: error:
     note: expanded from macro 'kIOMainPortDefault'
        #define kIOMainPortDefault kIOMasterPortDefault
                                   ^
   |                  
13 |     #define kIOMainPortDefault kIOMasterPortDefault
   |                                ^
                      
/Users/mcs/git/github/jokesper/kmonad//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: error:
     note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
    |                 
133 | const mach_port_t kIOMasterPortDefault
    |                   ^
const mach_port_t kIOMasterPortDefault
                  ^   
2 warnings generated. 
Preprocessing executable 'kmonad' for kmonad-0.4.3..
Building executable 'kmonad' for kmonad-0.4.3..
[1 of 1] Compiling Main
[2 of 2] Linking .stack-work/dist/aarch64-osx/ghc-9.6.6/build/kmonad/kmonad
kmonad                       > copy/register
Installing library in /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/lib/aarch64-osx-ghc-9.6.6/kmonad-0.4.3-A3EvYAihvh86b3TLnQfncK
Installing executable kmonad in /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/bin
Registering library for kmonad-0.4.3..
Completed 56 action(s).
Copying from /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/bin/kmonad to /Users/mcs/.local/bin/kmonad.
Copied executables to /Users/mcs/.local/bin/:
* kmonad

@jokesper
Copy link
Contributor Author

jokesper commented Sep 26, 2024

Hmmm this is wierd...
Wait why does it even compile for you?
I'm so confused.

This fixes kmonad#885.

It contained two problems:
1. `MAC_OS_X_VERSION_12_0` is not set (why? It was before, was it?).
2. The last `stack install` in the build instructions detects,
   that the flag `kmonad:dext` / `kmonad:kext` is not set and would
   recompile without it.
@jokesper
Copy link
Contributor Author

Ahhh, the kext github CI also had an error. I don't get the same warning as you did in the CI pipeline for dext.

@jokesper jokesper marked this pull request as ready for review September 26, 2024 16:11
@Cardosaum
Copy link

Hmmm this is wierd... Wait why does it even compile for you? I'm so confused.

Right? We're in the same boat. I have no idea either

@jokesper
Copy link
Contributor Author

Are you sure you are using my branch? As I said before the CI pipeline didn't show any errors

@Cardosaum
Copy link

@jokesper I'm sorry - I just recheck it and I was on master. changing to fix-macos-build-errors, at commit 53d54602ac2ad08985e7da28f906202b0dca4d2e, I don't get any errors anymore.

Sorry for the confusion!

$ git checkout fix-macos-build-errors
$ stack install --flag kmonad:dext --extra-include-dirs=c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/include/pqrs/karabiner/driverkit:c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/src/Client/vendor/include
kmonad-0.4.3: unregistering (local file changes: app/Main.hs changelog.md doc/quick-reference.md keymap/tutorial.kbd kmonad.cabal src/KMonad/App.h...)
kmonad> configure (lib + exe)
Configuring kmonad-0.4.3...
kmonad> build (lib + exe) with ghc-9.6.6
Preprocessing library for kmonad-0.4.3..
Building library for kmonad-0.4.3..
[ 1 of 35] Compiling KMonad.Prelude.Imports
[ 2 of 35] Compiling KMonad.Prelude.Definitions
[ 3 of 35] Compiling KMonad.Prelude
[ 4 of 35] Compiling KMonad.Parsing
[ 5 of 35] Compiling KMonad.Keyboard.ComposeSeq
[ 6 of 35] Compiling KMonad.Gesture
[ 7 of 35] Compiling KMonad.Args.TH
[ 8 of 35] Compiling KMonad.Util
[ 9 of 35] Compiling KMonad.Util.LayerStack
[10 of 35] Compiling KMonad.Util.MultiMap
[11 of 35] Compiling KMonad.Keyboard.Keycode
[12 of 35] Compiling KMonad.Keyboard.Types
[13 of 35] Compiling KMonad.Keyboard.IO
[14 of 35] Compiling KMonad.Keyboard.Ops
[15 of 35] Compiling KMonad.Keyboard
[16 of 35] Compiling KMonad.Model.Sluice
[17 of 35] Compiling KMonad.Model.Dispatch
[18 of 35] Compiling KMonad.Model.Action
[19 of 35] Compiling KMonad.Model.Hooks
[20 of 35] Compiling KMonad.Model.Button
[21 of 35] Compiling KMonad.Model.BEnv
[22 of 35] Compiling KMonad.Model.Keymap
[23 of 35] Compiling KMonad.Model
[24 of 35] Compiling KMonad.Keyboard.IO.Mac.Types
[25 of 35] Compiling KMonad.Keyboard.IO.Mac.KextSink
[26 of 35] Compiling KMonad.Keyboard.IO.Mac.IOKitSource
[27 of 35] Compiling KMonad.Args.Types
[28 of 35] Compiling KMonad.Args.Joiner
[29 of 35] Compiling KMonad.App.Types
[30 of 35] Compiling KMonad.Args.Parser
[31 of 35] Compiling Paths_kmonad
[32 of 35] Compiling KMonad.Args.Cmd
[33 of 35] Compiling KMonad.Args
[34 of 35] Compiling KMonad.App.Main
[35 of 35] Compiling KMonad.App
Preprocessing executable 'kmonad' for kmonad-0.4.3..
Building executable 'kmonad' for kmonad-0.4.3..
[1 of 1] Compiling Main
[2 of 2] Linking .stack-work/dist/aarch64-osx/ghc-9.6.6/build/kmonad/kmonad
kmonad> copy/register
Installing library in /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/lib/aarch64-osx-ghc-9.6.6/kmonad-0.4.3-A3EvYAihvh86b3TLnQfncK
Installing executable kmonad in /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/bin
Registering library for kmonad-0.4.3..
Copying from /Users/mcs/git/github/jokesper/kmonad/.stack-work/install/aarch64-osx/71532902493321573c5aa4b4a9765e2bc259d3976d16f32bac7ae5c56ab61f51/9.6.6/bin/kmonad to /Users/mcs/.local/bin/kmonad.
Copied executables to /Users/mcs/.local/bin/:
* kmonad

@slotThe slotThe merged commit 7fdccc4 into kmonad:master Oct 19, 2024
9 checks passed
@jokesper jokesper deleted the fix-macos-build-errors branch October 19, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure on MacOS Sequoia
3 participants