lua-language-server
lua-language-server copied to clipboard
Compilation fails on Fedora 36
Trying to compile the lua-language-server plugin on Linux fails with the error:
/usr/bin/ld: cannot find -lstdc++
The cause seems to be the assumption that you can link with gcc and add -lstdc++ for C++ support. This is not the recommended way to link a g++ program. The recommended way is to use g++ as an executable for the linking.
I don't know anything about the luamake program so I don't know if this is a bug in lua-language-server or in one of its dependencies in the build tool chain.
duplicate #642
@actboy168 Thanks. But even though #642 provides a workaround, I still think it is valid to fix the underlying bug that the lua language server is using gcc for linking instead of g++.
I do not think so. But you can use whatever solution you think is correct, as long as it solves your problem. Any pull requests are also welcome.
@actboy168 Unfortunately, my current solution is not working very well, and I tried to understand what to change in luamake to make it use g++ instead of gcc for linking, but unfortunately I got lost. How can I define what c-compiler I want to use for compilation and linking? What if I want to use clang++? Would that require creating a scripts/compiler/clang.lua file? And afterwards, how do I choose what "compiler" to use when running "luamake"?
Thanks!
luamake --cc g++
luamake --cc clang
luamake --cc clang++
Thanks! That should solve it. Just for completeness, is there a way of changing the linker command as well? E.g. in the case you have a mixed C and C++ project and you want to compile the C-files with gcc and the C++ files with g++ and link with g++?
No, I don't think it makes sense. You should first understand the difference between g++ and gcc..
Ok. I guess you are right. I just realized that g++ is using a c-compiler for files with the .c extension.