LuaFormatter
LuaFormatter copied to clipboard
fix: Add stdc++fs to link path to compatible with gcc
gcc need to specify libstdc++fs to support
It's not necessary for our use case.
In gcc < 9.0 the library was separate from libstdc++
, but even then the portion we use here was not implemented properly and was throwing a segfault. We added a try_run()
clause to CMakeLists.txt
that runs a small program and checks for the correctness of the APIs we use from fs
, in other words, we don't support gcc < 9.0.
hmm..that's interesting. I thought it works because I use gcc 8.3(latest on official Ubuntu 1804) with this fix to format 10,000+ files correctly. Anyway, thanks for your check and good code.
@winest you could run the test suite. If it passes, please let me know!
@tammela It seems fine.
./lua-format-test line 2:0 mismatched input '#!/bin/lua5.3' expecting <EOF> /home/winest/Apps/LuaFormatter/test/testdata/literals/doublequote.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/literals/singlequote.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/expression/function_2.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/issues/issue-36.config exist 1 dd /home/winest/Apps/LuaFormatter/test/testdata/issues/issue-62_1.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/issues/issue-62_2.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/issues/issue-62_3.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/keep_simple_block_one_line/keep_simple_function_one_line_false.config exist 0 dd /home/winest/Apps/LuaFormatter/test/testdata/keep_simple_block_one_line/keep_simple_control_block_one_line_false.config exist 0 dd =============================================================================== All tests passed (121 assertions in 52 test cases)
My environment:
cmake --version cmake version 3.15.3
gcc --version gcc (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
g++ --version g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
Confirmed that apparently they fixed this issue (segfault on fs lib) in 8.3.
I did a PR that addressed the code issues here and made it work in all platforms.
Thank you!