Skip to content

Don't override lm.bindir and lm.EXE_DIR in make.lua #1977

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

Merged
merged 2 commits into from
Mar 6, 2023
Merged

Don't override lm.bindir and lm.EXE_DIR in make.lua #1977

merged 2 commits into from
Mar 6, 2023

Conversation

neeshy
Copy link
Contributor

@neeshy neeshy commented Mar 3, 2023

Prior to this change, the targets /main.lua and /bootstrap.lua in build/build.ninja were being generated, which in turn caused access violations during the build. I was having problems building on Gentoo because of this (their package manager sandboxes their builds).

To illustrate, here's a diff of build/build.ninja generated before and after this change.

--- a/build/build.ninja
+++ b/build/build.ninja
@@ -1,6 +1,6 @@
 ninja_required_version = 1.7
 builddir = build
-bin = bin
+bin = $builddir/bin
 obj = $builddir/obj
 cc = gcc
 luamake = /home/arya/lua-language-server/3rd/luamake/luamake
@@ -109,7 +109,7 @@
   command = $cc $in -o $out -lm -ldl -Wl,-E -lstdc++fs -pthread $
     -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -static-libgcc -s
   description = Link    Exe $out
-build /bootstrap: link_bootstrap $obj/source_bootstrap/main.obj $
+build $bin/bootstrap: link_bootstrap $obj/source_bootstrap/main.obj $
     $obj/source_bootstrap/progdir.obj $obj/source_bee/lua-seri.obj $
     $obj/source_bee/format.obj $obj/source_bee/os.obj $
     $obj/source_bee/error.obj $obj/source_bee/filewatch_linux.obj $
@@ -128,10 +128,10 @@
   command = cp -fv $in$input $out 1>/dev/null
   description = Copy $in$input $out
   restat = 1
-build /main.lua: copy | /bootstrap
+build $bin/main.lua: copy | $bin/bootstrap
   input = 3rd/bee.lua/bootstrap/main.lua
 rule test
-  command = /bootstrap 3rd/bee.lua/test/test.lua --touch $out
+  command = $bin/bootstrap 3rd/bee.lua/test/test.lua --touch $out
   description = Run test.
   pool = console
 build $obj/test.stamp: test 3rd/bee.lua/test/console.lua $
@@ -143,7 +143,7 @@
     3rd/bee.lua/test/test_serialization.lua $
     3rd/bee.lua/test/test_socket.lua 3rd/bee.lua/test/test_subprocess.lua $
     3rd/bee.lua/test/test_thread.lua 3rd/bee.lua/test/test_time.lua | $
-    /bootstrap copy_script
+    $bin/bootstrap copy_script
 rule cxx_code_format
   command = $cc -MMD -MT $out -MF $out.d -std=c++17 -O2 -Wall $
     -fvisibility=hidden -I3rd/EmmyLuaCodeStyle/include $
@@ -314,6 +314,7 @@
     $obj/code_format/StringUtil.obj $obj/code_format/EditDistance.obj $
     $obj/code_format/SuggestItem.obj $obj/code_format/SymSpell.obj $
     $obj/code_format/Utf8.obj
+build bin/lua-language-server: copy $builddir/bin/lua-language-server
 build bin/main.lua: copy make/bootstrap.lua
 rule runtest
   command = bin/lua-language-server $in
@@ -321,12 +322,14 @@
   pool = console
 build $builddir/_/bee-test: runtest 3rd/bee.lua/test/test.lua | all
 build $builddir/_/unit-test: runtest test.lua | bee-test all
-build bootstrap: phony /bootstrap
-build copy_script: phony /main.lua
+build bootstrap: phony $bin/bootstrap
+build copy_script: phony $bin/main.lua
 build test: phony $obj/test.stamp
 build lua-language-server: phony $bin/lua-language-server
+build copy_lua-language-server: phony bin/lua-language-server
 build copy_bootstrap: phony bin/main.lua
-build all: phony $bin/lua-language-server copy_bootstrap
+build all: phony $bin/lua-language-server copy_lua-language-server $
+    copy_bootstrap
 build bee-test: phony $builddir/_/bee-test
 build unit-test: phony $builddir/_/unit-test
 default unit-test

I also had to add the copy_lua-language-server rule both to retain the previous behavior of placing the executable in bin/, but also because without it ninja complains that there are two rules for main.lua.

These create targets "/main.lua" and "/bootstrap.lua" in
build/build.ninja which in turn cause access violations during the build
@sumneko sumneko requested a review from actboy168 March 5, 2023 17:05
@actboy168 actboy168 merged commit 0b1b3b6 into LuaLS:master Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants