I’m on a Macbook Pro 2023 with an M3 chip. I’ve been attempting to get Poco (and all of its library files) as well as libpq to be properly located by Clang while using a Makefile. All my attempts have failed. I know the Makefile is correct, as colleagues have been able to compile with it no problem on linux based systems.
I’ve installed both libraries (Poco and libpq) both through homebrew and vcpkg, as well as postgres libraries (through homebrew) and attempted several ways to create ways for clang to locate these files. I’ve found a way for Poco to be located, but not libpq/postgres. Additionally, from what I’ve read online, homebrew does not automatically put these files where they should be on Apple silicon, but will on Intel silicon.
I also have an issue with the linker and libpq as well, such that after being installed, and having found a work around (I do not want to use) it fails as well with the following output:
ld: library 'pq' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-
For Poco, I was able to create a symbolic link in
/usr/local/include
to~/vcpkg/packages/poco_arm64-osx/include/Poco
which locates the Poco libraries successfully. -
I attempted the same process for postgres and libpq (independently, they were never in
/usr/local/include
together at the same time), but clang fails to findlibpq-fe.h
even though I know it’s locations exactly… The below is where I’ve attempted symbolic links from within/usr/local/include
usingsudo ln -s path/to/library library-name
sudo ln -s /opt/homebrew/Cellar/postgresql@14/14.12/include/postgresql@14 postgresql@14
sudo ln -s /opt/homebrew/Cellar/libpq/16.3/include libpq
sudo ln -s /opt/homebrew/include/postgresql@14 postgresql@14
sudo ln -s ~/vcpkg/packages/libpq_arm64-osx/include libpq
The only way I have found to get 2 working is by adding an env var to my .bashrc
file:
export CPLUS_INCLUDE_PATH="/opt/homebrew/Cellar/libpq/16.3/include/"
Though I’d rather not do this. One of my colleagues rightfully stated “it shouldn’t be this difficult.”
What can I do to ensure libpq is found by the compiler properly – as well as fixing the linker issue for libpq too – without modifying the Makefile or creating env vars.
NAlexH2 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.