pgsql-io/multicorn2

Building 3.0 on macOS 14.7 fatal error: 'libintl.h' file not found.

markp2 opened this issue · 0 comments

Here is the relevant error fragment:

      In file included from src/utils.c:13:
      In file included from /opt/homebrew/opt/postgresql@16/include/postgresql/server/postgres.h:45:
      /opt/homebrew/opt/postgresql@16/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found
         75 | #include <libintl.h>
            |          ^~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1

The file libintl.h is generally located in gettext i.e. /opt/homebrew/Cellar/gettext/0.22.5/include. However, the build process does not find it.

I tried the following which did not work:

export LDFLAGS="-I/opt/homebrew/Cellar/gettext/0.22.5/lib"
export CPPFLAGS="-I/opt/homebrew/Cellar/gettext/0.22.5/include"

WORKAROUND

A fix was to make a copy of the file libintl.h in /opt/homebrew/Cellar/postgresql@16/16.4/include/postgresql/server so it was found.

Hoping this information may help provide a robust fix.


Full terminal output error:

mark@Marks-MacBook-M1 ~ % multicorn2_home="/Users/mark/Documents/GitHub/Multicorn2/multicorn2-3.0"
mark@Marks-MacBook-M1 ~ % cd $multicorn2_home                                                     
mark@Marks-MacBook-M1 multicorn2-3.0 % sudo make PYTHON_OVERRIDE=python3.12 install                            
Password:
Python version is 3.12
/bin/sh /opt/homebrew/opt/postgresql@16/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/opt/homebrew/opt/postgresql@16/lib/postgresql'
/bin/sh /opt/homebrew/opt/postgresql@16/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension'
/bin/sh /opt/homebrew/opt/postgresql@16/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension'
/bin/sh /opt/homebrew/opt/postgresql@16/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/opt/homebrew/Cellar/postgresql@16/16.4/share/doc/postgresql@16/extension'
/usr/bin/install -c -m 755  multicorn.dylib '/opt/homebrew/opt/postgresql@16/lib/postgresql/multicorn.dylib'
#
# Strictly speaking, --break-system-packages arrived in 23.0.1, but that's
# too hard to check for.
#
#
# Workaround https://github.com/pgsql-io/multicorn2/issues/34, and then
# re-evaluate PIP_VERSION/PIP_FLAGS.
#
pip3.12 install --break-system-packages --ignore-installed --upgrade 'pip>=23'
WARNING: The directory '/Users/mark/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting pip>=23
  Downloading pip-24.2-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.2-py3-none-any.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 15.1 MB/s eta 0:00:00
Installing collected packages: pip
Successfully installed pip-24.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
pip3.12 install --break-system-packages --ignore-installed .
WARNING: The directory '/Users/mark/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Processing /Users/mark/Documents/GitHub/Multicorn2/multicorn2-3.0
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: multicorn
  Building wheel for multicorn (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for multicorn (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      building 'multicorn._utils' extension
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -I/opt/homebrew/opt/postgresql@16/include -I/opt/homebrew/opt/postgresql@16/include/postgresql -I/opt/homebrew/opt/postgresql@16/include/postgresql/server -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/utils.c -o build/temp.macosx-14.0-arm64-cpython-312/src/utils.o -shared
      clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
      In file included from src/utils.c:13:
      In file included from /opt/homebrew/opt/postgresql@16/include/postgresql/server/postgres.h:45:
      /opt/homebrew/opt/postgresql@16/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found
         75 | #include <libintl.h>
            |          ^~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for multicorn
Failed to build multicorn
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (multicorn)
make: *** [python_code] Error 1