tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.02k stars 48 forks source link

`make` on windows fails `'int64_t' does not name a type` #225

Closed rgkirch closed 3 months ago

rgkirch commented 3 months ago

I'm on windows 10 and I'm getting this error. I tried in my msys2 terminal as well as in powershell and get the same error in both.

git clone https://github.com/tomhrr/dale.git mkdir dale.build cd dale.build cmake ../dale -DLLVM_CONFIG="/c/git-sdk-64/mingw64/opt/llvm-14/bin/llvm-config.exe" make

running make gives

-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
fatal: not a git repository (or any of the parent directories): .git
-- LLVM version: 14.0.6
-- LLVM version major: 14
-- LLVM version minor: 0
-- System name: MSYS
-- System processor: x86_64
-- System version: 3.4.9-be826601.x86_64
-- Build type: RELEASE
-- Configuring done (3.3s)
-- Generating done (0.6s)
-- Build files have been written to: /c/Users/me/notMyCode/tomhrr/dale.build
[  0%] Building CXX object CMakeFiles/dale.dir/src/dale/Arch/Arch.cpp.o
[  1%] Building CXX object CMakeFiles/dale.dir/src/dale/Introspection/Introspection.cpp.o
In file included from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Transforms/IPO/Attributor.h:109,
                 from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/LinkAllPasses.h:44,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../Namespace/../NativeTypes/../llvm_LinkAll.h:9,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../Namespace/../NativeTypes/NativeTypes.h:6,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../Namespace/Namespace.h:13,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/Context.h:12,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/MacroProcessor.h:4,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/Introspection.h:5,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/Introspection.cpp:1:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Analysis/CFG.h:129:1: warning: multi-line comment [-Wcomment]
  129 | ///  /   \
      | ^
In file included from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../ErrorReporter/ErrorReporter.h:8,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/Context.h:9:
/c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../ErrorReporter/../Type/Type.h:36:5: error: ‘int64_t’ does not name a type
   36 |     int64_t array_size;
      |     ^~~~~~~
/c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../ErrorReporter/../Type/Type.h:13:1: note: ‘int64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   12 | #include "../TypeMap/TypeMap.h"
  +++ |+#include <cstdint>
   13 |
In file included from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/Program.h:22,
                 from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/Process.h:32,
                 from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/LinkAllIR.h:29,
                 from /c/Users/me/notMyCode/tomhrr/dale/src/dale/Introspection/../MacroProcessor/../Context/../Namespace/../NativeTypes/../llvm_LinkAll.h:5:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/FileSystem.h: In function ‘std::error_code llvm::sys::fs::file_size(const llvm::Twine&, uint64_t&)’:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/FileSystem.h:696:19: error: ‘class llvm::sys::fs::file_status’ has no member named ‘getSize’
  696 |   Result = Status.getSize();
      |                   ^~~~~~~
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/Process.h: At global scope:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/Process.h:112:63: error: ‘EnvPathSeparator’ was not declared in this scope; did you mean ‘ListSeparator’?
  112 |                                              char Separator = EnvPathSeparator);
      |                                                               ^~~~~~~~~~~~~~~~
      |                                                               ListSeparator
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Support/Process.h:116:63: error: ‘EnvPathSeparator’ was not declared in this scope; did you mean ‘ListSeparator’?
  116 |                                              char Separator = EnvPathSeparator);
      |                                                               ^~~~~~~~~~~~~~~~
      |                                                               ListSeparator
In file included from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/Transforms/IPO/FunctionAttrs.h:20,
                 from C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/LinkAllPasses.h:45:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/IR/ModuleSummaryIndex.h: In constructor ‘llvm::ModuleSummaryIndex::ModuleSummaryIndex(bool, bool)’:
C:\Users\me\Downloads\llvm\llvm-project-14.0.6.src\llvm\include/llvm/IR/ModuleSummaryIndex.h:1175:73: warning: member ‘llvm::ModuleSummaryIndex::Alloc’ is used uninitialized [-Wuninitialized]
 1175 |       : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
      |                                                                         ^~~~~
