multi thread error

when we use
Task.Run(()=>
{
	A = 10;
});

throw a runtime error
Text="{x:Bind A}"

I suppose, setting A property raises PropertyChanged event. So that the value of the property is immediately set to the TextBlock’s Text property.
You can set control's property only in main thread. Updating UI from background thread is not supported in any (known me) UI frameworks.

I have a similar error, but this time, compiler refuse to invoke and silently end with code  -532,462,766.
My viewModel:
``cs
//using new Microsoft CommunityToolkit.MVVM
public partial class LoginViewModel : ObservableObject
{
private readonly ILoginService _service;
[ObservableProperty]
private LoginModel _user = new();
[ObservableProperty]
private bool _isLoginSuccess;
// async code
[RelayCommand(FlowExceptionsToTaskScheduler = true)]
private async Task LoginUser()
{
if (string.IsNullOrEmpty(User.UserName) && string.IsNullOrEmpty(User.Password))
{
var result = await _service.Login(User);
IsLoginSuccess = result;
}
else throw new ArgumentNullException();
}
// -------rest-----------
}
// in my xaml

``

have a similar error, but this time, compiler refuse to invoke and silently end with code -532,462,766.
My viewModel:
//using new Microsoft CommunityToolkit.MVVM
public partial class LoginViewModel : ObservableObject
{
private readonly ILoginService _service;
[ObservableProperty]
private LoginModel _user = new();
[ObservableProperty]
private bool _isLoginSuccess;

// async code
[RelayCommand(FlowExceptionsToTaskScheduler = true)]
private async Task LoginUser()
{
if (string.IsNullOrEmpty(User.UserName) && string.IsNullOrEmpty(User.Password))
{
var result = await _service.Login(User);
IsLoginSuccess = result;
}
else throw new ArgumentNullException();
}
// -------rest-----------
}

// in my xaml

have a similar error, but this time, compiler refuse to invoke and silently end with code -532,462,766.
My viewModel:
//using new Microsoft CommunityToolkit.MVVM
public partial class LoginViewModel : ObservableObject
{
  private readonly ILoginService _service;
  [ObservableProperty]
  private LoginModel _user = new();
  [ObservableProperty]
  private bool _isLoginSuccess;

// async code
  [RelayCommand(FlowExceptionsToTaskScheduler = true)]
  private async Task LoginUser()
{
    if (string.IsNullOrEmpty(User.UserName) && string.IsNullOrEmpty(User.Password))
   {
       var result = await _service.Login(User);
       IsLoginSuccess = result;
    }
    else throw new ArgumentNullException();
  }
// -------rest-----------
}

// in my xaml
<Button Grid.Row="4" Content="Đăng nhập" IsEnabled="{x:Bind ViewModel.User.Password eq null or ViewModel.User.UserName eq null }" Command="{x:Bind  ViewModel.LoginUserCommand}"
                        Margin="0, 10,0,0" VerticalAlignment="Bottom"
                        HorizontalAlignment="Center" />
<Button Grid.Row="5" Content="Reset" VerticalAlignment="Bottom"
                        Style="{DynamicResource MaterialDesignOutlinedSecondaryDarkButton}"
                        Command="{x:Bind ViewModel.ResetCommand}" Width="100" />

Thanks. And could you please help me or provide a Solution to deal with this problem?
I need to update the binding property in the task /new thread

You can set properties in a background thread, but you have to delegate raising PropertyChanged event to the main thread.
As an example you could look here:
https://github.com/levitali/CompiledBindings/blob/master/source/XF/XFTest/ViewModels/SynchronizedObservableObject.cs
Though the project is for Xamarin Forms, there are compiler switches for many other UI frameworks.


[KED-1619] parameters.yaml configuration reference

I'd like to understand what valid entries in parameters.yaml files are. Searching the kedro docs did not provide the info I was looking for. Is related to https://github.com/quantumblacklabs/kedro/issues/344 .

Hi @fkromer , there's an example in the user guide, but it's basically just regular yaml syntax, no extra reserved words. #344 has been further addressed with json schemas to integrate in your IDE to aid the development workflow.

Closing this as answered


"TypeError: jsdom.jsdom is not a function"

Okay, I managed to get past the "Error: Cannot find module 'steam-user'" error by manually installing each package through cmd as admin (which installs it in the C:\WINDOWS\System32\node_modules directory). But now that they are all installed I get this following error which I have no clue how to fix:

C:\WINDOWS\system32\main.js:5
$ = require("jquery")(jsdom.jsdom().defaultView),
^
TypeError: jsdom.jsdom is not a function
at Object. (C:\WINDOWS\system32\main.js:5:29)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:423:7)
at startup (bootstrap_node.js:147:9)
at bootstrap_node.js:538:3
Press any key to continue. . .

Yeah more users are complaining about this. I don't know. Try google?

I found the solution:
With npm install jsdom you automatically install version 10.0.0 but you need version 9.12.0 to run the script.
https://github.com/tmpvar/jsdom/releases/tag/9.12.0

Thanks!
I edited install.bat to say

@ECHO OFF
npm install steamauth
npm install steam-user
npm install steamcommunity
npm install<EMAIL_ADDRESS>npm install fs
npm install request
npm install cloudscraper
npm install jquery
pause

Now install works fine on every machine I have tested this on :)
@Royalgamer06 I'd recommend updating that file to contain this.

Done 👍


send message to thread

Threads send signals to mainloop, how to send a signal from mainloop to the thread?
I want to send a signal to destroy itself so the stop work command executes immediately.
Also would be useful for mainloop to tell a thread to signal a progress metric, etc.

Mainloop wants to know about progress/status of a thread.
1 - Does mainloop send a periodic message to each thread, requesting it send a status report? That's two messages, but only when mainloop wants it.
2 - Does thread send periodic message to mainloop? That's one message, but unexpected by mainloop.

I made mainloop send a kill to the thread(s).


Add Code-Server and RStudio support

Proposed code modifications to make the launcher compatible with Code-Server and RStudio custom images.
NOTE:
I'm only opening a draft PR so that people can check the code. However I made some changes that may be unwanted at this stage. As my node environment is on version 16, plus being on Fedora 36 which supports only OpenSSL v3, I had to remove node-saas (which has been deprecated for a few years anyway)  and replace it with saas. So packages and packages.lock have changed and been updated, which you may not want to integrate in the code at this point.
Description
Some elements in the launcher were tied to Jupyter notebooks, like Readiness and Liveness probes. The modifications allow to customize the ImageStreams of custom notebooks images with annotations to support different settings.
How Has This Been Tested?
Deployment of the new dashboard and launch tests.
Merge criteria:

[X ] The commits are squashed in a cohesive manner and have meaningful messages.
[ X] Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
[ X] The developer has manually tested the changes and verified that the changes work

Rebased, testing under progress.

With the realease of compatible images for VSCode and RStudio, this is not needed anymore.


Sync eng/common directory with azure-sdk-tools for PR 1555

Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/1555  See eng/common workflow


Update port and protocol from HTTPS to HTTP for local host debugging

Using IIS express with dynamic ports is causing issues with HTTPS and cert bindings. Need to revert the docs to use HTTP.

I found a work around - go to control panel, find IIS Express, do a "repair", then re-run the application.  HTTPS should then work..

Duplicate of #10 Closing


Flag Ceremony Built in

Hello Friends,
Based on the work done I want to create a flag ceremoney simulation  (Where we add 3 flags) and they are raised... As in a sport event where you have the 3 flags of the gold silver bronze medals and on the ceremony the gold medalist flag is raised hisger than every other, the silver is second and the bronze is third, ANY  ONE can help?

Is this is a feature request or are you trying to use the flagwaver code in your own project?

Trying to develop an app or find a programmer that can develop this app
based on your code.
On Tue, 23 Jul 2019, 03:40 krikienoid<EMAIL_ADDRESS>wrote:

Is this is a feature request or are you trying to use the flagwaver code
in your own project?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/krikienoid/flagwaver/issues/9?email_source=notifications&email_token=AL63BZO7IM5YAWIHWQA2XH3QAZHP5A5CNFSM4IFFGJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2RSGKY#issuecomment-514007851,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL63BZN3HJBNNMM2V6N7PGLQAZHP5ANCNFSM4IFFGJNQ
.

Basicalky adding 2 poles second and third winner  and simulating also a
movement exactly like a medal ceremony in games where flags arw raised
On Tue, 23 Jul 2019, 06:06 Stratis Telloglou<EMAIL_ADDRESS>wrote:

Trying to develop an app or find a programmer that can develop this app
based on your code.
On Tue, 23 Jul 2019, 03:40 krikienoid<EMAIL_ADDRESS>wrote:

Is this is a feature request or are you trying to use the flagwaver code
in your own project?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/krikienoid/flagwaver/issues/9?email_source=notifications&email_token=AL63BZO7IM5YAWIHWQA2XH3QAZHP5A5CNFSM4IFFGJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2RSGKY#issuecomment-514007851,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL63BZN3HJBNNMM2V6N7PGLQAZHP5ANCNFSM4IFFGJNQ
.

check out the video, this is the end result i want to achieve
On Tue, Jul 23, 2019 at 3:40 AM krikienoid<EMAIL_ADDRESS>wrote:

Is this is a feature request or are you trying to use the flagwaver code
in your own project?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/krikienoid/flagwaver/issues/9?email_source=notifications&email_token=AL63BZO7IM5YAWIHWQA2XH3QAZHP5A5CNFSM4IFFGJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2RSGKY#issuecomment-514007851,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL63BZN3HJBNNMM2V6N7PGLQAZHP5ANCNFSM4IFFGJNQ
.

--
Stratis Telloglou
OPERATIONS – SENIOR PROJECT MANAGEMENT

+30<PHONE_NUMBER> |* )* +30<PHONE_NUMBER>|*

***<EMAIL_ADDRESS><EMAIL_ADDRESS>|* Stratis63 |
br.linkedin.com/in/stratistelloglou
http://br.linkedin.com/in/stratistelloglou*

I can't see the video, sorry. What you are describing is not difficult to create however.
If you fork from the dev branch and modify the code in the two files with what is in the link below, it should work as you described.
https://gist.github.com/krikienoid/4438f30d080293f696c4c243f4e7b3d6

Unfortunately i do not have technical knowledge to do. If you have a
develpoer who can please introduce him pls.
This is what i have to do but with
A flag raise where fkags are raised to the top of rhe post.
On Wed, 24 Jul 2019, 01:03 krikienoid<EMAIL_ADDRESS>wrote:

I can't see the video, sorry. What you are describing is not difficult to
create however.
If you fork from the dev branch and modify the code in the two files with
what is in the link below, it should work as you described.
https://gist.github.com/krikienoid/4438f30d080293f696c4c243f4e7b3d6
[image: Screen Shot 2019-07-23 at 5 45 06 PM]
https://user-images.githubusercontent.com/8528227/61750709-08629200-ad74-11e9-8b3d-ae8ee74c9d0e.png
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/krikienoid/flagwaver/issues/9?email_source=notifications&email_token=AL63BZIGOTIBU2EHCJGIKCLQA553HA5CNFSM4IFFGJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2USD2I#issuecomment-514400745,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL63BZNQHSAGXFOEYEJWOBLQA553HANCNFSM4IFFGJNQ
.

