From ce52639936c7d8f263c85ad7f9c5bd92dea19a7f Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 20 Sep 2023 23:31:37 +0200 Subject: [PATCH] build: actually export symbols on mac If `-export_dynamic` is not passed to the linker, then Link Time Optimization may inline and remove global functions even though ENABLE_EXPORTS is set to true. Closes https://github.com/neovim/neovim/issues/25295. Closes https://github.com/kevinhwang91/nvim-ufo/issues/162. Closes https://github.com/neovim/neovim/issues/25295. Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> (cherry picked from commit 215a48da9ae55345f0c8b13994a7ba6d178a4114) --- src/nvim/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index b3c20ead8b..069ef8a8ef 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -213,6 +213,11 @@ if(WIN32) endif() elseif(APPLE) target_link_libraries(nvim PRIVATE "-framework CoreServices") + + # Actually export symbols - symbols may not be visible even though + # ENABLE_EXPORTS is set to true. See + # https://github.com/neovim/neovim/issues/25295 + set_target_properties(nvim PROPERTIES LINK_FLAGS "-Wl,-export_dynamic") endif() if(UNIX)