Skip to content

Instantly share code, notes, and snippets.

@akdev1l
Created May 28, 2025 16:23
Show Gist options
  • Save akdev1l/b4ef9b5d3b936e6d8d65ba84c79c1471 to your computer and use it in GitHub Desktop.
Save akdev1l/b4ef9b5d3b936e6d8d65ba84c79c1471 to your computer and use it in GitHub Desktop.
neovim hack to create static build
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index e59be46314..f6fa0ba012 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -748,7 +748,8 @@ endif()
target_sources(nlua0 PUBLIC ${NLUA0_SOURCES})
-target_link_libraries(nvim_bin PRIVATE main_lib PUBLIC libuv)
+target_link_options(nvim_bin PRIVATE -static-libgcc -static-libstdc++ -static)
+target_link_libraries(nvim_bin PRIVATE main_lib /usr/lib/libc.a PUBLIC libuv)
install_helper(TARGETS nvim_bin)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:nvim_bin> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment