Rezonality / zep

Zep - An embeddable editor, with optional support for using vim keystrokes.
Other
931 stars 70 forks source link

macOS build instructions #111

Closed shakfu closed 1 year ago

shakfu commented 1 year ago

Hi, cool project!

Can you please post clear macOS build instructions?

cmaughan commented 1 year ago

Hi, I will tweak the readme to add the mac specific CMake instruction; in the meantime, the github action builds for Mac, and the commands are here: https://github.com/Rezonality/zep/blob/master/.github/workflows/builds.yml

shakfu commented 1 year ago

Thanks @cmaughan

cmaughan commented 1 year ago

I've just refreshed the build instructions. I don't have a Linux system, and my Mac system is not often used. If you find anything I have missed, please let me know, or file a bug with your build issues if you can't get stuff to work. This project could do with a Mac/Linux expert to maintain at least the build instructions!

Thanks.

shakfu commented 1 year ago

It doesn't build on macOS (x86_64) Monterey MacBook pro:

$ git clone --recursive git@github.com:Rezonality/zep.git
Cloning into 'zep'...
remote: Enumerating objects: 619, done.
remote: Counting objects: 100% (619/619), done.
remote: Compressing objects: 100% (464/464), done.
remote: Total 619 (delta 135), reused 507 (delta 127), pack-reused 0
Receiving objects: 100% (619/619), 5.19 MiB | 3.45 MiB/s, done.
Resolving deltas: 100% (135/135), done.
Submodule 'vcpkg' (https://github.com/Microsoft/vcpkg.git) registered for path 'vcpkg'
Cloning into '$HOME/src/zep/vcpkg'...
remote: Enumerating objects: 187102, done.
remote: Counting objects: 100% (181/181), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 187102 (delta 94), reused 127 (delta 76), pack-reused 186921
Receiving objects: 100% (187102/187102), 70.03 MiB | 10.09 MiB/s, done.
Resolving deltas: 100% (120229/120229), done.
Submodule path 'vcpkg': checked out '71d3fa60b67540e9bf5fde2bf2188f579ff09433'
$ src sa$ cd zep
$ zep sa$ ./prebuild.sh
+ '[' '!' -f ./vcpkg/vcpkg ']'
+ cd vcpkg
+ ./bootstrap-vcpkg.sh -disableMetrics
Downloading vcpkg-macos...
+ cd ..
+ triplet=(x64-linux)
++ uname
+ '[' Darwin == Darwin ']'
+ triplet=(x64-osx)
+ cd vcpkg
+ ./vcpkg install 'imgui[freetype,sdl2-binding,opengl3-binding]' tinyfiledialogs gl3w freetype sdl2 --triplet x64-osx --recurse
Computing installation plan...
The following packages will be built and installed:
  * brotli[core]:x64-osx -> 1.0.9#4
  * bzip2[core,tool]:x64-osx -> 1.0.8#3
  * egl-registry[core]:x64-osx -> 2022-09-20
    freetype[brotli,bzip2,core,png,zlib]:x64-osx -> 2.12.1#3
    gl3w[core]:x64-osx -> 2018-05-31#4
    imgui[core,freetype,opengl3-binding,sdl2-binding]:x64-osx -> 1.89.2
  * libpng[core]:x64-osx -> 1.6.39
  * opengl-registry[core]:x64-osx -> 2022-09-29
    sdl2[base,core]:x64-osx -> 2.26.2
    tinyfiledialogs[core]:x64-osx -> 3.8.8#4
  * vcpkg-cmake[core]:x64-osx -> 2022-12-22
  * vcpkg-cmake-config[core]:x64-osx -> 2022-02-06#1
  * zlib[core]:x64-osx -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-osx...
Restored 2 package(s) from $HOME/.cache/vcpkg/archives in 18.53 ms. Use --debug to see more details.
Installing 1/13 vcpkg-cmake:x64-osx...
Elapsed time to handle vcpkg-cmake:x64-osx: 7.466 ms
Installing 2/13 vcpkg-cmake-config:x64-osx...
Elapsed time to handle vcpkg-cmake-config:x64-osx: 4.568 ms
Installing 3/13 brotli:x64-osx...
Building brotli[core]:x64-osx...
-- Downloading https://github.com/google/brotli/archive/e61745a6b7add50d380cfd7d3883dd6c62fc2c71.tar.gz -> google-brotli-e61745a6b7add50d380cfd7d3883dd6c62fc2c71.tar.gz...
-- Extracting source $HOME/src/zep/vcpkg/downloads/google-brotli-e61745a6b7add50d380cfd7d3883dd6c62fc2c71.tar.gz
-- Applying patch install.patch
-- Applying patch fix-arm-uwp.patch
-- Applying patch pkgconfig.patch
-- Using source at $HOME/src/zep/vcpkg/buildtrees/brotli/src/6c62fc2c71-3fc02d8e7f.clean
-- Configuring x64-osx
-- Building x64-osx-dbg
-- Building x64-osx-rel
-- Fixing pkgconfig file: $HOME/src/zep/vcpkg/packages/brotli_x64-osx/lib/pkgconfig/libbrotlicommon.pc
-- Fixing pkgconfig file: $HOME/src/zep/vcpkg/packages/brotli_x64-osx/lib/pkgconfig/libbrotlidec.pc
-- Fixing pkgconfig file: $HOME/src/zep/vcpkg/packages/brotli_x64-osx/lib/pkgconfig/libbrotlienc.pc
CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:617 (message):
  Could not find pkg-config.  Please install it via your package manager:

      brew install pkg-config
Call Stack (most recent call first):
  scripts/cmake/vcpkg_fixup_pkgconfig.cmake:197 (vcpkg_find_acquire_program)
  ports/brotli/portfile.cmake:20 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:147 (include)

error: building brotli:x64-osx failed with: BUILD_FAILED
error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+brotli
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[brotli]+Build+error
Include '[brotli] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
    vcpkg-tool version: 2023-01-24-8a88d63f241d391772fbde69af9cab96c3c64c75
    vcpkg-scripts version: 71d3fa60b 2023-02-02 (10 weeks ago)

Please use the prefilled template from $HOME/src/zep/vcpkg/installed/vcpkg/issue_body.md when reporting your issue.
++ uname
+ '[' Darwin '!=' Darwin ']'
+ cd ..
cmaughan commented 1 year ago

What happens if you run the command it suggests in your output?:

Could not find pkg-config. Please install it via your package manager:

  brew install pkg-config
shakfu commented 1 year ago

Thanks very much @cmaughan, that worked!

shakfu commented 1 year ago

I suggest you add pkg-config to the macOS dependencies just in case.

shakfu commented 1 year ago

Incidentally, I was able to mkdir build && cd build && cmake .. && make without errors but when I followed the actual macOS cmake build advice as below:

$ cd build
$ cmake -G "Unix Makefiles" -DBUILD_QT=OFF -DBUILD_IMGUI=ON -DCMAKE_BUILD_TYPE=Release ..
-- CMakeLists: Zep
-- TARGET_MAC
-- Found BZip2: optimized;$HOME/src/zep/vcpkg/installed/x64-osx/lib/libbz2.a;debug;$HOME/src/zep/vcpkg/installed/x64-osx/debug/lib/libbz2d.a (found version "1.0.8")
-- Found ZLIB: optimized;$HOME/src/zep/vcpkg/installed/x64-osx/lib/libz.a;debug;$HOME/src/zep/vcpkg/installed/x64-osx/debug/lib/libz.a (found version "1.2.13")
-- System: Darwin-21.6.0
-- Compiler: AppleClang
-- Flags:
-- Debug Flags: -g -D_DEBUG -DDEBUG
-- Release Flags: -O3 -DNDEBUG
-- RelWithDebInfo Flags: -O2 -g -DNDEBUG
-- Arch:
-- $HOME/src/zep/demos/demo_imgui
-- Found PNG: optimized;$HOME/src/zep/vcpkg/installed/x64-osx/lib/libpng16.a;debug;$HOME/src/zep/vcpkg/installed/x64-osx/debug/lib/libpng16d.a (found version "1.6.39")
-- Found Python: /usr/local/bin/python3.11 (found version "3.11.3") found components: Interpreter
-- Configuring done (2.4s)
-- Generating done (0.1s)
-- Build files have been written to: $HOME/src/zep/build
$ cmake --build . --config Release
[  2%] Building CXX object src/CMakeFiles/Zep.dir/buffer.cpp.o
[  4%] Building CXX object src/CMakeFiles/Zep.dir/range_markers.cpp.o
[  6%] Building CXX object src/CMakeFiles/Zep.dir/glyph_iterator.cpp.o
[  8%] Building CXX object src/CMakeFiles/Zep.dir/commands.cpp.o
[ 10%] Building CXX object src/CMakeFiles/Zep.dir/display.cpp.o
In file included from $HOME/src/zep/src/display.cpp:7:
$HOME/src/zep/src/../include/zep/mcommon/utf8/unchecked.h:220:40: warning: 'iterator<std::bidirectional_iterator_tag, unsigned int>' is deprecated [-Wdeprecated-declarations]
          class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__iterator/iterator.h:27:29: note: 'iterator<std::bidirectional_iterator_tag, unsigned int>' has been explicitly marked deprecated here
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__config:1066:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__config:1043:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
1 warning generated.
[ 12%] Building CXX object src/CMakeFiles/Zep.dir/editor.cpp.o
[ 14%] Building CXX object src/CMakeFiles/Zep.dir/filesystem.cpp.o
[ 17%] Building CXX object src/CMakeFiles/Zep.dir/indexer.cpp.o
[ 19%] Building CXX object src/CMakeFiles/Zep.dir/keymap.cpp.o
[ 21%] Building CXX object src/CMakeFiles/Zep.dir/line_widgets.cpp.o
[ 23%] Building CXX object src/CMakeFiles/Zep.dir/mcommon/animation/timer.cpp.o
[ 25%] Building CXX object src/CMakeFiles/Zep.dir/mcommon/string/stringutils.cpp.o
[ 27%] Building CXX object src/CMakeFiles/Zep.dir/mcommon/file/path.cpp.o
[ 29%] Building CXX object src/CMakeFiles/Zep.dir/mode.cpp.o
[ 31%] Building CXX object src/CMakeFiles/Zep.dir/mode_search.cpp.o
[ 34%] Building CXX object src/CMakeFiles/Zep.dir/mode_standard.cpp.o
[ 36%] Building CXX object src/CMakeFiles/Zep.dir/mode_tree.cpp.o
[ 38%] Building CXX object src/CMakeFiles/Zep.dir/mode_vim.cpp.o
[ 40%] Building CXX object src/CMakeFiles/Zep.dir/mode_repl.cpp.o
[ 42%] Building CXX object src/CMakeFiles/Zep.dir/regress.cpp.o
[ 44%] Building CXX object src/CMakeFiles/Zep.dir/scroller.cpp.o
[ 46%] Building CXX object src/CMakeFiles/Zep.dir/splits.cpp.o
[ 48%] Building CXX object src/CMakeFiles/Zep.dir/syntax.cpp.o
[ 51%] Building CXX object src/CMakeFiles/Zep.dir/syntax_providers.cpp.o
[ 53%] Building CXX object src/CMakeFiles/Zep.dir/syntax_rainbow_brackets.cpp.o
[ 55%] Building CXX object src/CMakeFiles/Zep.dir/syntax_tree.cpp.o
[ 57%] Building CXX object src/CMakeFiles/Zep.dir/syntax_markdown.cpp.o
[ 59%] Building CXX object src/CMakeFiles/Zep.dir/tab_window.cpp.o
[ 61%] Building CXX object src/CMakeFiles/Zep.dir/theme.cpp.o
[ 63%] Building CXX object src/CMakeFiles/Zep.dir/window.cpp.o
In file included from $HOME/src/zep/src/window.cpp:16:
In file included from $HOME/src/zep/src/../include/zep/mcommon/utf8.h:32:
$HOME/src/zep/src/../include/zep/mcommon/utf8/unchecked.h:220:40: warning: 'iterator<std::bidirectional_iterator_tag, unsigned int>' is deprecated [-Wdeprecated-declarations]
          class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__iterator/iterator.h:27:29: note: 'iterator<std::bidirectional_iterator_tag, unsigned int>' has been explicitly marked deprecated here
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__config:1066:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__config:1043:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
1 warning generated.
[ 65%] Linking CXX static library ../lib/libZep.a
[ 65%] Built target Zep
[ 68%] Building CXX object tests/CMakeFiles/unittests.dir/googletest/googletest/src/gtest-all.cc.o
[ 70%] Building CXX object tests/CMakeFiles/unittests.dir/__/src/tests/buffer.test.cpp.o
[ 72%] Building CXX object tests/CMakeFiles/unittests.dir/__/src/tests/gap_buffer.test.cpp.o
[ 74%] Building CXX object tests/CMakeFiles/unittests.dir/__/src/tests/mode_standard.test.cpp.o
[ 76%] Building CXX object tests/CMakeFiles/unittests.dir/__/src/tests/mode_vim.test.cpp.o
[ 78%] Building CXX object tests/CMakeFiles/unittests.dir/__/src/tests/syntax.test.cpp.o
[ 80%] Building CXX object tests/CMakeFiles/unittests.dir/main.cpp.o
[ 82%] Linking CXX executable unittests
[ 82%] Built target unittests
[ 85%] Building C object demos/demo_imgui/CMakeFiles/ZepDemo.dir/janet/janet.c.o
[ 87%] Building CXX object demos/demo_imgui/CMakeFiles/ZepDemo.dir/janet_utils.cpp.o
[ 89%] Building CXX object demos/demo_imgui/CMakeFiles/ZepDemo.dir/main.cpp.o
$HOME/src/zep/demos/demo_imgui/main.cpp:19:10: fatal error: 'clipp.h' file not found
#include <clipp.h> // command line params
         ^~~~~~~~~
1 error generated.
make[2]: *** [demos/demo_imgui/CMakeFiles/ZepDemo.dir/main.cpp.o] Error 1
make[1]: *** [demos/demo_imgui/CMakeFiles/ZepDemo.dir/all] Error 2
make: *** [all] Error 2

It looks like there's an unresolved dependency on clipp