cruegge / pam-gnupg

Unlock GnuPG keys on login
GNU General Public License v3.0
269 stars 12 forks source link

Cannot build on MacOS #46

Open Troublor opened 1 year ago

Troublor commented 1 year ago

I tried to build on MacOS using make and got the following error:

/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT helper.o -MD -MP -MF .deps/helper.Tpo -c -o helper.o helper.c
helper.c:13:10: fatal error: 'wait.h' file not found
#include <wait.h>
         ^~~~~~~~
1 error generated.
make[2]: *** [helper.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

What dependency needs to be installed?

cruegge commented 1 year ago

I changed the wait.h include path. Can you see if it works? I unfortunately can't test on MacOS.

Troublor commented 1 year ago

Unfortunately, still error

/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT helper.o -MD -MP -MF .deps/helper.Tpo -c -o helper.o helper.c
helper.c:66:27: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (line[len - 1] = '\n') {
            ~~~~~~~~~~~~~~^~~~~~
helper.c:66:27: note: place parentheses around the assignment to silence this warning
        if (line[len - 1] = '\n') {
                          ^
            (                   )
helper.c:66:27: note: use '==' to turn this assignment into an equality comparison
        if (line[len - 1] = '\n') {
                          ^
                          ==
helper.c:178:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (pipe2(pipefd, O_CLOEXEC) < 0) {
        ^
helper.c:178:9: note: did you mean 'pipe'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:470:6: note: 'pipe' declared here
int      pipe(int [2]);
         ^
1 warning and 1 error generated.
make[2]: *** [helper.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
cruegge commented 1 year ago

Okay, apparently MacOS doesn't have pipe2. I may eventually regret this, but I just pushed a branch mach with an attempted approximation of pipe2 in terms of pipe and fcntl. Note that this is untested, will not be tested by me, and I will not officially support MacOS (not out of principle, I simply don't have any access to or knowledge of that platform). If anything breaks, you're on your own. Good luck ;-)

Also, thanks for hinting me to the assignment error, I missed that one. Should be fixed in master.

Troublor commented 1 year ago

OK, thanks @cruegge

cruegge commented 1 year ago

I didn't want this to come across too harshly. Let me know if it works, in case you try.

nicholasrq commented 7 months ago

doesn't seem to work for me in mach branch

…/pam-gnupg on  mach
==> Fetching berkeley-db@5                                                                                                    │ make
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/blobs/sha256:7e1f6f67ce491e8636f9095fa45854e7b5720745b909e3b84c│/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
####################################################################################################################### 100.0%│Making all in src
==> Fetching isync                                                                                                            │gcc -DHAVE_CONFIG_H -I. -I..   -I/usr/local/opt/node@14/include  -g -O2 -MT helper.o -MD -MP -MF .deps/helper.Tpo -c -o helpe
==> Downloading https://ghcr.io/v2/homebrew/core/isync/blobs/sha256:fa5785b8d75e9d791f88667a8bb3419c4d23d470e5eea0e66ab01d3885│r.o helper.c
####################################################################################################################### 100.0%│mv -f .deps/helper.Tpo .deps/helper.Po
==> Installing dependencies for isync: berkeley-db@5                                                                          │/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2  -L/usr/local/opt/node@14/lib -o pam_gnupg_helper helper.o
==> Installing isync dependency: berkeley-db@5                                                                                │libtool: link: gcc -g -O2 -o pam_gnupg_helper helper.o  -L/usr/local/opt/node@14/lib
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/manifests/5.3.28_1                                             │ld: warning: search path '/usr/local/opt/node@14/lib' not found
Already downloaded: /Users/nicholasrq/Library/Caches/Homebrew/downloads/17e4e0def00184b561c8a490b5c0813a7c4f5e1365eb2e92757078│/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -DPAM_GNUPG_HELPER='"/usr/local/libexec/pam_gnupg
6eb4e05e09--berkeley-db@5-5.3.28_1.bottle_manifest.json                                                                       │_helper"' -I/usr/local/opt/node@14/include  -g -O2 -MT pam_gnupg_la-pam_gnupg.lo -MD -MP -MF .deps/pam_gnupg_la-pam_gnupg.Tpo
==> Pouring berkeley-db@5--5.3.28_1.arm64_sonoma.bottle.tar.gz                                                                │ -c -o pam_gnupg_la-pam_gnupg.lo `test -f 'pam_gnupg.c' || echo './'`pam_gnupg.c
🍺  /opt/homebrew/Cellar/berkeley-db@5/5.3.28_1: 5,271 files, 86.4MB                                                          │libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DPAM_GNUPG_HELPER=\"/usr/local/libexec/pam_gnupg_helper\" -I/usr/local/opt/n
==> Installing isync                                                                                                          │ode@14/include -g -O2 -MT pam_gnupg_la-pam_gnupg.lo -MD -MP -MF .deps/pam_gnupg_la-pam_gnupg.Tpo -c pam_gnupg.c  -fno-common
==> Pouring isync--1.4.4_1.arm64_sonoma.bottle.1.tar.gz                                                                       │-DPIC -o .libs/pam_gnupg_la-pam_gnupg.o
==> Caveats                                                                                                                   │pam_gnupg.c:17:10: fatal error: 'security/pam_ext.h' file not found
To start isync now and restart at login:                                                                                      │#include <security/pam_ext.h>
  brew services start isync                                                                                                   │         ^~~~~~~~~~~~~~~~~~~~
Or, if you don't want/need a background service you can just run:                                                             │pam_gnupg.c:17:10: note: did not find header 'pam_ext.h' in framework 'security' (loaded from '/Applications/Xcode.app/Conten
  /opt/homebrew/opt/isync/bin/mbsync -a                                                                                       │ts/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
==> Summary                                                                                                                   │1 error generated.