On Wed, Jul 24, 2019 at 10:05 AM Stratis Telloglou<EMAIL_ADDRESS>wrote:

https://drive.google.com/open?id=1Tjbgva3RMGKRbA0TuqZq9AaYanueNm2d
If you have someone that can help me even with a fee , i would really
appreciate,
I have all flags and text files ready and i have a small fee that i can
pay developer
On Wed, Jul 24, 2019 at 7:58 AM Stratis Telloglou<EMAIL_ADDRESS>wrote:

Unfortunately i do not have technical knowledge to do. If you have a
develpoer who can please introduce him pls.
This is what i have to do but with
A flag raise where flags are raised to the top of rhe post.
On Wed, 24 Jul 2019, 01:03 krikienoid<EMAIL_ADDRESS>wrote:

I can't see the video, sorry. What you are describing is not difficult
to create however.
If you fork from the dev branch and modify the code in the two files
with what is in the link below, it should work as you described.
https://gist.github.com/krikienoid/4438f30d080293f696c4c243f4e7b3d6
[image: Screen Shot 2019-07-23 at 5 45 06 PM]
https://user-images.githubusercontent.com/8528227/61750709-08629200-ad74-11e9-8b3d-ae8ee74c9d0e.png
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/krikienoid/flagwaver/issues/9?email_source=notifications&email_token=AL63BZIGOTIBU2EHCJGIKCLQA553HA5CNFSM4IFFGJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2USD2I#issuecomment-514400745,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL63BZNQHSAGXFOEYEJWOBLQA553HANCNFSM4IFFGJNQ
.

--
Stratis Telloglou
OPERATIONS – SENIOR PROJECT MANAGEMENT

+30<PHONE_NUMBER> |* )* +30<PHONE_NUMBER>|*

***<EMAIL_ADDRESS><EMAIL_ADDRESS>|* Stratis63 |
br.linkedin.com/in/stratistelloglou
http://br.linkedin.com/in/stratistelloglou*

--
Stratis Telloglou
OPERATIONS – SENIOR PROJECT MANAGEMENT

+30<PHONE_NUMBER> |* )* +30<PHONE_NUMBER>|*

***<EMAIL_ADDRESS><EMAIL_ADDRESS>|* Stratis63 |
br.linkedin.com/in/stratistelloglou
http://br.linkedin.com/in/stratistelloglou*


Avoid handling in InputManager when GUI is visible

For example the console or chat window.

fixed in 2.1


Added mobile device redirect support using a custom URL scheme

The user agent is used to identify the OS type (currently iPad and iPhone) and will offer
a notification at the top of the message stream offering to redirect to the Mobile app.
There is currently no support for Android yet.

Automated message from Dropbox CLA bot
@timapril, thanks for the pull request! It looks like you haven't yet signed the Dropbox CLA. Please sign it here and update the thread so we can consider merging your code.

The CLA has already been signed by Akamai

Hello @timapril, a Zulip maintainer reviewed this pull request over a week ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.
Thank you for your valuable contributions to Zulip!

I think enough has changed that implementing this from scratch would be about as easy as rebasing this, so I'm closing.  Thanks for the work on this @timapril!


TypeError: Gherkin.fromPaths is not a function && TypeError: gherkin.fromPaths is not a function (gherkin-javascript)

Summary

When using gherkin-javascript standalone in a Node.JS script fromPaths seems non-accessible
Expected Behavior
I should be able to use fromPaths

Current Behavior
Can't use fromPaths

(node:60095) UnhandledPromiseRejectionWarning: TypeError: Gherkin.fromPaths is not a function
    at parseConfigs (/Users/msalvia/repos/jwplayer-mobile-sdk-workspace/mobileqa/wdio/makeCoverageReport.js:14:17)
    at Object.<anonymous> (/Users/msalvia/repos/jwplayer-mobile-sdk-workspace/mobileqa/wdio/makeCoverageReport.js:28:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:60095) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:60095) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Possible Solution
8.2.1 does work properly and fromPaths is valid

Steps to Reproduce (for bugs)

Write vanilla JS file using .fromPaths
Run file

const Gherkin = require('gherkin');
const fs = require('fs');

const options = {
    defaultDialect: 'en',
    includeSource: true,
    includeGherkinDocument: true,
    includePickles: true,
    createReadStream: (path) => fs.createReadStream(path, {encoding: 'utf-8'})
};

async function parseConfigs() {
    const envelopes = await streamToArray(
        Gherkin.fromPaths(['features/basic/basic_mp4.feature'], options)
    )
}

async function streamToArray(readableStream) {
    return new Promise((resolve, reject) => {
            const items = [];
            readableStream.on('data', items.push.bind(items));
            readableStream.on('error', (err) => reject(err));
            readableStream.on('end', () => resolve(items));
        }
    )
}

parseConfigs().then(r =>
    console.log(`Parsing: ${r}.`)
);

Context & Motivation
I am attempting to create statistics regarding Cucumber features.

Your Environment

Version used: 9.0.0
Operating System and version: macOS
Link to your project: Private

