yrnkrn / zapcc

zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Other
1.25k stars 61 forks source link

Failed to Build on Windows: mingw64 config? Win 7 #37

Closed Bobingit closed 5 years ago

Bobingit commented 5 years ago

c:\cygwin64\home\BorisShukhman\build>cmake -G Ninja -DCMAKE_BUILD_TYPE=Release - DLLVM_ENABLE_WARNINGS=OFF -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-windows-gnu ../ llvm CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy): The OLD behavior for policy CMP0051 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build t ool. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! See also "C:/cygwin64/home/BorisShukhman/build/CMakeFiles/CMakeOutput.log".

c:\cygwin64\home\BorisShukhman\build>cmake --version cmake version 3.14.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

c:\cygwin64\home\BorisShukhman\build>which gcc /c/mingw64/bin/gcc

c:\cygwin64\home\BorisShukhman\build>gcc --version gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


c:\cygwin64\home\BorisShukhman\build>which cmake /c/Program Files/CMake/bin/cmake

c:\cygwin64\home\BorisShukhman\build>cmake --version cmake version 3.14.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

yrnkrn commented 5 years ago

You need to install ninja to build with Ninja. Alternatively, just build with make.

Bobingit commented 5 years ago

Boris Shukhman@BorisShukhman ~ $ which ninja /usr/bin/ninja

Boris Shukhman@BorisShukhman ~ $ ninja --version 1.9.0

yrnkrn commented 5 years ago

You were running the build from Windows, c:\cygwin64\home\BorisShukhman\build> but running which ninja from the shell. Windows path and shell path may not be the same. Try building from the shell.

Bobingit commented 5 years ago

... and they are not the same indeed. Alas, my attempt to build zapcc from cywing fails, but this is another story. Would you know successful cygwing build of zapcc? any reference pls.

yrnkrn commented 5 years ago

I don't know of a successful cygwin build however the difficulty starts before actually building any zapcc sources. The error message CMake Error: CMake was unable to find a build program corresponding to "Ninja". indicates that CMake was not able to locate ninja. You can try building with make instead.

Bobingit commented 5 years ago

Got it. I pushed forward with installing Ninja, but not too far: c:\cygwin64\home\BorisShukhman\build>cmake -G Ninja -DCMAKE_BUILD_TYPE=Release - DLLVM_ENABLE_WARNINGS=OFF -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-windows-gnu ../ llvm CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy): The OLD behavior for policy CMP0051 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

-- The C compiler identification is GNU 8.1.0 -- The CXX compiler identification is GNU 8.1.0 -- The ASM compiler identification is GNU -- Found assembler: C:/mingw64/bin/gcc.exe -- Check for working C compiler: C:/mingw64/bin/gcc.exe -- Check for working C compiler: C:/mingw64/bin/gcc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: C:/mingw64/bin/c++.exe -- Check for working CXX compiler: C:/mingw64/bin/c++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for dirent.h -- Looking for dirent.h - found -- Looking for dlfcn.h -- Looking for dlfcn.h - not found -- Looking for errno.h -- Looking for errno.h - found -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for inttypes.h -- Looking for inttypes.h - found -- Looking for link.h -- Looking for link.h - not found -- Looking for malloc.h -- Looking for malloc.h - found -- Looking for malloc/malloc.h -- Looking for malloc/malloc.h - not found -- Looking for ndir.h -- Looking for ndir.h - not found -- Looking for signal.h -- Looking for signal.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for sys/dir.h -- Looking for sys/dir.h - not found -- Looking for sys/ioctl.h -- Looking for sys/ioctl.h - not found -- Looking for sys/mman.h -- Looking for sys/mman.h - not found -- Looking for sys/ndir.h -- Looking for sys/ndir.h - not found -- Looking for sys/param.h -- Looking for sys/param.h - found -- Looking for sys/resource.h -- Looking for sys/resource.h - not found -- Looking for sys/stat.h -- Looking for sys/stat.h - found -- Looking for sys/time.h -- Looking for sys/time.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for sys/uio.h -- Looking for sys/uio.h - not found -- Looking for termios.h -- Looking for termios.h - not found -- Looking for unistd.h -- Looking for unistd.h - found -- Looking for valgrind/valgrind.h -- Looking for valgrind/valgrind.h - not found -- Looking for zlib.h -- Looking for zlib.h - found -- Looking for fenv.h -- Looking for fenv.h - found -- Looking for FE_ALL_EXCEPT -- Looking for FE_ALL_EXCEPT - found -- Looking for FE_INEXACT -- Looking for FE_INEXACT - found -- Looking for mach/mach.h -- Looking for mach/mach.h - not found -- Looking for histedit.h -- Looking for histedit.h - not found -- Looking for CrashReporterClient.h -- Looking for CrashReporterClient.h - not found -- Looking for compress2 in z -- Looking for compress2 in z - found -- Looking for xar_open in xar -- Looking for xar_open in xar - not found -- Looking for arc4random -- Looking for arc4random - not found -- Looking for backtrace -- Looking for backtrace - not found -- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed -- Looking for _Unwind_Backtrace -- Looking for _Unwind_Backtrace - found -- Looking for getpagesize -- Looking for getpagesize - not found -- Looking for sysconf -- Looking for sysconf - not found -- Looking for getrusage -- Looking for getrusage - not found -- Looking for setrlimit -- Looking for setrlimit - not found -- Looking for isatty -- Looking for isatty - found -- Looking for futimens -- Looking for futimens - not found -- Looking for futimes -- Looking for futimes - not found -- Looking for posix_fallocate -- Looking for posix_fallocate - not found -- Looking for sigaltstack -- Looking for sigaltstack - not found -- Looking for lseek64 -- Looking for lseek64 - found -- Looking for mallctl -- Looking for mallctl - not found -- Looking for mallinfo -- Looking for mallinfo - not found -- Looking for malloc_zone_statistics -- Looking for malloc_zone_statistics - not found -- Looking for mkdtemp -- Looking for mkdtemp - not found -- Looking for mkstemp -- Looking for mkstemp - found -- Looking for mktemp -- Looking for mktemp - found -- Looking for getcwd -- Looking for getcwd - found -- Looking for gettimeofday -- Looking for gettimeofday - found -- Looking for getrlimit -- Looking for getrlimit - not found -- Looking for posix_spawn -- Looking for posix_spawn - not found -- Looking for pread -- Looking for pread - not found -- Looking for realpath -- Looking for realpath - not found -- Looking for sbrk -- Looking for sbrk - not found -- Looking for strtoll -- Looking for strtoll - found -- Looking for strerror -- Looking for strerror - found -- Looking for strerror_r -- Looking for strerror_r - not found -- Looking for strerror_s -- Looking for strerror_s - found -- Looking for setenv -- Looking for setenv - not found -- Looking for _chsize_s -- Looking for _chsize_s - found -- Looking for _alloca -- Looking for _alloca - not found -- Looking for alloca -- Looking for alloca - found -- Looking for chkstk -- Looking for chkstk - not found -- Looking for chkstk_ms -- Looking for chkstkms - not found -- Looking for chkstk -- Looking for _chkstk - found -- Looking for _chkstk_ms -- Looking for ___chkstk_ms - found -- Looking for ashldi3 -- Looking for ashldi3 - not found -- Looking for ashrdi3 -- Looking for ashrdi3 - not found -- Looking for divdi3 -- Looking for divdi3 - not found -- Looking for fixdfdi -- Looking for fixdfdi - not found -- Looking for fixsfdi -- Looking for fixsfdi - not found -- Looking for floatdidf -- Looking for floatdidf - not found -- Looking for lshrdi3 -- Looking for lshrdi3 - not found -- Looking for moddi3 -- Looking for moddi3 - not found -- Looking for udivdi3 -- Looking for udivdi3 - not found -- Looking for umoddi3 -- Looking for umoddi3 - not found -- Looking for main -- Looking for main - found -- Looking for cmpdi2 -- Looking for cmpdi2 - not found -- Looking for GLIBC -- Looking for GLIBC__ - not found -- Looking for sched_getaffinity -- Looking for sched_getaffinity - not found -- Looking for CPU_COUNT -- Looking for CPU_COUNT - not found -- Performing Test HAVE_INT64_T -- Performing Test HAVE_INT64_T - Success -- Performing Test HAVE_UINT64_T -- Performing Test HAVE_UINT64_T - Success -- Performing Test HAVE_U_INT64_T -- Performing Test HAVE_U_INT64_T - Failed -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success -- Performing Test LLVM_HAS_ATOMICS -- Performing Test LLVM_HAS_ATOMICS - Success -- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG -- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success -- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG -- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed -- Performing Test HAS_MAYBE_UNINITIALIZED -- Performing Test HAS_MAYBE_UNINITIALIZED - Success -- Native target architecture is X86 -- Threads enabled. -- Doxygen disabled. -- Go bindings disabled. -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) -- OCaml bindings disabled. -- Could NOT find Python module pygments -- Could NOT find Python module pygments.lexers.c_cpp -- Could NOT find Python module yaml -- LLVM host triple: x86_64-w64-mingw32 -- LLVM default target triple: x86_64-pc-windows-gnu -- Performing Test C_SUPPORTS_WERROR_DATE_TIME -- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW -- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed -- Performing Test CXX_SUPPORTS_CXX11 -- Performing Test CXX_SUPPORTS_CXX11 - Success -- Found PythonInterp: C:/Users/Boris Shukhman/AppData/Local/Enthought/Canopy/Us er/Scripts/python.exe (found version "2.7.6") -- Constructing LLVMBuild project information -- LLVMHello ignored -- Loadable modules not supported on this platform. -- Targeting AArch64 -- Targeting AMDGPU -- Targeting ARM -- Targeting BPF -- Targeting Hexagon -- Targeting Lanai -- Targeting Mips -- Targeting MSP430 -- Targeting NVPTX -- Targeting PowerPC -- Targeting Sparc -- Targeting SystemZ -- Targeting X86 -- Targeting XCore -- Looking for sys/resource.h -- Looking for sys/resource.h - not found -- Clang version: 7.0.0 -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed -- SampleAnalyzerPlugin ignored -- Loadable modules not supported on this platfo rm. -- PrintFunctionNames ignored -- Loadable modules not supported on this platform . -- AnnotateFunctions ignored -- Loadable modules not supported on this platform.

-- BugpointPasses ignored -- Loadable modules not supported on this platform. -- Configuring done -- Generating done -- Build files have been written to: C:/cygwin64/home/BorisShukhman/build

yrnkrn commented 5 years ago

This looks good. Now run ninja.

Bobingit commented 5 years ago

Thank you, Yaron. I will need to switch to smth else for an hour or so. Pls., let me ask: If it works smoothly through the build process should it produce zapcc.exe (probably in build/bin ?) or I need make config; make install afterwards?

yrnkrn commented 5 years ago

Should work from build.

Bobingit commented 5 years ago

Alas :( c:\cygwin64\home\BorisShukhman\build>ninja check-all [418/3635] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Globals.cpp.obj FAILED: lib/IR/CMakeFiles/LLVMCore.dir/Globals.cpp.obj C:\mingw64\bin\c++.exe -DGTEST_HAS_RTTI=0 -DSTDC_CONSTANT_MACROS -DSTDC_FOR MAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/IR -IC:/cygwin64/home/BorisShukhman/llvm/ lib/IR -Iinclude -IC:/cygwin64/home/BorisShukhman/llvm/include -Wa,-mbig-obj -We rror=date-time -std=gnu++11 -w -O2 -DNDEBUG -fno-exceptions -fno-rtti -MD -M T lib/IR/CMakeFiles/LLVMCore.dir/Globals.cpp.obj -MF lib\IR\CMakeFiles\LLVMCore. dir\Globals.cpp.obj.d -o lib/IR/CMakeFiles/LLVMCore.dir/Globals.cpp.obj -c C:/cy gwin64/home/BorisShukhman/llvm/lib/IR/Globals.cpp C:/cygwin64/home/BorisShukhman/llvm/lib/IR/Globals.cpp:37:35: error: static asse rtion failed: unexpected GlobalValue size growth static_assert(sizeof(GlobalValue) ==

                   sizeof(Constant) + 3 * sizeof(void *) + 2 * sizeof(unsigned),

[423/3635] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/InlineAsm.cpp.obj ninja: build stopped: subcommand failed.

yrnkrn commented 5 years ago

Yes, this is issue #24. See also https://bugs.llvm.org/show_bug.cgi?id=38168