Skip to content
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

Using Unity builds results in compilation errors #262

Closed
kunitoki opened this issue Dec 1, 2021 · 9 comments · Fixed by #372
Closed

Using Unity builds results in compilation errors #262

kunitoki opened this issue Dec 1, 2021 · 9 comments · Fixed by #372
Labels
build Build system or platform compatibility issue enhancement New feature or request

Comments

@kunitoki
Copy link
Contributor

kunitoki commented Dec 1, 2021

Getting these failures on windows machine on github actions:

D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(635,24): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(635): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(635,24): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(636,24): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(636): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(636,24): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(660,24): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(660): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/BytecodeBuilder.cpp(660,24): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409,52): warning C4003: not enough arguments for function-like macro invocation 'min' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409,96): warning C4003: not enough arguments for function-like macro invocation 'max' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(265,38): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(265): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(265,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1165,44): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1165): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1165,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409,52): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409,96): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1409,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1410,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1411,1): error C2143: syntax error: missing ';' before '{' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(1415,1): error C2181: illegal else without matching if [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2153,44): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2153): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2153,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2618,35): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2618): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2618,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2694,26): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2694): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2694,1): error C2059: syntax error: ')' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2704,26): error C2589: '(': illegal token on right side of '::' [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2704): error C2062: type 'unknown-type' unexpected [D:\a\LuaBridge3\build\Tests\LuaBridgeTestsLuau.vcxproj]
D:\a\LuaBridge3\LuaBridge3\Tests\Lua\../../ThirdParty/luau/Compiler/src/Compiler.cpp(2704,1): error C2059: syntax error: ')' 

see https://github.com/kunitoki/LuaBridge3/runs/4378619570?check_suite_focus=true

@kunitoki kunitoki added the bug Something isn't working label Dec 1, 2021
@kunitoki
Copy link
Contributor Author

kunitoki commented Dec 1, 2021

Can we include windows here with VC_EXTRALEAN, WIN32_LEAN_AND_MEAN and NOMINMAX ?

https://github.com/Roblox/luau/blob/586bef6a4cffec80f7f2c7d4ed397aacc8fa9313/VM/src/lperf.cpp#L6

@vegorov-rbx
Copy link
Collaborator

Do not use #include on .cpp files, we do not support Unity/Jumbo builds.

@vegorov-rbx vegorov-rbx added the invalid This doesn't seem right label Dec 1, 2021
@zeux
Copy link
Collaborator

zeux commented Dec 1, 2021

We can probably add the necessary defines (at least minmax…) although we need to be careful as they often are redefined at the project level which may cause macro redefinition warnings. That said, using an amalgamated build across multiple components (VM+Compiler) definitely isn’t guaranteed to work.

@kunitoki
Copy link
Contributor Author

kunitoki commented Dec 1, 2021

i don't see any issue if you define at least WIN32_LEAN_AND_MEAN and NOMINMAX before your windows includes, your are already doing that in other places (for the lean and mean).

macro redefinition warnings can be prevented by protecting macros by ifndef btw, like we did in the luaconf.h

@zeux
Copy link
Collaborator

zeux commented Dec 1, 2021

Just to double check, if you're using an amalgamated build you can also define NOMINMAX yourself, right? We have WIN32_LEAN_AND_MEAN defined everywhere except for lperf.cpp and TimeTrace.cpp so that's an omission we should correct, but to fully fix this problem we would have to add NOMINMAX to all 5 include locations in our source.

@kunitoki
Copy link
Contributor Author

kunitoki commented Dec 1, 2021

Yes i could, but not very practical, it pushes requirements on the user. You will encounter the same issue with cmake unity build feature for example, or meson, if you plan to support it one day 😄

@kunitoki
Copy link
Contributor Author

kunitoki commented Dec 1, 2021

I can create a PR for you if you prefer.

@zeux zeux added build Build system or platform compatibility issue enhancement New feature or request and removed bug Something isn't working invalid This doesn't seem right labels Dec 1, 2021
@zeux zeux reopened this Dec 1, 2021
@zeux zeux changed the title Compilation error on windows Using Unity builds results in compilation errors on windows Dec 1, 2021
@zeux
Copy link
Collaborator

zeux commented Dec 1, 2021

I'm hoping Meson doesn't default to unity builds; regardless this may be worth fixing. CMake Unity builds won't mix files across components although it might still result in an issue within Ast because of TimeTrace

@zeux
Copy link
Collaborator

zeux commented Dec 1, 2021

Yeah CMake Unity build doesn't build, but it doesn't build for a few reasons only one of which is the Windows.h conflation. I've reopened this issue as an enhancement - it's not a bug, and it's not clear that we should always support Unity builds as it changes the compilation model and it'll keep regressing, so we'll need to look at the changes necessary here separately.

@zeux zeux changed the title Using Unity builds results in compilation errors on windows Using Unity builds results in compilation errors Dec 1, 2021
@zeux zeux closed this as completed in #372 Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build system or platform compatibility issue enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

3 participants