Hi @aslakhellesoy,
I have been doing some research on this and found this article about keeping backward compatibility between CommonJS and ES modules: https://2ality.com/2019/10/hybrid-npm-packages.html
I don't know if this is something that can be done with gherkin-js :)
Knowing that Node.js v13 is officially supporting ES modules (https://nodejs.org/api/esm.html)
I am wondering why not keeping default export?
I'd rather prefer having
import Gherkin, { GherkinQuery } from 'gherkin'

Than
import { Gherkin, GherkinQuery } from 'gherkin'

I will try with latest, as previously mentioned rolling back worked so this fell off the plate a bit.


Add a new option to remove access_token in the response data

I am wondering the usage of access_token/refresh_token in the response is needed? Since those token is already included in the cookie, I think maybe we should have an option(setting) to remove access_token.
For example, add REST_USE_JWT_COOKIE_ONLY to determine.
views.py  LoginView()
def get_response(self):
    serializer_class = self.get_response_serializer()

    if getattr(settings, 'REST_USE_JWT', False):
        ...
        ...
        if getattr(settings, 'REST_USE_JWT_COOKIE_ONLY', False):
            data = {
                'user': self.user
            }
        else:
            data = {
                'user': self.user,
                'access_token': self.access_token,
                'refresh_token': self.refresh_token,
            }

        ...
        ...

    response = Response(serializer.data, status=status.HTTP_200_OK)
    if getattr(settings, 'REST_USE_JWT', False):
        from .jwt_auth import set_jwt_cookies
        set_jwt_cookies(response, self.access_token, self.refresh_token)
    return response

Yeah same on the refresh token as this is a security issue. You should actually just send the refresh_token as a http-only token. That way the frontend doesn't have access to it but the server does. The frontend should only have access to the access_token. Then, when requesting a refresh, the server checks that cookie and responds only with the access_token
That prevents certain attacks (where cross site scripting could steal the refresh token and run away with it)

I would love to remove both tokens from the response body both for the login and refresh endpoints. As a workaround I overridden the LoginSerializer with a custom response. I was wondering what would be the best way to this for the refresh endpoint. My thought was to override the get_refresh_view() function that is called as the view of the endpoint and remove the response.data for 'access' and 'refresh' tokens there, but this seems a bit messy. Did you come up with a clean solution in the end?


HADOOP-17817. Throw an exception if S3 client-side encryption is enabled on S3Guard enabled bucket

Region: ap-south-1.
All tests initializing S3AFS failed.
Follow up of #2706.

:broken_heart: -1 overall

Vote
Subsystem
Runtime
Logfile
Comment

+0 :ok:
reexec
16m 14s

Docker mode activated.

_ Prechecks _

+1 :green_heart:
dupname
0m  0s

No case conflicting files found.

+0 :ok:
codespell
0m  1s

codespell was not available.

+0 :ok:
markdownlint
0m  1s

markdownlint was not available.

+1 :green_heart:
@author
0m  0s

The patch does not contain any @author tags.

-1 :x:
test4tests
0m  0s

The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.

_ trunk Compile Tests _

+1 :green_heart:
mvninstall
36m  4s

trunk passed

+1 :green_heart:
compile
1m  5s

trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
compile
0m 57s

trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
checkstyle
0m 37s

trunk passed

+1 :green_heart:
mvnsite
0m 44s

trunk passed

+1 :green_heart:
javadoc
0m 27s

trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javadoc
0m 46s

trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
spotbugs
1m 12s

trunk passed

+1 :green_heart:
shadedclient
15m 20s

branch has no errors when building and testing our client artifacts.

_ Patch Compile Tests _

+1 :green_heart:
mvninstall
1m  4s

the patch passed

+1 :green_heart:
compile
0m 43s

the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javac
0m 43s

the patch passed

+1 :green_heart:
compile
0m 38s

the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
javac
0m 38s

the patch passed

+1 :green_heart:
blanks
0m  0s

The patch has no blanks issues.

+1 :green_heart:
checkstyle
0m 34s

the patch passed

+1 :green_heart:
mvnsite
0m 42s

the patch passed

+1 :green_heart:
javadoc
0m 15s

the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javadoc
0m 30s

the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
spotbugs
1m 27s

the patch passed

+1 :green_heart:
shadedclient
15m 31s

patch has no errors when building and testing our client artifacts.

_ Other Tests _

+1 :green_heart:
unit
2m 26s

hadoop-aws in the patch passed.

+1 :green_heart:
asflicense
0m 36s

The patch does not generate ASF License warnings.

98m 44s

Subsystem
Report/Notes

Docker
ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/1/artifact/out/Dockerfile

GITHUB PR
https://github.com/apache/hadoop/pull/3239

Optional Tests
dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell markdownlint

uname
Linux f42020e422d4 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Build tool
maven

Personality
dev-support/bin/hadoop.sh

git revision
trunk / eec1937ec0e1c17f94935a086ac2e8f47256554a

Default Java
Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

Multi-JDK versions
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

Test Results
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/1/testReport/

Max. process+thread count
548 (vs. ulimit of 5500)

modules
C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws

Console output
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/1/console

versions
git=2.25.1 maven=3.6.3 spotbugs=4.2.2

Powered by
Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

CC: @steveloughran

:broken_heart: -1 overall

Vote
Subsystem
Runtime
Logfile
Comment

+0 :ok:
reexec
0m 53s

Docker mode activated.

_ Prechecks _

+1 :green_heart:
dupname
0m  0s

No case conflicting files found.

+0 :ok:
codespell
0m  0s

codespell was not available.

+0 :ok:
markdownlint
0m  0s

markdownlint was not available.

+1 :green_heart:
@author
0m  0s

The patch does not contain any @author tags.

-1 :x:
test4tests
0m  0s

The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.

_ trunk Compile Tests _

+1 :green_heart:
mvninstall
33m 45s

trunk passed

+1 :green_heart:
compile
0m 52s

trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
compile
0m 40s

trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
checkstyle
0m 31s

trunk passed

+1 :green_heart:
mvnsite
0m 48s

trunk passed

+1 :green_heart:
javadoc
0m 25s

trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javadoc
0m 35s

trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
spotbugs
1m 18s

trunk passed

+1 :green_heart:
shadedclient
15m 40s

branch has no errors when building and testing our client artifacts.

_ Patch Compile Tests _

+1 :green_heart:
mvninstall
0m 39s

the patch passed

+1 :green_heart:
compile
0m 44s

the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javac
0m 44s

the patch passed

+1 :green_heart:
compile
0m 34s

the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
javac
0m 34s

the patch passed

+1 :green_heart:
blanks
0m  0s

The patch has no blanks issues.

+1 :green_heart:
checkstyle
0m 21s

the patch passed

+1 :green_heart:
mvnsite
0m 38s

the patch passed

+1 :green_heart:
javadoc
0m 16s

the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04

+1 :green_heart:
javadoc
0m 26s

the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

+1 :green_heart:
spotbugs
1m 23s

the patch passed

+1 :green_heart:
shadedclient
17m 24s

patch has no errors when building and testing our client artifacts.

_ Other Tests _

+1 :green_heart:
unit
2m 16s

hadoop-aws in the patch passed.

+1 :green_heart:
asflicense
0m 34s

The patch does not generate ASF License warnings.

81m 27s

Subsystem
Report/Notes

Docker
ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/2/artifact/out/Dockerfile

GITHUB PR
https://github.com/apache/hadoop/pull/3239

Optional Tests
dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell markdownlint

uname
Linux 9072a5b349ac 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Build tool
maven

Personality
dev-support/bin/hadoop.sh

git revision
trunk / 40f1a6ab1e694dd8112483623a425300213291d0

Default Java
Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

Multi-JDK versions
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10

Test Results
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/2/testReport/

Max. process+thread count
749 (vs. ulimit of 5500)

modules
C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws

Console output
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3239/2/console

versions
git=2.25.1 maven=3.6.3 spotbugs=4.2.2

Powered by
Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

Seems like, I've broken tests for S3-CSE ON because some S3Guard tests don't require your bucket to be s3guard enabled, and force the metastore to be dynamoDB. My lapse on testing for S3-CSE ON and S3-Guard OFF. I think we should've skipped the S3Guard tests for S3-CSE anyways, so I'll skip all of them in a follow-up PR. The failure is valid, but still, we should skip, what do you think, @steveloughran?

hmm. Yes, that'll be an interesting problem.
Either test setup() checks for CSE on and skips the s3guard-enabled tests, or we catch the raised PathIOE and covert that to the skip call. That strategy might work well everywhere, including all contract tests.
Also: did you forget to run the tests? or is it just your test setup isn't S3-CSE? This is where we need broader test configuration coverage, don't we?

I ran the tests in S3-CSE ON S3Guard ON, S3-CSE OFF S3-Guard ON, and S3-CSE OFF S3-Guard OFF. More of a mistake that I thought I had run the S3-CSE ON and S3-Guard OFF test suite.
That's true, don't think anyone would see these failures since you have to set up the CSE configs to cover this type of testing.
What about the case where we have both S3Guard ON and S3 CSE ON btw? Then all tests would fail, should all be skipped then as well?


Split up requirements in multiple files

Create a requirements_full.txt and requirements_minimum.txt to separate the packages which are needed for pastepwn itself and the ones which are needed for certain packages.

References #38


Provide well-formed TIR in AttachMetadataWithMemoryUsage

The "global_symbol" attribute, provided by default from the BlockBuilder.function method, must match the name of the GlobalVar used in the IRModule.

@Lunderberg I see some conflicts here, please take a look.

Looks like the conflict was introduced with https://github.com/octoml/mlc-llm/pull/254, as the location of estimate_memory_usage.py changed.  I've updated this PR.


Ability to apply Preprocessor and Postprocessor after Classifier init

Is your feature request related to a problem? Please describe.
Currently, Preprocessor and Postprocessor defenses must be given at Classifier initialization, as they are set during initialization: https://github.com/IBM/adversarial-robustness-toolbox/blob/master/art/classifiers/classifier.py#L124-L132
Describe the solution you'd like
Allow these to be set or appended to with seomthing like set_params or append_preprocessing_defense.
Describe alternatives you've considered
We have directly modified Classifier.preprocessing_defences  and Classifier.postprocessing_defences. This appears safe for the moment, but we would prefer to use an API.

I have just remembered that we have already implemented this as part of the new Estimator API for the upcoming ART 1.3 where the new BaseEstimator class and with it all estimators/classifiers in ART 1.3 will have a set_params method for the BaseEstimator's attributes including preprocessing_defences and postprocessing_defences (https://github.com/IBM/adversarial-robustness-toolbox/blob/aceba4222e62b92f1675cc32177fde403b604a24/art/estimators/estimator.py#L73).
Would that work for you?

I think that this would work. Is there a get_params method as well? That would make it straightforward to append defenses as well:
pre_defenses = estimator.get_params()["preprocessing_defenses"]
pre_defenses.append(new_defense)
estimator.set_params(preprocessing_defenses=pre_defenses)

I think that's a good idea. There is no get_params so far, but we'll add it to BaseEstimator as part of this issue.


Apple M1

How can I build kmonad for Apple M1? If I install stack via homebrew and run
stack build --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

I don't know how to install GHC for (OSX,AArch64), please install manually

I don't use M1, but this should work.
Install appropriate GHC version (via GHCup or HomeBrew), and then pass --system-ghc flag to stack when building. I use GHCup for managing Haskell versions, so in my ~/.stack/config.yaml, I have:
system-ghc: true
install-ghc: false

Thanks @MuhammedZakir for pointing out GHCup to me. I struggled quite a bit getting kmonad compiled on Apple M1. What worked for me in the end is the following:
At the time of writing homebrew comes with ghc 8.10.5 which is known to have issues with Apple M1. So I uninstalled it and installed ghc 8.10.6 via GHCup. For some reason I couldn't install stack via GHCup too and kept the homebrew version.  For building I used
stack build --system-ghc --arch=aarch64 --resolver=ghc-8.10.6 --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

which failed with  dependency issues. I followed the compilers recommendations and added the extra-deps manually and allow-never: true to stack.yaml:
resolver: lts-18.5
allow-newer: true
packages:
- .
extra-deps:
- cereal-<IP_ADDRESS>@sha256:37cb7a78c84412e94592a658768320c41f015f2b8707a433de835afb8ebc18d7,2767
- lens-5.0.1@sha256:c97fbe43ae6fe21d73f1a023d776bb05cd492f0afd1b3c3ff43e246af91f6852,15544
- megaparsec-9.1.0@sha256:f2ef8a08cc1e3fa6628965732f588e07e886a01f8267310404e31072fa9e802b,3238
- optparse-applicative-<IP_ADDRESS>@sha256:16ebd7054b2265c1aad16c1d19dc503695fbfc67b35203d9952fd577d08c0110,4982
- resourcet-<IP_ADDRESS>@sha256:8d334105a5a9cd33759d2b1e949f616f8ba031d0374b4b07771a720ad14871e1,1730
- rio-<IP_ADDRESS>@sha256:a49aaac7af792eeb641bd7f34b26b428e570e1804b32cac85952319275b61b24,3669
- unliftio-0.2.19@sha256:435d7ecbf5333fcf15bb2efe43691ca9c597e2fbbc943d542d247222334f0972,3395
- ansi-wl-pprint-0.6.9@sha256:20d30674f137d43aa0279c2c2cc5e45a5f1c3c57e301852494906158b6313bf7,2388
- assoc-1.0.2@sha256:a824e4f615469a27ad949dbf4907ba258bd6b459deebec00524c7bcb3f65cc9f,1205
- async-2.2.3@sha256:0cbefb8247308b38e397e675f832b9bd5317ff1872001d5358f213654423c55b,2920
- base-orphans-0.8.4@sha256:9a70dc95761ab9a9d49a038a4599b7b7945d486d80ed1678f347445bc336f3e0,3149
- bifunctors-5.5.11@sha256:cc425ee85aae56dba1123baf6fb3fa7abcd90782f26bb904eef14c7332ee85f6,3919
- call-stack-0.4.0@sha256:ac44d2c00931dc20b01750da8c92ec443eb63a7231e8550188cb2ac2385f7feb,1200
- case-insensitive-<IP_ADDRESS>@sha256:9dfd3171fc7698cf8d931727d3af3a7b389135b583e46b5adac1f9d2026fff61,2244
- comonad-5.0.8@sha256:1f1aabd73ec7f80f20cf078a748a60cd48d8e57277802fdf6a9ab3601a9b8f7e,3631
- contravariant-1.5.5@sha256:470ed0e040e879e2da4af1b2c8f94e199f6135852a8107858d5ae0a95365835f,3041
- distributive-<IP_ADDRESS>@sha256:0f99f5541cca04acf89b64432b03422b6408e830a8dff30e6c4334ef1a48680c,2996
- free-5.1.7@sha256:fe55684a2c445e9fac09053f4ea63270b429a65a7a7aea304e057d9f6a827b56,4959
- hashable-<IP_ADDRESS>@sha256:02bc544e3546713b1d76a3c5bfc836a5fd19a5b4348ef4a52bb973d0c35a4b89,3992
- indexed-traversable-0.1.1@sha256:e4602357513aa3b146546227732e6e5698392f4324ab690e109cc05676ba3b4f,2491
- indexed-traversable-instances-0.1@sha256:3aaf97040001bbe583e29c2b9c7d41660df265e6565a0d2ac09a3ed5b8bc21be,2874
- kan-extensions-5.2.3@sha256:f98303d68cfe59981e30cd981327503a8bff429a6124654700c813ec1eedf8fa,2922
- microlens-<IP_ADDRESS>@sha256:2d799d17c9e36fb5a62fbed1f07231cf5e423d9d82ac24b5137263bcef1cc4ed,4520
- microlens-mtl-<IP_ADDRESS>@sha256:ac604347d822e07215ca4374d7d13881be2e53c29d5c12882bd82e782f42369e,1777
- parallel-<IP_ADDRESS>@sha256:421ce1717610bab82969572b96be89d83ea8d8afe7751cb54d80b996fff063d3,1817
- parser-combinators-1.3.0@sha256:edd54ba56cbae8fadbcceebcfef31b2c70a835e92e5eda41151b939c40647281,1570
- primitive-<IP_ADDRESS>@sha256:d7c3635e83ae160129cdfe2be4092ab6389199d73a2c29adf904124dbcfe6100,2660
- profunctors-5.6.2@sha256:d91e81cf7fc186d616543d5ca7aad78b1c45c692486ca75a3f022466ff8e4bad,2483
- reflection-2.1.6@sha256:044acb7caf41a9d8246878f849baed2dffbc4582d0a1e5c7c079d4287239e970,3976
- scientific-<IP_ADDRESS>@sha256:0f188a7b92780d81a2e3cf1195a3a24cfe3e7c43d0e9e0f2101a465803d68076,4773
- semigroupoids-5.3.5@sha256:e9ad7265a3baca520054fd2f9d6b1ebe6779502dc377550c99dee43e88555a8f,7439
- strict-<IP_ADDRESS>@sha256:50187e750751a258efea12ef2979e16a014a953c15bf4c2fca2f1168a44a5a12,4156
- tagged-<IP_ADDRESS>@sha256:29c67d98a4404607f024750ab9c7210dadcbbef4e1944c48c52902f2071b2662,2874
- th-abstraction-<IP_ADDRESS>@sha256:6ba7b201931f614173755f060fdf98f02095df68c1f7bc3e2691cf9d443e81f9,2194
- these-<IP_ADDRESS>@sha256:bdc0a3015b2e5cdf016e402937d71856ae5fe4e9e9a0d4823cc94a214c55a39b,2732
- transformers-compat-0.7@sha256:c4cc2d01c4e490ba680e9a0b607a1a790137856a6b3af12f8bdc7788a567bcf5,5572
- typed-process-<IP_ADDRESS>@sha256:631cf38ffe5c895a804ce5480e74ca2cef50d6de592bd69b625935b743d99560,2062
- unliftio-core-<IP_ADDRESS>@sha256:f9abcdd3f3d28e4840563efb7b8760d2de9b5707bcd6f53a87f6a0d77bb5a9f7,1082
- unordered-containers-<IP_ADDRESS>@sha256:2fe789f78246b7c7ec10d7b85c72d898a9f72fdda5b60d581e839d21016bc628,4992
- vector-<IP_ADDRESS>@sha256:0ae2c1ba86f0077910be242ec6802cc3d7725fe7b2bea6987201aa3737b239b5,7953
- StateVar-1.2.2@sha256:3c022c00485fe165e3080d5da6b3ca9c9b02f62c5deebc584d1b3d1309ce673e,1673
- adjunctions-4.4@sha256:2738dd5f5d5e93749adb14a05472e58a96a75d0f299e46371c6f46dc4e97daf9,3067
- ansi-terminal-0.11@sha256:97470250c92aae14c4c810d7f664c532995ba8910e2ad797b29f22ad0d2d0194,3307
- integer-logarithms-<IP_ADDRESS>@sha256:888fb6c4fbd79ed2e8f8b94b61bccac25f7fab2b13b32b496e86828bc60b17cf,3184
- invariant-0.5.4@sha256:04596946f13f4ec241eae5382c3c19eefebf6a7e2e5e60a4b8187c9115f8594a,3400
- transformers-base-0.4.6@sha256:6f18f320e371c8954c4b6b211e2fdd5d15a6d6310bd605b9d640f47ede408961,1643
- colour-2.3.6@sha256:ebdcbf15023958838a527e381ab3c3b1e99ed12d1b25efeb7feaa4ad8c37664a,2378
- semigroups-0.19.1@sha256:cd827aaba0c2b57727dedecdfcc7eec5f14719b73c7675037c73c74f642c1782,6463
- void-0.7.3@sha256:13d30f62fcdf065e595d679d4ac8b4b0c1bb1a1b73db7b5b5a8f857cb5c8a546,1857
pvp-bounds: both

Another problem on my machine was that the llvm tools couldn't be found which got resolved with export PATH="/opt/homebrew/opt/llvm/bin:$PATH".

nice! I am going to check this out when I get my next mac

You're welcome! :-)

[...] For building I used
stack build --system-ghc --arch=aarch64 --resolver=ghc-8.10.6 --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

which failed with dependency issues. I followed the compilers recommendations and added the extra-deps manually and allow-never: true to stack.yaml:

You had dependency issue because you used ghc-8.10.6 as resolver. If you use GHC as resolver, stack will only use packages provided with that GHC installation. A better way is to use Stackage snapshot, and use either (or both)

compiler-check: newer-minor  -- allows newer minor versions than what's specified in resolver.
compiler: ghc-8.10.6  -- overrides compiler version specified in resolver.

There is --compiler cli flag in case you want to use that.

[...] For some reason I couldn't install stack via GHCup too and kept the homebrew version. [...]

A commor error is insufficient space for temp dir (directory used for compiling/extracting). If it's a compiling error instead, you may report this in Stack repo -- https://github.com/commercialhaskell/stack/.

Hey guys,
I just want to triple check that everything works on M1 now after a couple of days, before I order a new mac myself.

@molleweide, no issues so far (day 3). Well, it performs the same as on intel mac. I still get sometimes "endlessly" repeating key presses. I assumed this to be an issue with stuck keys on my crappy MBP 2016 keyboard but it seems to be a software issue (probably when machine is under high load).

Great to hear!!!
I get an IPC error on my current mac which is quite old with Catalina so now I cannot use Kmonad at all which feels a bit like being put back in the stone ages. As I mentionned before I will use this thread as a reference when building on my new machine.

@franco I have the same issues both on a Intel and a M1 Mac. I also think it has to do with the load of the machine. Are you using Emacs by any chance? I sometimes have the feeling it gets more intense then using Emacs, but I might be mistaken.

@nightscape I'm not using Emacs. Do you run kmonad via launchd or  manually from terminal? I've noticed the problem so far only when running kmonad from terminal.

I'm running from the terminal. Wouldn't have thought this could cause an issue, but I'll definitely give the launchd option a try after my vacation!

i am not getting the build to succeed on my m1 mac. i am trying to test a couple of different combinations and see which one outputs the least errors.

Note: I don't have M1, and haven't compiled for M1 either. So, this is all a summary of what I understood from the internet. :-)

