Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on macOS Sonoma (build instructions missing) #2802

Open
mttkay opened this issue Nov 8, 2024 · 2 comments
Open

Build fails on macOS Sonoma (build instructions missing) #2802

mttkay opened this issue Nov 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mttkay
Copy link

mttkay commented Nov 8, 2024

Please include the following data:

  • export | egrep 'LANG|LC_CTYPE|TERM'
export | egrep 'LANG|LC_CTYPE|TERM'
COLORTERM=truecolor
LANG=en_US.UTF-8
TERM=xterm-256color
TERM_PROGRAM=WarpTerminal
TERM_PROGRAM_VERSION=v0.2024.10.29.08.02.stable_02
  • notcurses version (available from notcurses-demo i)

3.0.11

  • terminal name + version

Warp v0.2024.10.29.08.02.stable_02


Problems

notcurses does not build on macOS Sonoma 14.7 (using homebrew dependencies) and there are no build instructions provided in https://github.com/dankamongmen/notcurses/blob/9d8cc0d86c1daf18f30110bfdf8388aeb96ff637/INSTALL.md.

This might just be user error, considering that there are binaries available for macOS, and brew install notcurses installs a working notcurses-demo binary. But I hope we can use this issue to document the build process better.

See thread here: #2801

Problem 1: required header files are not found

I installed build dependencies as follows:

brew install cmake package-cfg doctest pandoc

I also installed the main library package:

brew install notcurses

which I assumed would also provide any necessary transitive dependencies for a successful build.

mkdir build/
cd build
cmake ../

Fails with:

-- Requested multimedia engine: ffmpeg
-- Requested build mode: RelWithDebInfo
-- Checking for one of the modules 'tinfo>=6.1;ncursesw>=6.1'
CMake Error at /opt/homebrew/Cellar/cmake/3.31.0/share/cmake/Modules/FindPkgConfig.cmake:938 (message):
  None of the required 'tinfo>=6.1;ncursesw>=6.1' found
Call Stack (most recent call first):
  CMakeLists.txt:104 (pkg_search_module)


-- Looking for unigbrk.h
-- Looking for unigbrk.h - not found
CMake Error at CMakeLists.txt:170 (message):
  Couldn't find unigbrk.h from GNU libunistring


-- Configuring incomplete, errors occurred!

There are two issues here:

  None of the required 'tinfo>=6.1;ncursesw>=6.1' found

Although I have ncurses installed, this check always fails, and I have to comment it out.

The second problem is that it cannot locate header files for libunistring and libdeflate. I fixed this by adding:

set(CMAKE_REQUIRED_INCLUDES /opt/homebrew/include)

Is there a way to pass this through the environment instead? I tried a number of ways such as setting CFLAGS, CXXFLAGS but nothing worked.

Problem 2: Linking fails

With the workarounds above, ultimately the library compiles but then fails to link:

[ 11%] Building C object CMakeFiles/notcurses-core.dir/src/compat/compat.c.o
[ 11%] Linking C shared library libnotcurses-core.dylib
Undefined symbols for architecture arm64:
  "_cur_term", referenced from:
      _ncdirect_stop_minimal in direct.c.o
      _notcurses_core_init in notcurses.c.o
      _notcurses_stop in notcurses.c.o
      _interrogate_terminfo in termdesc.c.o
  "_curses_version", referenced from:
      _init_banner in banner.c.o
  "_del_curterm", referenced from:
      _ncdirect_stop_minimal in direct.c.o
      _notcurses_core_init in notcurses.c.o
      _notcurses_stop in notcurses.c.o
      _interrogate_terminfo in termdesc.c.o
  "_setupterm", referenced from:
      _interrogate_terminfo in termdesc.c.o
  "_termname", referenced from:
      _interrogate_terminfo in termdesc.c.o
  "_tigetflag", referenced from:
      _interrogate_terminfo in termdesc.c.o
      _interrogate_terminfo in termdesc.c.o
      _interrogate_terminfo in termdesc.c.o
  "_tigetnum", referenced from:
      _interrogate_terminfo in termdesc.c.o
      _interrogate_terminfo in termdesc.c.o
      _interrogate_terminfo in termdesc.c.o
      _build_supported_styles in termdesc.c.o
  "_tigetstr", referenced from:
      _prep_special_keys in in.c.o
      _prep_special_keys in in.c.o
      _init_terminfo_esc in termdesc.c.o
      _terminfostr in termdesc.c.o
  "_tiparm", referenced from:
      _init_banner in banner.c.o
      _init_banner in banner.c.o
      _init_banner in banner.c.o
      _init_banner in banner.c.o
      _ncdirect_cursor_up in direct.c.o
      _ncdirect_cursor_left in direct.c.o
      _ncdirect_cursor_right in direct.c.o
      ...
ld: symbol(s) not found for architecture arm64
cc: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libnotcurses-core.3.0.9.dylib] Error 1
make[1]: *** [CMakeFiles/notcurses-core.dir/all] Error 2
make: *** [all] Error 2
@mttkay mttkay added the bug Something isn't working label Nov 8, 2024
@mttkay
Copy link
Author

mttkay commented Nov 8, 2024

I found an answer to one problem: the error about missing tinfo and ncursesw dependencies. Stumbled upon it in this pipeline run: https://github.com/dankamongmen/notcurses/actions/runs/11151924316/job/30996427665

One needs to set env PKG_CONFIG_PATH="/opt/homebrew/opt/ncurses/lib/pkgconfig" when running cmake.

Still haven't found solutions to the other 2 issues (Looking for unigbrk.h - not found and the linker error.)

@mttkay
Copy link
Author

mttkay commented Nov 8, 2024

The linker error also disappears when setting PKG_CONFIG_PATH to included ncurses -- that leaves the problem with the missing libunistring header file. I think this is just because cmake is not aware of /opt/homebrew/include?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant