Ultimaker / cura-build-environment

CMake project to build dependencies for Cura
GNU Affero General Public License v3.0
24 stars 55 forks source link

Win64 Build with protobuf-mingw build errors #73

Closed buddybu closed 4 years ago

buddybu commented 5 years ago

I am seeing a build error that I will continue to try and figure out, but I could use some help.

Here is the output:

-- Build files have been written to: D:/proj/cura-build-environment/build/Protobuf-MinGW-prefix/src/Protobuf-MinGW-build [ 43%] Performing build step for 'Protobuf-MinGW' Scanning dependencies of target libprotobuf-lite [ 1%] Building CXX object CMakeFiles/libprotobuf-lite.dir/D_/proj/cura-build-environment/build/Protobuf-MinGW-prefix/src/Protobuf-MinGW/src/google/protobuf/arena.cc.obj D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:42:29: error: 'SequenceNumber' in namespace 'google::protobuf::internal' does not name a type google::protobuf::internal::SequenceNumber Arena::lifecycle_idgenerator; ^~~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:55:28: error: 'ThreadCache' in 'class google::protobuf::Arena' does not name a type GOOGLE_THREAD_LOCAL Arena::ThreadCache Arena::threadcache = { -1, NULL }; ^~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:58:6: error: no declaration matches 'void google::protobuf::Arena::Init()' void Arena::Init() { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:275:8: note: candidate is: 'void google::protobuf::Arena::Init(const google::protobuf::ArenaOptions&)' void Init(const ArenaOptions& options) { ^~~~ D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUF_EXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:91:1: error: redefinition of 'google::protobuf::Arena::~Arena()' Arena::~Arena() { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:269:3: note: 'google::protobuf::Arena::~Arena()' previously defined here ~Arena() { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:100:8: error: redefinition of 'google::protobuf::uint64 google::protobuf::Arena::Reset()' uint64 Arena::Reset() { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:374:28: note: 'google::protobuf::uint64 google::protobuf::Arena::Reset( ' previously defined here PROTOBUF_NOINLINE uint64 Reset() { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:106:8: error: no declaration matches 'google::protobuf::uint64 google::protobuf::Arena::ResetInternal()' uint64 Arena::ResetInternal() { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:106:8: note: no functions named 'google::protobuf::uint64 google::protobuf::Arena::ResetInternal()' In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUF_EXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:118:8: error: 'Block' in 'class google::protobuf::Arena' does not name a type Arena::Block Arena::NewBlock(void me, Block my_last_block, size_t n, ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:146:22: error: variable or field 'AddBlock' declared void void Arena::AddBlock(Block b) { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:146:22: error: 'Block' was not declared in this scope D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:146:22: note: suggested alternative: 'alloca' void Arena::AddBlock(Block b) { ^~~~~ alloca D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:146:29: error: 'b' was not declared in this scope void Arena::AddBlock(Block b) { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:151:30: error: variable or field 'AddBlockInternal' declared void void Arena::AddBlockInternal(Block b) { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:151:30: error: 'Block' was not declared in this scope D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:151:30: note: suggested alternative: 'alloca' void Arena::AddBlockInternal(Block b) { ^~~~~ alloca D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:151:37: error: 'b' was not declared in this scope void Arena::AddBlockInternal(Block b) { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:160:6: error: no declaration matches 'void google::protobuf::Arena::AddListNode(void, void ()(void))' void Arena::AddListNode(void elem, void (cleanup)(void)) { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:160:6: note: no functions named 'void google::protobuf::Arena::AddListNode(void, void ()(void))' In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUF_EXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:169:7: error: no declaration matches 'void google::protobuf::Arena::AllocateAligned(const std::type_info, size_t)' void Arena::AllocateAligned(const std::type_info allocated, size_t n) { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:695:9: note: candidate is: 'void google::protobuf::Arena::AllocateAligned(size_t)' void AllocateAligned(size_t n) { ^~~~~~~ D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUF_EXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:29: error: 'void google::protobuf::Arena::AllocFromBlock' is not a static data member of 'class google::protobuf::Arena' void Arena::AllocFromBlock(Block b, size_t n) { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:29: error: 'Block' was not declared in this scope D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:29: note: suggested alternative: 'alloca' void Arena::AllocFromBlock(Block b, size_t n) { ^~~~~ alloca D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:36: error: 'b' was not declared in this scope void Arena::AllocFromBlock(Block b, size_t n) { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:46: error: expected primary-expression before 'n' void Arena::AllocFromBlock(Block b, size_t n) { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:201:47: error: expression list treated as compound expression in initializer [-fpermissive] void Arena::AllocFromBlock(Block b, size_t n) { ^ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:210:7: error: no declaration matches 'void google::protobuf::Arena::SlowAlloc(size_t)' void Arena::SlowAlloc(size_t n) { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:210:7: note: no functions named 'void google::protobuf::Arena::SlowAlloc(size_t)' In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUFEXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:225:8: error: redefinition of 'google::protobuf::uint64 google::protobuf::Arena::SpaceAllocated() const' uint64 Arena::SpaceAllocated() const { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:354:10: note: 'google::protobuf::uint64 google::protobuf::Arena::SpaceAllocated() const' previously defined here uint64 SpaceAllocated() const { return impl.SpaceAllocated(); } ^~~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:235:8: error: redefinition of 'google::protobuf::uint64 google::protobuf::Arena::SpaceUsed() const' uint64 Arena::SpaceUsed() const { ^~~~~ In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:359:10: note: 'google::protobuf::uint64 google::protobuf::Arena::SpaceUsed() const' previously defined here uint64 SpaceUsed() const { return impl_.SpaceUsed(); } ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:245:1: error: 'pair' does not name a type pair<uint64, uint64> Arena::SpaceAllocatedAndUsed() const { ^~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:258:8: error: no declaration matches 'google::protobuf::uint64 google::protobuf::Arena::FreeBlocks()' uint64 Arena::FreeBlocks() { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:258:8: note: no functions named 'google::protobuf::uint64 google::protobuf::Arena::FreeBlocks()' In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUF_EXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:293:6: error: no declaration matches 'void google::protobuf::Arena::CleanupList()' void Arena::CleanupList() { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:293:6: note: no functions named 'void google::protobuf::Arena::CleanupList()' In file included from D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:31: D:/proj/install/include/google/protobuf/arena.h:248:34: note: 'class google::protobuf::Arena' defined here class PROTOBUFEXPORT alignas(8) Arena final { ^~~~~ D:\proj\cura-build-environment\build\Protobuf-MinGW-prefix\src\Protobuf-MinGW\src\google\protobuf\arena.cc:303:8: error: 'Block' in 'class google::protobuf::Arena' does not name a type Arena::Block Arena::FindBlock(void me) { ^~~~~ mingw32-make.EXE[2]: *** [CMakeFiles\libprotobuf-lite.dir\build.make:63: CMakeFiles/libprotobuf-lite.dir/D/proj/cura-build-environment/build/Protobuf-MinGW-prefix/src/Protobuf-MinGW/src/google/protobuf/arena.cc.obj] Error 1 mingw32-make.EXE[1]: [CMakeFiles\Makefile2:81: CMakeFiles/libprotobuf-lite.dir/all] Error 2 mingw32-make.EXE: [Makefile:129: all] Error 2 NMAKE : fatal error U1077: '"C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\mingw32-make.EXE"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2' Stop.

Ghostkeeper commented 5 years ago

It's almost like there is a version incongruency between the header files and the source files it builds Protobuf with or something. Did you try a clean-and-build?

buddybu commented 5 years ago

yes, I actually deleted the build folder and recreated it, twice. With the same error each time.

buddybu commented 5 years ago

I had another windows 10 machine hanging around, so I installed Git, VS2015 Community Edition with C++ tools included, CMake, Svn and MinGW564 (masquerading as MinGW). I now get the following error: -- The CXX compiler identification is GNU 8.1.0 -- Check for working CXX compiler: C:/MinGW64/mingw64/bin/g++.exe -- Check for working CXX compiler: C:/MinGW64/mingw64/bin/g++.exe -- broken CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeTestCXXCompiler.cmake:53 (message): The C++ compiler

"C:/MinGW64/mingw64/bin/g++.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/proj/cura-build-environment/build/GoogleTest-prefix/src/GoogleTest/CMakeFiles/CMakeTmp

Run Build Command(s):nmake /nologo cmTC_a7ade\fast &&       "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\cmTC_a7ade.dir\build.make /nologo -L                  CMakeFiles\cmTC_a7ade.dir\build
Building CXX object CMakeFiles/cmTC_a7ade.dir/testCXXCompiler.cxx.obj
    C:\MinGW64\mingw64\bin\g++.exe    -m64 -o CMakeFiles\cmTC_a7ade.dir\testCXXCompiler.cxx.obj -c C:\proj\cura-build-environment\build\GoogleTest-prefix\src\GoogleTest\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
Linking CXX executable cmTC_a7ade.exe
    "C:\Program Files\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_a7ade.dir/objects.a
    "" cr CMakeFiles\cmTC_a7ade.dir/objects.a @CMakeFiles\cmTC_a7ade.dir\objects1.rsp
'cr' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: '"' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:7 (project)

-- Configuring incomplete, errors occurred! See also "C:/proj/cura-build-environment/build/GoogleTest-prefix/src/GoogleTest/CMakeFiles/CMakeOutput.log". See also "C:/proj/cura-build-environment/build/GoogleTest-prefix/src/GoogleTest/CMakeFiles/CMakeError.log".

I have saved the cmakefiles folder as a zip file and have attached it.

CMakeFiles.zip

Ghostkeeper commented 4 years ago

Is that MinGW installation a proper MinGW-w64 installation? Where did you get it from? It seems to not be able to compile anything, according to CMake. It's not something that is really wrong with cura-build in this case, I think.

buddybu commented 4 years ago

Maybe? Where should I have gotten my MinGW-w64 installation? There are several from which to choose. I think I chose the WinBuilds version.

Ghostkeeper commented 4 years ago

Ah, that's it then. The WinBuilds version is still on GCC 4.8.3 (from May 2014). I've been using the one from MinGW-w64-builds (as listed here), which is currently on GCC 7.2.0 (from August 2017).

CuraEngine requires at least GCC 4.9. However you seem to have trouble before it's even reached that point.

LipuFei commented 4 years ago
    "" cr CMakeFiles\cmTC_a7ade.dir/objects.a @CMakeFiles\cmTC_a7ade.dir\objects1.rsp
'cr' is not recognized as an internal or external command,

@buddybu From this error, you can see that a command is missing here (the empty string ""). The missing command/program is probably ranlib which can be used to create .a static library files. You need to make ranlib and other MinGW toolchain programs available in PATH.

buddybu commented 4 years ago

I was trying to figure out the missing string "", but I am not familiar with the cmake system and how find all of the various parts and pieces. Thank you for the pointer. FWIW, I do have ranlib in my path after reinstalling MinGw-w64 and am building now. I will post any issues.

buddybu commented 4 years ago

I reset my environment, I reinstalled MinGW, and I had to remove the python support from VisualStudio 2019, which I have installed alongside Vs2015. I also removed all vestiges of python from my system. I am now able to build.