Dependencies:

dext's version should be: 1.15.0. Latest version is not supported atm.
For GHC, I suggest 8.10.7 as this has fixed a critical bug on macOS.
For aarch64, you will also need LLVM 9.0 or greater (upto LLVM 12 supported).
XCode Command-line tools package: probably already installed if you use HomeBrew.

If GHC 8 doesn't work, try GHC 9 (has better support for aarch64).

You won't need --arch flag as latest versions of GHC support aarch64. In my PR, I have changed the Cabal file. Now, you only need to pass the kext/dext flag (no need for includes paths).
stack build --flag kmonad:dext

Change build to install if you want the binaray to be copied to local bin directory (default: ~/.local/bin).

Thanks for replying again.
I will look at all your notes here and test again tomorrow.
One thing that is unclear to me is how did you get the 1.15 version of the dext? I know it is recommendwed in the docs and mentionned in other issues but I don't understand how to install it?

See https://github.com/kmonad/kmonad/issues/366#issuecomment-929490418.

If GHC 8 doesn't work, try GHC 9 (has better support for aarch64).

From what I understand having taken a quick look at the haskell official downloads page it seems that ghc 9.0.1
only is supported for macOS x86_64 at the moment.
https://www.haskell.org/ghc/download_ghc_9_0_1.html

When I add the --arch=aarch64 flag it just sais 'I don't know how to install GHC for OSX,AArch64, hmm??

@molleweide did you add the --system-ghc switch to stack?:
stack --system-ghc build --flag kmonad:dext

This is how I got it to use GHC 9 (that I installed from Homebrew).

Hi man, thanks for chiming in.

I have set system ghc = true under ~/.stack/config.yaml
So it is possible to install GHC 9 even though it doesn't seem to be supported acct. to official page?

I am assuming you are not using GHCup then, right?

I also get the --flag command not found on both my macs after all of you guy's advice lol.

@molleweide I did brew install ghc@9.  I'm not a Haskell'er, so I have know idea if what I'm doing is idiomatic.
I hit a different compilation issue (missing a *.cpp file), that I'll have to debug later.

Hmm cool!
But does your build finish even thought the error with cpp file? I mean, can you use kmo inthe end?

