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

Testing Orange C with CMake #1037

Open
ghost opened this issue May 21, 2024 · 6 comments
Open

Testing Orange C with CMake #1037

ghost opened this issue May 21, 2024 · 6 comments

Comments

@ghost
Copy link

ghost commented May 21, 2024

The project I choose to test is https://github.com/covscript/covscript.

It's C++14, so it will perfectly fine for Orange C.

CMake configuration completed successfully:

mkdir build
cd build
cmake -DCMAKE_C_COMPILER=occ -DCMAKE_CXX_COMPILER=occ -GNinja ..

But when I actually build it, the build failed immediately with compilation errors!

@GitMensch
Copy link
Contributor

GitMensch commented May 21, 2024 via email

@ghost
Copy link
Author

ghost commented May 22, 2024

And the compile errors are?

I expect the developer to actually test it himself. But in case of you are too lazy:


C:\Work\covscript\build>ninja -j1
[1/32] Building CXX object CMakeFiles\...ipt.dir\sources\compiler\codegen.cpp.o
FAILED: CMakeFiles/covscript.dir/sources/compiler/codegen.cpp.o
C:\Work\OrangeC\bin\occ.exe  -x c++ -! -c C:\Work\covscript\sources\compiler
\codegen.cpp  -IC:\Work\covscript\include -IC:\Work\covscript\csbuild\deps\i
nclude -fPIC -O3 -std=c++14 -MD -MT CMakeFiles\covscript.dir\sources\compiler\co
degen.cpp.o -MF CMakeFiles\covscript.dir\sources\compiler\codegen.cpp.o.d -o CMa
keFiles\covscript.dir\sources\compiler\codegen.cpp.o
Error C:\Work\covscript\include\covscript\core\core.hpp(32): Could not open  <
covscript/import/libdll/dll.hpp>  for input
Error C:\Work\covscript\include\covscript\core\core.hpp(36): Could not open  <
covscript/import/parallel_hashmap/phmap.h>  for input
Error C:\Work\covscript\include\covscript\core\components.hpp(27): Could not o
pen  <covscript/import/mozart/base.hpp>  for input
Error(396)    C:\Work\covscript\include\covscript\core\components.hpp(615):  T
emplate 'template' parameter missing default
Error C:\Work\covscript\include\covscript\core\variable.hpp(27): Could not ope
n  <covscript/import/mozart/traits.hpp>  for input
Error C:\Work\covscript\include\covscript\core\cni.hpp(27): Could not open  <c
ovscript/import/mozart/bind.hpp>  for input
Error(405)    C:\Work\covscript\sources\compiler\codegen.cpp(662):  Templates
must be classes, functions or data
3 Errors
ninja: build stopped: subcommand failed.

Copied from Windows Command Prompt by Mark and Enter, so it's not pretty. Please try to read.

@ghost
Copy link
Author

ghost commented May 22, 2024

OK. I forgot to clone the repository with recursive! After all of the submodules are initialized and updated, I have occparse.exe crashed with this dr.mingw report:

occparse.exe caused an Access Violation at location 000000000028FC3E in module occparse.exe Reading from location 0000000000000008.

Registers:
eax=00000000 ebx=0000000b ecx=1347e4f0 edx=00000002 esi=1347f1d0 edi=1449ca20
eip=0028fc3e esp=00d6e8cc ebp=00d6e920 iopl=0         nv up ei pl nz ac po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010216

AddrPC   Params
0028FC3E 14496DC4 1347E4F0 1449C9F0  occparse.exe!0xdfc3e
002908F5 14496DC4 1347E490 1347F270  occparse.exe!0xe08f5
0028CF99 14496DC4 1347E4D0 00D6F220  occparse.exe!0xdcf99
001E126A 00000000 00000000 00000000  occparse.exe!0x3126a


ninja simply said:

C:\Work\covscript\build>ninja -j1
[1/32] Building CXX object CMakeFiles\...ipt.dir\sources\compiler\codegen.cpp.o
FAILED: CMakeFiles/covscript.dir/sources/compiler/codegen.cpp.o
C:\Work\OrangeC\bin\occ.exe  -x c++ -! -c C:\Work\covscript\sources\compiler
\codegen.cpp  -IC:\Work\covscript\include -IC:\Work\covscript\csbuild\deps\i
nclude -fPIC -O3 -std=c++14 -MD -MT CMakeFiles\covscript.dir\sources\compiler\co
degen.cpp.o -MF CMakeFiles\covscript.dir\sources\compiler\codegen.cpp.o.d -o CMa
keFiles\covscript.dir\sources\compiler\codegen.cpp.o
ninja: build stopped: subcommand failed.

@ghost
Copy link
Author

ghost commented May 22, 2024

@LADSoft Please run some popular static analyzers on your code! Many of them are free! GCC and Clang also offer sanitizers!

@GitMensch
Copy link
Contributor

GitMensch commented May 22, 2024 via email

@LADSoft
Copy link
Owner

LADSoft commented May 22, 2024

@iahunq2 thank you for your efforts, it is much appreciated that you took it to the point of showing the compiler crashing. You might understand, for the issue you had before that I was gonna wonder if something in the setup was wrong because it wasn't finding 'include' files and that didn't seem like a reasonable problem to be having, glad you could take it beyond that!

I'm kinda in the middle of a major rework but after that I will look at these projects and clean up the compiles some more.

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

No branches or pull requests

2 participants