make[2]: *** [CMakeFiles/dale.dir/build.make:90: CMakeFiles/dale.dir/src/dale/Introspection/Introspection.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:175: CMakeFiles/dale.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I also tried in WSL1 and WSL2 and running make in dale.build gives

[ 71%] Built target dale
[ 72%] Built target daleci
[ 74%] Built target dalec
[ 74%] Built target documentation
[ 75%] Built target arithmetic
[ 76%] Built target drt
[ 76%] Built target introspection
[ 76%] Built target cstdio-core
[ 76%] Built target macros
[ 76%] Built target stdlib
[ 77%] Built target unistd
[ 77%] Built target cstring
[ 78%] Built target cstdlib
[ 79%] Built target cstdio-arch
[ 80%] Built target cstdio
[ 81%] Built target assert
[ 81%] Built target concepts-core
[ 82%] Built target concept-defs
[ 83%] Built target concepts
[ 83%] Built target cctype
[ 84%] Built target ctype
[ 84%] Built target utility
[ 85%] Built target enum
[ 85%] Built target cmath
[ 86%] Built target math
[ 87%] Built target vector
[ 87%] Built target algorithms
[ 87%] Built target derivations
[ 88%] Generating module-to-markdown
/usr/bin/ld: /tmp/ccCoWsYV.o: in function `_Z8get$2dnodePZ4nodeiz':
module-to-markdown.dt:(.text+0xcb): undefined reference to `not(bool)'
/usr/bin/ld: /tmp/ccCoWsYV.o: in function `_Z14node$2dto$2dstringPZ4node':
module-to-markdown.dt:(.text+0x157): undefined reference to `not(bool)'
/usr/bin/ld: module-to-markdown.dt:(.text+0x15f): undefined reference to `not(bool)'
/usr/bin/ld: module-to-markdown.dt:(.text+0x18a): undefined reference to `not(bool)'
/usr/bin/ld: module-to-markdown.dt:(.text+0x1a3): undefined reference to `not(bool)'
/usr/bin/ld: /tmp/ccCoWsYV.o:module-to-markdown.dt:(.text+0x1b1): more undefined references to `not(bool)' follow
collect2: error: ld returned 1 exit status
./dalec: cc failed
make[2]: *** [CMakeFiles/programs.dir/build.make:73: module-to-markdown] Error 1
make[1]: *** [CMakeFiles/Makefile2:336: CMakeFiles/programs.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I also tried on macos and make succeeds but some tests fail with make tests.

Test Summary Report
-------------------
/Users/richie/notMyCode/tomhrr/dale/t/014container/021map-rv.t                      (Wstat: 512 (exited 2) Tests: 3 Failed: 2)
  Failed tests:  2-3
  Non-zero exit status: 2
Files=360, Tests=1412, 185 wallclock secs ( 1.48 usr  1.19 sys + 403.68 cusr 75.87 csys = 482.22 CPU)
Result: FAIL
Failed 1/360 test programs. 2/1412 subtests failed.
make[3]: *** [CMakeFiles/tests] Error 255
make[2]: *** [CMakeFiles/tests.dir/all] Error 2
make[1]: *** [CMakeFiles/tests.dir/rule] Error 2
make: *** [tests] Error 2
rgkirch commented 3 months ago

Hmm. On an ubuntu vm I got the same error as on wsl. That surprises me since there is a github workflow that builds the project on ubuntu. I just copied those instructions.

rgkirch commented 3 months ago

In WSL2, like this user here https://github.com/tomhrr/dale/issues/194 I removed module-to-markdown from CMakeFiles/programs.dir/build.make and I can make without error. make tests fails though

Files=360, Tests=1412, 26 wallclock secs ( 0.98 usr  0.28 sys + 52.20 cusr  8.97 csys = 62.43 CPU)
Result: FAIL
Failed 95/360 test programs. 194/1412 subtests failed.
make[3]: *** [CMakeFiles/tests.dir/build.make:70: CMakeFiles/tests] Error 255
make[2]: *** [CMakeFiles/Makefile2:279: CMakeFiles/tests.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:286: CMakeFiles/tests.dir/rule] Error 2
make: *** [Makefile:208: tests] Error 2
tomhrr commented 3 months ago

In WSL2, like this user here #194 I removed module-to-markdown from CMakeFiles/programs.dir/build.make and I can make without error. make tests fails though

Thanks for this. Could you send the full output from make tests, or alternatively the output from running the tests that failed?

Hmm. On an ubuntu vm I got the same error as on wsl. That surprises me since there is a github workflow that builds the project on ubuntu. I just copied those instructions.

It's likely that the module-to-markdown issue is happening because of inconsistency between the versions of clang and LLVM that are being used, though if the instructions from the actions build are being copied as-is, it should be fine. Could you send the full build output for the instance where that is happening? Alternatively, you could try setting the CLANG variable explicitly at build time. For example:

cmake -DLLVM_CONFIG=/usr/bin/llvm-config-14 -DCLANG=/usr/bin/clang-14 . && make && make tests

I'm on windows 10 and I'm getting this error. I tried in my msys2 terminal as well as in powershell and get the same error in both.

I've added more cstdint includes to (hopefully) help with the Windows build, but I don't have a machine to test with, and there's every chance that other parts of the code are such that they won't work on Windows, so it may be more trouble than it's worth trying to get it to work there.

I also tried on macos and make succeeds but some tests fail with make tests.

Could you send the test output for this problem?

rgkirch commented 3 months ago

Ah... adding -DCLANG make it work. cmake ../dale -DLLVM_CONFIG=$(which llvm-config-14) -DCLANG=$(which clang-14); make -j$(nproc)

I'm going to close this issue because I've created other issues that target more specific issues with a smaller scope. https://github.com/tomhrr/dale/issues/231 about passing -DCLANG https://github.com/tomhrr/dale/issues/230 where I try to build on windows with msys2 https://github.com/tomhrr/dale/issues/229 where I have macos test failures https://github.com/tomhrr/dale/issues/228 where I try to build the visual studio solution https://github.com/tomhrr/dale/issues/226 I think I fixed this issue in a pr

rgkirch commented 3 months ago

Oh, also, all tests pass on ubuntu vm after adding -DCLANG I'm not sure what environment I had when I saw tests fail. I'm not going to try and recreate that. I'm just gonna move on.