Oops, I must have actually done brew install ghc.  Yeah, I got Kmonad working flawlessly on my Linux laptop.  macOS seems to be a pain for stuff like this :(
My Linux laptop is my personal computer, but we run macOS at work, so naturally I wanted to get Kmonad running on macOS as well.  I have an Intel MacMini, and an M1 laptop that I've been casually trying to get Kmonad running on.  So far I haven't devoted too much time to getting it working.

@molleweide I'm getting the same missing "virtual_hid_device_driver.hpp" file that you are getting in #366 .  That is a file in the folder listed in the "extra-include-dirs" switch, so I'm confused.  I thought that switch was no longer necessary.

@molleweide The command from the Installation README seemed to work, as long as I included the additional --system-ghc flag:
stack --system-ghc build --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

I tried this and got more new errors. Have to look into it tomorrow!

@molleweide I'm getting the same missing "virtual_hid_device_driver.hpp" file that you are getting in #366 . That is a file in the folder listed in the "extra-include-dirs" switch, so I'm confused. I thought that switch was no longer necessary.

Hey you get this error on the intel mac right, not the m1?

@jrop when you are replying here that things work for you I am assuming that you mean on M1 mac? Otherwise, would you mind replying in the intel mac issue that I created. I am going to try to keep everything M1 and intel separated as best as I can.

Another problem on my machine was that the llvm tools couldn't be found which got resolved with export PATH="/opt/homebrew/opt/llvm/bin:$PATH".

I have tried both
export PATH="/usr/local/opt/llvm/bin:$PATH"
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

and I get command not found for both.

If anyone here has actually built kmonad with ghc 9.0.1 on macos M1 please reply to this.

@molleweide Yes these are the steps that worked.  I actually got it running last night!
❯ brew install ghc llvm
❯ ghc -v
Glasgow Haskell Compiler, Version 8.10.7, stage 2 booted by GHC version 8.10.7
❯ brew info llvm
llvm: stable 12.0.1 (bottled), HEAD [keg-only]

These are the packages I have installed on my M1.

omg i have to try that!

@molleweide What does gcc -v show in your terminal?

adding the --arch=aarch64 did the trick!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LOL

adding the --arch=aarch64 did the trick!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LOL

Do you need --arch=aarch64 even if you use GHC aarch64 binary?

According to your build output posted above, it seems the GHC you're using is of x86_64 of version 8.10.7.
aarch64 binary for 8.10.7 is available in haskell.org download page.
Brew installs aarch64 binary for formula - ghc (8.10.7). Stack has added support for installing GHC aarch64 binary, but hasn't released a new version (I think).

If you build KMonad with --arch=aarch64 flag on Intel Mac, were you able to use that in M1 Mac?

If you haven't tried this, can you please do it? This would be helpful for setting up CI.
If you don't want to install LLVM and all those stuffs in your Intel Mac, I can upload a compiled binary.

Yo @MuhammedZakir !
I am not at the computer atm.

The only thing i did in the end was 'brew install ghc llvm'
This applies to both intel and M1. I did uninstall GHCup first.

I will test aarch64 flag on intel tomorrow.

Odd, I did not need the aarch64 flag on the M1.

Are you guys able to run make in ./c_src/mac in order to list keyboards? I get errors here.
Could somebody please post their  M1 keymap? I use a macbook air but that shouldn't matter I believe, right?

If you build KMonad with --arch=aarch64 flag on Intel Mac, were you able to use that in M1 Mac?

If you haven't tried this, can you please do it? This would be helpful for setting up CI.
If you don't want to install LLVM and all those stuffs in your Intel Mac, I can upload a compiled binary.

I think that I missundunderstood you here when you write build with arch on intel?
That is not suppose to work, right?! And it also doesn't work for me :P

It turns out that if I run kmonad in debug mode all of my keypresses seen to be handled correctly BUT nothing actually happens. I am going to go through system pref security and see if I have missed somekind of persmission??

@molleweide based on what you have said previously, I can't help but suspect that your installed gcc is wron on your M1.  What does gcc -v output?  I will try to post the input string from my M1 later this morning.
Also, when debugging unresponsive keyboards, I had this happen to me too, and the situation righted itself after a reboot.   Not sure why this happens....

@molleweide This is my defcfg:
(defcfg
  input  (iokit-name "Apple Internal Keyboard / Trackpad")
  output (kext)
  fallthrough true
)

Thanks!
After rebooting my machine my computer is acting wierd so I have to take a break from this. I get completely new error messages...

So this is unrelated to kmonab, but when I rebooted my machine none of my configs were recognized
and basically no commands worked at all.
Therefore I decided to re-run my dotfiles.
For some reason whilst doing this it reinstalled Homebrew to the old location under usr/local/Homebrew
which I don't understand why and now when I build kmonad I get a completely new error message.
OR it might have been that my computer didn't recognize brew or something. I don't know.
The only thing I know is that things are not working again fml.

This is the error I get now:

```shell
Linking /Users/hjalmarjakobsson/.local/share/stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_<IP_ADDRESS>_ghc-8.10.7 ...
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/Cabal-<IP_ADDRESS>/libHSCabal-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/parsec-<IP_ADDRESS>/libHSparsec-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/template-haskell-<IP_ADDRESS>/libHStemplate-haskell-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/pretty-<IP_ADDRESS>/libHSpretty-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/ghc-boot-th-8.10.7/libHSghc-boot-th-8.10.7.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/text-<IP_ADDRESS>/libHStext-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/mtl-2.2.2/libHSmtl-2.2.2.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/directory-<IP_ADDRESS>/libHSdirectory-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/transformers-<IP_ADDRESS>/libHStransformers-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/unix-<IP_ADDRESS>/libHSunix-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/time-1.9.3/libHStime-1.9.3.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/filepath-<IP_ADDRESS>/libHSfilepath-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/binary-<IP_ADDRESS>/libHSbinary-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/containers-<IP_ADDRESS>/libHScontainers-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/process-<IP_ADDRESS>/libHSprocess-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/bytestring-<IP_ADDRESS>/libHSbytestring-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/integer-gmp-<IP_ADDRESS>/libHSinteger-gmp-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/ghc-prim-0.6.1/libHSghc-prim-0.6.1.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/rts/libHSrts_thr.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/rts/libCffi.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/libexec/integer-gmp/lib/libgmp.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/base-<IP_ADDRESS>/libHSbase-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/deepseq-<IP_ADDRESS>/libHSdeepseq-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/ghc/8.10.7/lib/ghc-8.10.7/array-<IP_ADDRESS>/libHSarray-<IP_ADDRESS>.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_hs_atomicwrite64", referenced from:
     -u command line option
  "_hs_atomicread64", referenced from:
     -u command line option
  "_hs_atomicread16", referenced from:
     -u command line option
  "_hs_atomic_xor16", referenced from:
     -u command line option
  "_hs_atomic_xor8", referenced from:
     -u command line option
  "_hs_atomic_or64", referenced from:
     -u command line option
  "_hs_cmpxchg8", referenced from:
     -u command line option
  "_hs_atomic_or32", referenced from:
     -u command line option
  "_hs_atomic_nand32", referenced from:
     -u command line option
  "_hs_atomic_nand8", referenced from:
     -u command line option
  "_hs_atomic_and64", referenced from:
     -u command line option
  "_hs_atomic_and32", referenced from:
     -u command line option
  "_hs_atomicwrite32", referenced from:
     -u command line option
  "_hs_atomic_and16", referenced from:
     -u command line option
  "_hs_atomic_and8", referenced from:
     -u command line option
  "_hs_atomic_or16", referenced from:
     -u command line option
  "_hs_atomic_sub32", referenced from:
     -u command line option
  "_hs_atomic_sub16", referenced from:
     -u command line option
  "_hs_atomicwrite16", referenced from:
     -u command line option
  "_hs_atomic_add8", referenced from:
     -u command line option
  "_base_GHCziWord_W64zh_con_info", referenced from:
     -u command line option
  "_hs_atomicread8", referenced from:
     -u command line option
  "_base_GHCziWord_W32zh_con_info", referenced from:
     -u command line option
  "_base_GHCziInt_I32zh_con_info", referenced from:
     -u command line option
  "_base_GHCziWord_W16zh_con_info", referenced from:
     -u command line option
  "_hs_atomic_add16", referenced from:
     -u command line option
  "_stg_SRT_2_info", referenced from:
      __u2bi_srt$def in setup-mPHDZzAJ.o
      __u4mo_srt$def in setup-shim-mPHDZzAJ.o
      __u4uO_srt$def in setup-shim-mPHDZzAJ.o
      __u4NR_srt$def in setup-shim-mPHDZzAJ.o
      __u513_srt$def in setup-shim-mPHDZzAJ.o
      __u526_srt$def in setup-shim-mPHDZzAJ.o
  "_base_ControlziExceptionziBase_absentSumFieldError_closure", referenced from:
     -u command line option
  "_base_GHCziConcziSignal_runHandlersPtr_closure", referenced from:
     -u command line option
  "_base_GHCziWord_W8zh_con_info", referenced from:
     -u command line option
  "_base_GHCziInt_I64zh_con_info", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_True_closure", referenced from:
     -u command line option
  "_base_GHCziInt_I8zh_con_info", referenced from:
     -u command line option
  "_base_GHCziPtr_Ptr_con_info", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_Fzh_con_info", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_Czh_con_info", referenced from:
     -u command line option
  "_base_GHCziTopHandler_flushStdHandles_closure", referenced from:
     -u command line option
  "_hs_atomic_xor32", referenced from:
     -u command line option
  "_hs_atomic_sub64", referenced from:
     -u command line option
  "_stg_bh_upd_frame_info", referenced from:
      _s26r_info$def in setup-mPHDZzAJ.o
      _s26q_info$def in setup-mPHDZzAJ.o
      _s26p_info$def in setup-mPHDZzAJ.o
      _s26o_info$def in setup-mPHDZzAJ.o
      _r258_info$def in setup-mPHDZzAJ.o
      _Main_main_info in setup-mPHDZzAJ.o
      _s4fF_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure", referenced from:
     -u command line option
  "_base_GHCziPtr_FunPtr_con_info", referenced from:
     -u command line option
  "_base_ControlziMonadziFail_fail_info", referenced from:
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziConcziSync_runSparks_closure", referenced from:
     -u command line option
  "_base_GHCziIOziException_stackOverflow_closure", referenced from:
     -u command line option
  "_base_GHCziEventziThread_blockedOnBadFD_closure", referenced from:
     -u command line option
  "_base_GHCziIOziException_cannotCompactPinned_closure", referenced from:
     -u command line option
  "_base_GHCziIOziException_cannotCompactFunction_closure", referenced from:
     -u command line option
  "_base_GHCziPack_unpackCString_closure", referenced from:
     -u command line option
  "_stg_ap_p_info", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
      _s4hB_info$def in setup-shim-mPHDZzAJ.o
      _s4ho_info$def in setup-shim-mPHDZzAJ.o
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziSetup_replVerbosity_closure", referenced from:
      _s4gw_info$def in setup-shim-mPHDZzAJ.o
      __u4uK_srt$def in setup-shim-mPHDZzAJ.o
  "_base_ControlziExceptionziBase_nestedAtomically_closure", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_Wzh_con_info", referenced from:
     -u command line option
  "_stg_gc_unpt_r1", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
      _c4N2_info$def in setup-shim-mPHDZzAJ.o
      _c4MT_info$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziInt_I16zh_con_info", referenced from:
     -u command line option
  "_hs_main", referenced from:
      _main in ghc_2.o
  "_base_GHCziConcziIO_ensureIOManagerIsRunning_closure", referenced from:
     -u command line option
  "_stg_SRT_5_info", referenced from:
      __u4uM_srt$def in setup-shim-mPHDZzAJ.o
  "_hs_atomic_add64", referenced from:
     -u command line option
  "_stg_ap_pp_info", referenced from:
      _StackSetupShim_mainOverride_info in setup-shim-mPHDZzAJ.o
  "_base_SystemziEnvironment_getArgs_closure", referenced from:
      _StackSetupShim_mainOverride_info in setup-shim-mPHDZzAJ.o
      __u513_srt$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziBase_zgzgze_info", referenced from:
      _StackSetupShim_mainOverride_info in setup-shim-mPHDZzAJ.o
  "_stg_ap_0_fast", referenced from:
      _c4MT_info$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziIOziException_allocationLimitExceeded_closure", referenced from:
     -u command line option
  "_base_GHCziStable_StablePtr_con_info", referenced from:
     -u command line option
  "_base_GHCziBase_return_info", referenced from:
      _s4hB_info$def in setup-shim-mPHDZzAJ.o
      _s4ho_info$def in setup-shim-mPHDZzAJ.o
  "_hs_atomic_or8", referenced from:
     -u command line option
  "_stg_ap_pppppp_fast", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
  "_defaultRtsConfig", referenced from:
      _main in ghc_2.o
  "_hs_atomic_nand16", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziSetup_replDistPref_closure", referenced from:
      _s4gj_info$def in setup-shim-mPHDZzAJ.o
      __u4uI_srt$def in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziClasses_zaza_closure", referenced from:
      _s4hD_info$def in setup-shim-mPHDZzAJ.o
      _s4hD_closure$def in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziTypes_False_closure", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_TrNameS_con_info", referenced from:
      _r25h_closure$def in setup-mPHDZzAJ.o
      _r25j_closure$def in setup-mPHDZzAJ.o
      _r4fv_closure$def in setup-shim-mPHDZzAJ.o
      _r4fx_closure$def in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziTuple_Z0T_closure", referenced from:
      _s4hB_info$def in setup-shim-mPHDZzAJ.o
  "_stg_INTLIKE_closure", referenced from:
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
  "_Cabalzm3zi2zi1zi0_DistributionziTypesziHookedBuildInfo_emptyHookedBuildInfo_closure", referenced from:
      _s4ho_info$def in setup-shim-mPHDZzAJ.o
      __u4NR_srt$def in setup-shim-mPHDZzAJ.o
  "_Cabalzm3zi2zi1zi0_DistributionziSimple_simpleUserHooks_closure", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
      _s4hC_info$def in setup-shim-mPHDZzAJ.o
      __u4uN_srt$def in setup-shim-mPHDZzAJ.o
  "_stg_ap_ppppp_fast", referenced from:
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
  "_hs_atomic_xor64", referenced from:
     -u command line option
  "_hs_atomic_sub8", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziBuild_initialBuildSteps_closure", referenced from:
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
      __u4uM_srt$def in setup-shim-mPHDZzAJ.o
  "_stg_SRT_1_info", referenced from:
      __u26I_srt$def in setup-mPHDZzAJ.o
      __u4hO_srt$def in setup-shim-mPHDZzAJ.o
      __u4uI_srt$def in setup-shim-mPHDZzAJ.o
      __u4uK_srt$def in setup-shim-mPHDZzAJ.o
      __u4NS_srt$def in setup-shim-mPHDZzAJ.o
      __u4NU_srt$def in setup-shim-mPHDZzAJ.o
  "_newCAF", referenced from:
      _s26r_info$def in setup-mPHDZzAJ.o
      _s26q_info$def in setup-mPHDZzAJ.o
      _s26p_info$def in setup-mPHDZzAJ.o
      _s26o_info$def in setup-mPHDZzAJ.o
      _r258_info$def in setup-mPHDZzAJ.o
      _Main_main_info in setup-mPHDZzAJ.o
      _s4fF_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_ghczmprim_GHCziTypes_ZMZN_closure", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
  "_Cabalzm3zi2zi1zi0_DistributionziSimple_defaultMainWithHooks_closure", referenced from:
      _c4MT_info$def in setup-shim-mPHDZzAJ.o
      __u4NV_srt$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziIOziException_heapOverflow_closure", referenced from:
     -u command line option
  "_ghczmprim_GHCziTypes_Dzh_con_info", referenced from:
     -u command line option
  "_base_GHCziBase_eqString_closure", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      __u4uO_srt$def in setup-shim-mPHDZzAJ.o
  "_base_DataziFoldable_null_info", referenced from:
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
  "_hs_cmpxchg16", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziFlag_fromFlag_closure", referenced from:
      _s4gx_info$def in setup-shim-mPHDZzAJ.o
      _s4gk_info$def in setup-shim-mPHDZzAJ.o
      __u4uJ_srt$def in setup-shim-mPHDZzAJ.o
      __u4uL_srt$def in setup-shim-mPHDZzAJ.o
  "_hs_cmpxchg32", referenced from:
     -u command line option
  "_base_ControlziMonadziFail_zdfMonadFailIO_closure", referenced from:
      _c4s5_info$def in setup-shim-mPHDZzAJ.o
      __u4uM_srt$def in setup-shim-mPHDZzAJ.o
  "_hs_atomicwrite8", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziUserHooks_replHook_closure", referenced from:
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
      __u4uN_srt$def in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziClasses_zdfEqChar_closure", referenced from:
      _r4fz_info$def in setup-shim-mPHDZzAJ.o
      __u4mo_srt$def in setup-shim-mPHDZzAJ.o
  "_stg_ap_p_fast", referenced from:
      _Main_main_info in setup-mPHDZzAJ.o
      _r4fz_info$def in setup-shim-mPHDZzAJ.o
      _s4gw_info$def in setup-shim-mPHDZzAJ.o
      _s4gj_info$def in setup-shim-mPHDZzAJ.o
      _ZCMain_main_info in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziClasses_zdfEqZMZN_closure", referenced from:
      _r4fz_info$def in setup-shim-mPHDZzAJ.o
      __u4mo_srt$def in setup-shim-mPHDZzAJ.o
  "_hs_atomic_add32", referenced from:
     -u command line option
  "_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure", referenced from:
     -u command line option
  "_base_GHCziTopHandler_runNonIO_closure", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimpleziUserHooks_UserHooks_con_info", referenced from:
      _c4N2_info$def in setup-shim-mPHDZzAJ.o
  "_hs_cmpxchg64", referenced from:
     -u command line option
  "_base_GHCziTopHandler_runMainIO_closure", referenced from:
      _ZCMain_main_info in setup-shim-mPHDZzAJ.o
      __u526_srt$def in setup-shim-mPHDZzAJ.o
  "_stg_ap_pp_fast", referenced from:
      _r258_info$def in setup-mPHDZzAJ.o
      _r4fy_info$def in setup-shim-mPHDZzAJ.o
      _r4fA_info$def in setup-shim-mPHDZzAJ.o
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gx_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
      _s4gk_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_stg_ap_ppp_info", referenced from:
      _s4gC_info$def in setup-shim-mPHDZzAJ.o
      _s4gA_info$def in setup-shim-mPHDZzAJ.o
  "_stg_SRT_4_info", referenced from:
      __u4uN_srt$def in setup-shim-mPHDZzAJ.o
      __u4NV_srt$def in setup-shim-mPHDZzAJ.o
  "_hs_atomicread32", referenced from:
     -u command line option
  "_base_DataziFoldable_elem_info", referenced from:
      _s4gC_info$def in setup-shim-mPHDZzAJ.o
      _s4gA_info$def in setup-shim-mPHDZzAJ.o
  "_base_GHCziTopHandler_runIO_closure", referenced from:
     -u command line option
  "_base_GHCziStackziTypes_emptyCallStack_closure", referenced from:
      _r258_info$def in setup-mPHDZzAJ.o
      __u2al_srt$def in setup-mPHDZzAJ.o
      _r4fy_info$def in setup-shim-mPHDZzAJ.o
      _r4fA_info$def in setup-shim-mPHDZzAJ.o
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
      _c4rM_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure", referenced from:
     -u command line option
  "_Cabalzm3zi2zi1zi0_DistributionziSimple_defaultMain_closure", referenced from:
      _Main_main_info in setup-mPHDZzAJ.o
      __u2bi_srt$def in setup-mPHDZzAJ.o
  "_ghczmprim_GHCziTypes_Module_con_info", referenced from:
      _Main_zdtrModule_closure in setup-mPHDZzAJ.o
      _StackSetupShim_zdtrModule_closure in setup-shim-mPHDZzAJ.o
  "_base_GHCziIOziException_cannotCompactMutable_closure", referenced from:
     -u command line option
  "_stg_ap_n_fast", referenced from:
      _s26r_info$def in setup-mPHDZzAJ.o
      _s26q_info$def in setup-mPHDZzAJ.o
      _s26p_info$def in setup-mPHDZzAJ.o
      _s26o_info$def in setup-mPHDZzAJ.o
      _s4fF_info$def in setup-shim-mPHDZzAJ.o
      _s4fE_info$def in setup-shim-mPHDZzAJ.o
      _s4fD_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_stg_upd_frame_info", referenced from:
      _s4g4_info$def in setup-shim-mPHDZzAJ.o
      _s4g7_info$def in setup-shim-mPHDZzAJ.o
      _s4gw_info$def in setup-shim-mPHDZzAJ.o
      _s4go_info$def in setup-shim-mPHDZzAJ.o
      _s4gn_info$def in setup-shim-mPHDZzAJ.o
      _s4gm_info$def in setup-shim-mPHDZzAJ.o
      _s4gl_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_stg_SRT_3_info", referenced from:
      __u2al_srt$def in setup-mPHDZzAJ.o
      __u4lr_srt$def in setup-shim-mPHDZzAJ.o
      __u4qU_srt$def in setup-shim-mPHDZzAJ.o
      __u4uH_srt$def in setup-shim-mPHDZzAJ.o
      __u4uJ_srt$def in setup-shim-mPHDZzAJ.o
      __u4uL_srt$def in setup-shim-mPHDZzAJ.o
      __u4NT_srt$def in setup-shim-mPHDZzAJ.o
      ...
  "_ghczmprim_GHCziTuple_Z2T_con_info", referenced from:
      _s26x_closure$def in setup-mPHDZzAJ.o
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
      _s4fL_closure$def in setup-shim-mPHDZzAJ.o
      _s4fV_closure$def in setup-shim-mPHDZzAJ.o
  "_base_ControlziExceptionziBase_nonTermination_closure", referenced from:
     -u command line option
  "_base_GHCziWeak_runFinalizzerBatch_closure", referenced from:
     -u command line option
  "_base_GHCziStackziTypes_SrcLoc_con_info", referenced from:
      _s26w_closure$def in setup-mPHDZzAJ.o
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
      _s4fK_closure$def in setup-shim-mPHDZzAJ.o
      _s4fU_closure$def in setup-shim-mPHDZzAJ.o
  "_hs_atomic_nand64", referenced from:
     -u command line option
  "_ghczmprim_GHCziCString_unpackCStringzh_closure", referenced from:
      _s26r_info$def in setup-mPHDZzAJ.o
      _s26q_info$def in setup-mPHDZzAJ.o
      _s26p_info$def in setup-mPHDZzAJ.o
      _s26o_info$def in setup-mPHDZzAJ.o
      __u26I_srt$def in setup-mPHDZzAJ.o
      _s4fF_info$def in setup-shim-mPHDZzAJ.o
      _s4fE_info$def in setup-shim-mPHDZzAJ.o
      ...
  "_base_GHCziStackziTypes_pushCallStack_closure", referenced from:
      _r258_info$def in setup-mPHDZzAJ.o
      __u2al_srt$def in setup-mPHDZzAJ.o
      _r4fy_info$def in setup-shim-mPHDZzAJ.o
      _r4fA_info$def in setup-shim-mPHDZzAJ.o
      _s4gv_info$def in setup-shim-mPHDZzAJ.o
      _s4gi_info$def in setup-shim-mPHDZzAJ.o
      __u4lr_srt$def in setup-shim-mPHDZzAJ.o
      ...
  "_base_GHCziBase_zdfMonadIO_closure", referenced from:
      _s4hB_info$def in setup-shim-mPHDZzAJ.o
      _s4ho_info$def in setup-shim-mPHDZzAJ.o
      _StackSetupShim_mainOverride_info in setup-shim-mPHDZzAJ.o
      __u4NR_srt$def in setup-shim-mPHDZzAJ.o
      __u4NS_srt$def in setup-shim-mPHDZzAJ.o
  "_base_DataziFoldable_zdfFoldableZMZN_closure", referenced from:
      _c4s0_info$def in setup-shim-mPHDZzAJ.o
      _s4gC_info$def in setup-shim-mPHDZzAJ.o
      _s4gA_info$def in setup-shim-mPHDZzAJ.o
      __u4uN_srt$def in setup-shim-mPHDZzAJ.o
      __u4NW_srt$def in setup-shim-mPHDZzAJ.o
  "_ghczmprim_GHCziTypes_Izh_con_info", referenced from:
      _s26v_closure$def in setup-mPHDZzAJ.o
      _s26u_closure$def in setup-mPHDZzAJ.o
      _s26t_closure$def in setup-mPHDZzAJ.o
      _s26s_closure$def in setup-mPHDZzAJ.o
      _s4fJ_closure$def in setup-shim-mPHDZzAJ.o
      _s4fI_closure$def in setup-shim-mPHDZzAJ.o
      _s4fH_closure$def in setup-shim-mPHDZzAJ.o
      ...
ld: symbol(s) not found for architecture arm64
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)
--  While building simple Setup.hs (scroll up to its section to see the error) using:
/usr/local/Cellar/ghc/8.10.7/bin/ghc-8.10.7 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-<IP_ADDRESS> /Users/hjalmarjakobsson/.local/share/stack/setup-exe-src/setup-mPHDZzAJ.hs /Users/hjalmarjakobsson/.local/share/stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /Users/hjalmarjakobsson/.local/share/stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_<IP_ADDRESS>_ghc-8.10.7
Process exited with code: ExitFailure 1
</details>

This seems like the root issue:
building for macOS-arm64 but attempting to link with file built for macOS-x86_64

Somewhere on your system, my guess is that you have an x86_64 program/compiler, and it is running under Rosetta, which is confusing matters.
What is the output of gcc -v?

Now this is the output:

❯ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.2.0/libexec/gcc/aarch64-apple-darwin20/11.1.0/lto-wrapper
Target: aarch64-apple-darwin20
Configured with: ../configure --prefix=/opt/homebrew/Cellar/gcc/11.2.0 --libdir=/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin20 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Homebrew GCC 11.2.0)

I think that I missundunderstood you here when you write build with arch on intel?
That is not suppose to work, right?! And it also doesn't work for me :P

I don't know. I was wondering if cross-compilation is supported.

About KMonad not remapping keys:

Have you done all the required steps for Mac mentioned in doc/installation.md?
KMonad needs admin privilege, so run it using sudo.
If Karabiner-Elements is running, for all the keyboards you wanna remap using KMonad, you'll have to disable capturing for them in Karabiner-Elements.

Note: Currently, KMonad doesn't exit when it couldn't capture keyboard (even though it should). I will try to fix that after Keycode refactor PR is merged.

IIRC, karabiner-observer and karabiner-grabber are installed by Karabiner-Elements. KMonad doesn't need them.

Maybe I should reinstall Homebrew to make sure that it install correctly since it installed to /usr/local/ now which is the old way that homebrew installs. First it installed to /opt/homebrew/ which is still there on my system.

I recommend you to do that. When stuff like this happens, it's better to do remove them and do a clean installation. Otherwise, it could create unexpected issues. It will also be hard to debug when that happens.

About list-keyboards compilation error: It looks like the error has to do with SDK rather than our code. Either update Command-Line Tools (if availabe), or re-install them. If, after that, you're still not able to compile it, then it's better to ask _@_thoelze1.

@MuhammedZakir @molleweide
Yeah, it looks like your gcc is not the XCode one, but a Homebrew one.  On my M1, I'm using the XCode gcc.  Seems like that second installation of Homebrew messed with your system.

Thanks for replying again.
Yes I have followed the macos instructions and by now I think I can recall it from memory really well :P
I don't use karabiner anymore on my old mac so i uninstalled it but those most have been leftovers. They don't seem to interfere with kmonad luckilly.
I will look into reinstalling homebrew then!

Since I have a seemingly working build of kmonad (left from before my homebrew issue) on my m1 macbook that seems to run but the only problem is that nothing happens when I type, @thoelze1 do you know what the issue could be here?

Maybe you have checked this:

Is your installed dext 1.15.0?
Did you run KMonad using sudo?
What is the output of sudo kmonad -l info <config>?

I have made sure to follow steps 1 and 2, also as I mention higher up in this discussion running in debug mode shows
that my key presses are registered and does what they are supposed to.
When I follow step 3 nothing happens. It only shows the initial "debug" output and then nothing happens when I press keys.
What I mean with inital output are the top lines that you can see in my screenshot if you scroll up in this thread.

Sorry, I didn't see that screenshot.
Some troubleshooting steps I did or found for similiar problems:

Restart your Mac.
Use a different terminal and enable Input Monitoring for it.
If Input Monitoring is already enabled, disable and enable it again.

Cool, thanks for being so helpful you guys!

I recommend you to do that. When stuff like this happens, it's better to do remove them and do a clean installation. Otherwise, it could create unexpected issues. It will also be hard to debug when that happens.

I see now that if I run uname -m in terminal it returns x86_64 but it returned (should return) arm64 before.
This is why all of my brew packages reinstalled.
How on earth is this possible when the only thing I did was reboot my computer?!

Update
homebrew
I am running the Alacritty terminal emulator on MacOS.
After rebooting my M1 Macbook Air running uname -m returns x86_64
when it previously returned arm64 pre rebooting.
If I check the same command in the regular Terminal.app. it returns
arm64. How is this possible?!
Does anyone know where to ask for help on this issue?
kmonad
Since the regular terminal app shows arm64 I ran my installer script
over there and the build worked!! However, kmonad is still unresponsive.
Even though debug shows that all keys are being processed.
So, in the end the kmonad is still unresponsive and I have to find out why alavritty show x86.

Restart your Mac.
Use a different terminal and enable Input Monitoring for it.
If Input Monitoring is already enabled, disable and enable it again.

I have now tried this with Alacritty, Kitty, and regular Terminal.app and none of these work.

I have come up with a new way of checking for intel/M1 in my scripts that works regardless
if I use alacritty or kitty or whatever. I will post this later in a PR.
I also have an ergodox that I have to test with my M1 to see if that one works in order to
narrow down the problem to see if this is only an apple keyboard problem.
Who here is using macbook air M1?? Is everybody using macbook pros???

@molleweide I have an M1 MacBook Pro.  I am usint Kitty, and uname -m shows arm64 for me.

@jrop: To get KMonad working, did you had to anything else other than enabling Input Monitoring for the app/terminal you use to run KMonad? Please check if you allowed any other permissions for the app/terminal or KMonad.
@molleweide: Did you "activate" the dext after installating it? The command is in the installation doc.

@molleweide: Did you "activate" the dext after installating it? The command is in the installation doc.

Yes that was it!! Now it is working. OMG thanks for bearing with my stupidity.
Now kmonad is running on all my machines.

@molleweide: Good to know if worked for you! :-D For list-keyboards, IIAR, you can compile it in Intel for M1 by adding -arch arm64 to the command in Makefile. You can create a universal binary by adding one more flag: -arch x86_64. Hopefully, this works.

Am I doing this correctly? I still get this error. I also made sure to update commandline.
gcc list-keyboards.c -o list-keyboards -framework IOKit -framework CoreFoundation -arch arm64
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDLib.h:31,
                 from list-keyboards.c:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDDevice.h:295:34: error: unknown type name 'dispatch_block_t'; did you mean 'dispatch_io_t'?
  295 |                                  dispatch_block_t               handler)
      |                                  ^~~~~~~~~~~~~~~~
      |                                  dispatch_io_t
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDLib.h:35,
                 from list-keyboards.c:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDManager.h:292:33: error: unknown type name 'dispatch_block_t'; did you mean 'dispatch_io_t'?
  292 |                                 dispatch_block_t                handler)
      |                                 ^~~~~~~~~~~~~~~~
      |                                 dispatch_io_t
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDLib.h:36,
                 from list-keyboards.c:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDQueue.h:294:33: error: unknown type name 'dispatch_block_t'; did you mean 'dispatch_io_t'?
  294 |                                 dispatch_block_t                handler)
      |                                 ^~~~~~~~~~~~~~~~
      |                                 dispatch_io_t
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDShared.h:260,
                 from list-keyboards.c:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:50:62: error: 'deprecated' undeclared here (not in a function)
   50 |         boolean_t enable ) __attribute__((availability(macos,deprecated=11.0)));
      |                                                              ^~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDShared.h:260,
                 from list-keyboards.c:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:68:97: error: 'message' undeclared here (not in a function); did you mean 'IOMessage'?
   68 |                 IOOptionBits        options ) __attribute__((availability(macos,deprecated=11.0,message=HIDPostEventDeprecatedMsg)));
      |                                                                                ^~~~~~~
      |                                                                                IOMessage
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:78:108: error: 'introduced' undeclared here (not in a function)
   78 | IOHIDGetScrollAcceleration( io_connect_t handle, double * acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
      |                                                                                ^~~~~~~~~~
make: *** [all] Error 1

Was that on an Intel Mac? I am able to compile it on mine. But, I may not be using the latest Command-Line Tools.
Here is a universal binary: https://transfer.sh/JcSz5a/list-keyboards. You may have to run chmod u+x ./list-keyboards to make it executable.

No it's on M1 alacritty. I should test make in another terminal also.
Cool. Is there a specific tool you'd recommend for scanning?

If that's the case, try compiling on Intel. Hopefully, that should work.
When I mentioned compiling, I was referring to compiling on Intel Mac for M1:

[...] you can compile it in Intel for M1 [...]

Ah now i understand. Compile on M1 and transfer it to the M1. I'll try that later. I recall it working last time i tried a couple months ago.

Don't forget to add -arch arm64 -arch x86_64. I want to know if the universal binary is working correctly. If it's working, I will put it in c_src/mac/ to avoid problem like this.

Just to be sure, you mean litterally add both flags?

Yes. Append those flags to the command just like you did above:
gcc list-keyboards.c -o list-keyboards -framework IOKit -framework CoreFoundation -arch arm64 -arch x86_64

If do it like so:
all: list-keyboards.c
	gcc $< -o list-keyboards -framework IOKit -framework CoreFoundation -arch x86_64 -arch arm64

it generates this:
> make
gcc list-keyboards.c -o list-keyboards -framework IOKit -framework CoreFoundation -arch x86_64 -arch arm64
gcc: error: this compiler does not support arm64
make: *** [all] Error 1

:sweat_smile: I don't know why you're getting that same error on both Intel and M1. I presume you're using Big Sur on M1?
FYI, I complied the universal binary on an Intel Mac with Big Sur (I don't remember the version - definitely not the latest).

Yeah it is wierd bc I know it worked before. The error is not exactly the same but similar.
cc works on intel!

cc with both flags fail for arm it seems

Nice to hear cc worked. When you mentioned "cc worked on Intel", did you mean you were able to compile for arm64, or only for Intel (x86_64)?

Only x86

Can you try arm and universal binaries from this Github action*?
* https://github.com/MuhammedZakir/kmonad/actions/runs/1304750441

Yeah sure! Based on your previous comment i assume github prescans all binaries?

Yeah sure! Based on your previous comment i assume github prescans all binaries?

Probably not. It was my first time using that service. I don't know any details nor have any experience with them. That's why, I said it better to scan them before using*. Comparitively, Github is less likely to do such a thing.
About the link I posted above: I didn't touch the binary. Those were upload by GHA runners after building them from the source. You can view the workflow file of that Github Action to see what it did.
* It is also a good idea to do that when you download an uploaded file, no matter how reputed that uploader is. Many incidents have happened previously when highly-reputed users' accounts were compromised.

Allright interesting, I have never downloaded binaries like this so I didn't know about scanning before.

I spent a little over 2 days sorting all this out, so I put my notes together in the hopes that this will be helpful to someone.  So far, KMonad has been amazing and well worth the effort!  And thanks to everyone here for the directions and advice!
Caveat: I haven't run through these steps on a fresh Mac, so this is a "best guess" based on my notes.  I included them at the end of the "Resources" section near the bottom.  If the instructions here don't work, you may find it useful.
First some assumptions:

This is for M1 Macs!
Check your OS version.  These instructions assume you're using Monterey (specifically I was on 12.0.1).
This also assumes that you will be using the dext (not the kext).
Do you have Karabiner-Elements installed?  See the Karabiner section at the bottom.

NOTE: The commands here are copy/pasted from actual interpreter sessions, including the prompt and in some cases the output.
When you're copy/pasting don't copy the prompt!
Clone the KMonad repo
❯ cd ~/dev  # Or wherever you keep your repos
❯ git clone --recursive https://github.com/kmonad/kmonad.git
❯ cd kmonad

All further instructions here assume you're in the root of the kmonad repo.
Install the dext
After running the first command I believe I had to "allow" it through "System Preferences -> Security and Privacy -> General".
❯ open c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/dist/Karabiner-DriverKit-VirtualHIDDevice-1.15.0.pkg

# Double check the version.  This should output: 1.15.0
❯ defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion

# Very important!  Activate the `dext`!
❯ /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate

After activating the dext you will need to give it "input monitoring" permission.  Go to "System Preferences -> Security & Privacy -> Privacy -> Input Monitoring" and check the boxes for karabiner_grabber and karabiner_observer.  (I was previously a Karabiner user, so you might not have both of those if you weren't.)
Install system dependencies
You'll need a few things to compile KMonad.  Haskell support for the M1 seems to be pretty sketchy at the moment, but using the packages from Homebrew seems to be fairly reliable.
First, let's make sure your shell is not running with Rosetta.  At some point you may have followed some (IMO bad) advice like this which may make it confusing or even hard to build a full ARM toolchain.  If you see anything other than arm64 from the command below, you need to sort that out before continuing.
❯ uname -m
arm64

You may also want to check that homebrew is running on ARM.  There's probably a more robust way of doing this, but running brew config seems to output relevant information.  If you see any "Intel" or "x86" stuff in there, you have a problem.
❯ brew config
HOMEBREW_VERSION: 3.3.8
[[ snip ]]
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.32.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.0.1-arm64
CLT: <IP_ADDRESS>.1.1627064638
Xcode: 13.2.1
Rosetta 2: false

Okay, now let's start installing stuff.
First make sure you have the command line tools.  If you've upgraded the OS recently you may need to reinstall them.
❯ xcode-select --install

Then install LLVM:
❯ brew install llvm@12

Currently only version 12 is supported, so install that and follow the instructions afterward to add it to your PATH as well as add the compiler flags.  I added the following to my .zshrc:
export PATH="/opt/homebrew/opt/llvm@12/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

I'm not sure if adding the @12 to the LD/CPPFLAGS is necessary, but I didn't seem to have problems without it.  However the @12 was necessary for the PATH since I also have v13 installed.
The rest of the tools are straightforward:
❯ brew install ghc
❯ brew install haskell-stack

Check Assumptions
# Your terminal is running in running in arm64 mode.
# If this outputs `x86_64` these instructions probably won't work.
❯ uname -m
arm64

# Should look something like this.  Getting `homebrew` stuff might be a problem.
❯ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-13<IP_ADDRESS>)
Target: arm64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

❯ stack --version
Version 2.7.3 aarch64

❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7

Compile KMonad
I think the first compilation takes around 10-20 minutes on a new-ish MacBook Air.  Subsequent runs will be much quicker as you won't have to recompile all the libraries.
❯ stack --system-ghc --compiler ghc-8.10.7 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

Assuming it compiled successfully, check that it works:
❯ kmonad --version
0.4.1, commit f33b513bd153dc4beaebdd3b4dd6ed83a523ad69

# Run this, then press some keys, you should see something similar to this.
# Use `control-c` to exit.
❯ sudo kmonad keymap/template/apple.kbd -l debug
Opening KeySink
Initializing Mac key sink
Opening KeySource
Opening IOKit devices
Launching process: emitter_proc
connected

--------------------------------------------------------------------------------
Received event: Press <a>
Running hooks
Registering untimed hook: 1
Emitting: Press <a>
a
--------------------------------------------------------------------------------
Received event: Release <a>
Running hooks
Emitting: Release <a>

--------------------------------------------------------------------------------
Received event: Press <ctl>
Running hooks
Registering untimed hook: 2
Emitting: Press <ctl>

--------------------------------------------------------------------------------
Received event: Press <c>
Running hooks
Registering untimed hook: 3
Registering untimed hook: 4
Emitting: Press <c>
^CClosing process: emitter_proc
Closing KeySource
Closing IOKit devices
Closing KeySink
Closing Mac key sink

Congratulations!
Should you need to recompile after the first build, it appears that you can leave off the --extra-include-dirs flag:
stack --system-ghc --compiler ghc-8.10.7 install --flag kmonad:dext

When I omitted it before my first successful build, I got:
fatal error: 'virtual_hid_device_driver.hpp' file not found

Troubleshooting
Activating the dext fails because there's a newer version
❯ /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate

activation of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is requested
request of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is canceled because newer version (1.6.0) is already installed
request of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is failed with error: The operation couldn’t be completed. (OSSystemExtensionErrorDomain error 11.)

This may happen if you have previously installed Karabiner-Elements.  "Forcing it" seemed to work for me with no ill-effects.
❯ /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager forceActivate

activation of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is requested
org.pqrs.Karabiner-DriverKit-VirtualHIDDevice will be force replaced to 1.0.0 forcely
request of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is finished
request of org.pqrs.Karabiner-DriverKit-VirtualHIDDevice is completed

Non-Homebrew Haskell Toolchain Installation
I've read about lots of (surprising} problems related to other Haskell and associated tooling installation methods, including GHCup.  See the "References" section below if you don't want to go the Homebrew route.
This is the first time I've ever compiled any Haskell program, so I really have very limited information about all this.
Relevant Issues/Discussion

#334 Apple M1

#366 Macbook Pro intel build fail (not M1)

#418 MacOS bluetooth keyboard reconnection support in Monterey, etc

stack setup installs GHC for aarch64 on M1 Macs

#5617 stack build - I don't know how to install GHC for (OSX,AArch64), please install manually

Newer versions of stack is able to install ghc for aarch64. You can install it using:

brew install --HEAD stack

And finally you can find my unabridged build log here.

KMonad currently requires a version of the dext no later than 1.15.0 and Karabiner is on something like 1.27.0.

It appears that you cannot have 2 versions of the Karabiner dext installed, and IIRC Karabiner won't work with 1.15.0.
I would highly recommend uninstalling Karabiner, or at least disable any auto-updating so the dext stays at the proper version for KMonad.

The Karabiner EventViewer is nice for getting keycodes and such, but installing it to grab a keycode after you've installed KMonad will probably bork your KMonad, at least it did for me (this will likely be due to the dext being updated, and you can fix by reinstalling 1.15.0 and reactivating it).

I tested this instructions on my mac m1 pro (macos 13.2.1) and it kind of worked. Kmonad was compiled but still saw some "error messages". I was able to create layouts for my DNA 59. :)

For information, I tested on a M2, and it worked 🚀  (but only with the brew install<EMAIL_ADDRESS>not with the last ghc).

Tested the above instructions on an M1 mbp running Sonoma 14.0, and everything worked end to end. No additional steps were needed for me. Thanks @ellamental for the detailed guide.

Thanks @ellamental for the thorough instructions. On thing to note is that the dext has been updated (see https://github.com/kmonad/kmonad/pull/716) so with the latest version of kmonad you need to install and activate 2.1.0 instead of 1.15.0 as described in the instructions above. With 2.1.0 everything is working for me on macos Sonoma on an M1 Max chip

Hey @pageegap,  re this:

From time to time kmonad out of the blue dies with a message on "kmonad: [Cannot translate from mac keycode: (7,101)]" not sure if this is related to the errors/warnings I saw.

What physical keyboard layout do you have? I had a very similar issue "mac keycode: (7,100)".  (only difference from your error is mine was 100 not 101).  I found that the issue was the following:

I have a UK ISO layout keyboard, not US ANSI (to identify yours, if you're not sure, see here).  This means I have an 'extra' key, which sends mac keycode (7,100), but kmonad is not configured to know what to do with this input.
For me, the fix was simply uncommenting and editing the line where kmonad specifies how to translate this keycode,
changing src/KMonad/Keyboard/IO/Mac/Types.hs#L217 from the commented-out
-- , ((0x7,0x64), KeyNonUSBackslash)

to uncommented (and changing the key it refers to to Key102d, as specified in
  , ((0x7,0x64), Key102nd)

(note 100 in decimal is 64 in hexadecimal)
Then, I re-built kmonad, and it worked, no longer crashing when I pressed that key.

I imagine maybe you need to do something similar for key (0x7,0x65) (which happens to be commented out as well, the line in Types.hs following the one I modified).  You could change it to anything, like try F13 or some other key which is defined in the file src/KMonad/Keyboard/Keycode.hs, so it translates that mac keycode to something you can use.  Might solve the issue.

After dealing with this all day I found that the version of karabiner I need it on my case (sonoma 14.4.1) was 3.1.0-the current latest, instead of 2.1.0 or 1.15
So what you have to do is:
`
open c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/dist/Karabiner-DriverKit-VirtualHIDDevice-3.1.0.pkg
Double check the version.  This should output: 3.1.0
defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion
Very important!  Activate the dext!
/Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate`
If you allready had a different driver version installed you can check this with systemextensionsctl list and delete the old version with systemextensionsctl reset

Just got kmonad working successfully on an Apple M3 Pro running macOS Sequoia 15.1 by following the installation instructions for macOS.
Tips

Input can omit the string to apply to all keyboards: input (iokit-name)
Output should be kext even if you install the dext: output (kext)
Example Apple keyboard template
All possible keycodes


New public sector accessibility standards

Note to track the new accessibility standards for public sector sites: https://gds.blog.gov.uk/2018/11/21/public-sector-website-accessibility-statements-what-you-need-to-know/

We are working on this now