Unable to build on macOS 10.14 (Mojave)
gurjeet opened this issue · 3 comments
I get the following error when running the first step/cmake on macOS 10.14. Any ideas what may be wrong. I don't have XCode installed, so if that's a dependency I'd be glad to install it.
I use Nix package manager; this may have something to do with that.
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local $PWD
CMake Error at /nix/store/fhp2mjmbhkjsn3czhd0y8fphs83xxnq1-cmake-3.19.1/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find PAM (missing: PAM_LIBRARY PAM_INCLUDE_DIR)
Call Stack (most recent call first):
/nix/store/fhp2mjmbhkjsn3czhd0y8fphs83xxnq1-cmake-3.19.1/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindPAM.cmake:20 (find_package_handle_standard_args)
CMakeLists.txt:26 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/gurjeet/dev/PAM_REATTACH/CMakeFiles/CMakeOutput.log".
Hi,
As far as I can tell, CMake is unable to find libpam
, which is a system library and found at /usr/lib/libpam.dylib
as far as I know, though it might be that Nix hides these.
On the other hand, on Big Sur, libpam
and its headers are provided by Xcode, so you might also check if installing Xcode resolves your issues.
I stumbled upon this as well, and found a solution, although I don't think it will work for long.
@gurjeet did you solve this?
I did through the following modifications:
- Found the
libpam.dylib
in my nix store at/nix/store/8pcyfg4vg2gb6910gwv63khis4g4vr00-openpam-20170430/lib
- Modified
cmake/Modules/FindPAM.cmake
find_path
andfind_library
, addingHINTS /nix/store/8pcyfg4vg2gb6910gwv63khis4g4vr00-openpam-20170430/lib/)
- Called
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_OSX_ARCHITECTURES="arm64" .
(note that I set the arch toarm64
specifically, not toarm64;x86_64
as in the Readme) make
andsudo make install
to install it.
Everything seems to work right now, but I guess as soon as nix decides to update the openpam
(whatever that is), I'll need to rebuild pam_reattach
as well as it is dynamically linked?
Any better approaches? I'm a beginner Nix user and never really compile C programs from scratch either 😄
Also ran into this. For Nix on Apple Silicon:
% nix-shell -p cmake -p clang -p openpam
[nix-shell]$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_OSX_ARCHITECTURES="arm64" .
[nix-shell]$ sudo make install