digego / extempore

A cyber-physical programming environment
1.4k stars 127 forks source link

Compiler Error for wrong conversion in LLVM/include/llvm/IR/ValueMap.h while building on arch #318

Closed jsaalfeld closed 6 years ago

jsaalfeld commented 6 years ago

Hi there. I'm trying to build the extempore-git package on an arch-system. And I ran into this error:

[ 18%] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o
In file included from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Target/TargetSubtargetInfo.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineRegisterInfo.h:23,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:21,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/SchedulerRegistry.h: In constructor ‘llvm::RegisterScheduler::RegisterScheduler(const char*, const char*, llvm::RegisterScheduler::FunctionPassCtor)’:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/SchedulerRegistry.h:42:52: warning: cast between incompatible function types from ‘llvm::RegisterScheduler::FunctionPassCtor’ {aka ‘llvm::ScheduleDAGSDNodes* (*)(llvm::SelectionDAGISel*, llvm::CodeGenOpt::Level)’} to ‘llvm::MachinePassCtor’ {aka ‘void* (*)()’} [-Wcast-function-type]
   : MachinePassRegistryNode(N, D, (MachinePassCtor)C)
                                                    ^
In file included from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/PseudoSourceValue.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineMemOperand.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/SelectionDAGNodes.h:31,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Target/TargetLowering.h:29,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/ScheduleDAG.h:25,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:22,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/IR/ValueMap.h: In member function ‘bool llvm::ValueMap<KeyT, ValueT, Config>::hasMD() const’:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/IR/ValueMap.h:102:31: error: cannot convert ‘const std::unique_ptr<llvm::DenseMap<const llvm::Metadata*, llvm::TrackingMDRef> >’ to ‘bool’ in return
   bool hasMD() const { return MDMap; }
                               ^~~~~
In file included from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Allocator.h:24,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringMap.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Host.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/Hashing.h:49,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/ArrayRef.h:13,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineInstr.h:19,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineBasicBlock.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/SmallVector.h: In instantiation of ‘void llvm::SmallVectorTemplateBase<T, true>::push_back(const T&) [with T = std::pair<int, long int>]’:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineFrameInfo.h:359:77:   required from here
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/SmallVector.h:340:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::pair<int, long int>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(this->end(), &Elt, sizeof(T));
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8.1.0/utility:70,
                 from /usr/include/c++/8.1.0/algorithm:60,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringRef.h:14,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringMap.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Host.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/Hashing.h:49,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/ArrayRef.h:13,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineInstr.h:19,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineBasicBlock.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/usr/include/c++/8.1.0/bits/stl_pair.h:198:12: note: ‘struct std::pair<int, long int>’ declared here
     struct pair
            ^~~~
In file included from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Allocator.h:24,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringMap.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Host.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/Hashing.h:49,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/ArrayRef.h:13,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineInstr.h:19,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineBasicBlock.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/SmallVector.h: In instantiation of ‘void llvm::SmallVectorTemplateBase<T, true>::push_back(const T&) [with T = std::pair<void*, long unsigned int>]’:
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Allocator.h:238:33:   required from ‘void* llvm::BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>::Allocate(size_t, size_t) [with AllocatorT = llvm::MallocAllocator; long unsigned int SlabSize = 4096; long unsigned int SizeThreshold = 4096; size_t = long unsigned int]’
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/ArrayRecycler.h:129:12:   required from ‘T* llvm::ArrayRecycler<T, Align>::allocate(llvm::ArrayRecycler<T, Align>::Capacity, AllocatorType&) [with AllocatorType = llvm::BumpPtrAllocatorImpl<>; T = llvm::MachineOperand; long unsigned int Align = 8]’
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineFunction.h:469:51:   required from here
/home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/SmallVector.h:340:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::pair<void*, long unsigned int>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(this->end(), &Elt, sizeof(T));
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8.1.0/utility:70,
                 from /usr/include/c++/8.1.0/algorithm:60,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringRef.h:14,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/StringMap.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/Support/Host.h:17,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/Hashing.h:49,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/ADT/ArrayRef.h:13,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineInstr.h:19,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/include/llvm/CodeGen/MachineBasicBlock.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AntiDepBreaker.h:18,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.h:20,
                 from /home/user/.cache/aurman/extempore-git/src/build/llvm/src/LLVM/lib/CodeGen/AggressiveAntiDepBreaker.cpp:17:
/usr/include/c++/8.1.0/bits/stl_pair.h:198:12: note: ‘struct std::pair<void*, long unsigned int>’ declared here
     struct pair
            ^~~~
make[5]: *** [lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/build.make:63: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:778: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/all] Error 2
make[3]: *** [Makefile:152: all] Error 2
make[2]: *** [CMakeFiles/LLVM.dir/build.make:114: llvm/src/LLVM-stamp/LLVM-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:1260: CMakeFiles/LLVM.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
2018-05-31 12:58:07,937 - wrappers - makepkg - ERROR - makepkg query makepkg -cf --noconfirm failed in directory /home/user/.cache/aurman/extempore-git
jsaalfeld commented 6 years ago

And even though i have LLVM (currently 6.0.0 - not 3.8 like described in the CMakeList.txt) installed: https://www.archlinux.org/packages/extra/x86_64/llvm/

And I set the environment Variable EXT_LLVM_DIR, that results in an error:

Scanning dependencies of target external_shlibs_audio
make[2]: *** No rule to make target '../LLVM', needed by 'CMakeFiles/external_shlibs_audio'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:1446: CMakeFiles/external_shlibs_audio.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
benswift commented 6 years ago

Hey there,

Unfortunately LLVM 3.8 is required - it won't build against later versions. The installation process should try to dowload & build it itself, but I must confess I'm not an arch user - it's possible something's broken there.

jsaalfeld commented 6 years ago

That's a pity. I need the newer LLVM Versions for other dependencies, so I can't just install it system wide and the older version doesn't seem to compile against a new gcc :/

benswift commented 6 years ago

That is a bummer about the older gcc thing. I realise that the old LLVM thing is a bit of a pain, which is why Extempore tries to just maintain it's own "dep-world" and not interfere with e.g. system LLVM.

Re: the gcc issues, can you get the old behaviour with appropriate compiler flags? If so, you could use CXX_COMPILER_FLAGS to try and coerce it into working.

jsaalfeld commented 6 years ago

That is a bummer about the older gcc thing. I realise that the old LLVM thing is a bit of a pain, which is why Extempore tries to just maintain it's own "dep-world" and not interfere with e.g. system LLVM.

Totally understand that. Keeping up to date with everything is a real pain.

Re: the gcc issues, can you get the old behaviour with appropriate compiler flags? If so, you could use CXX_COMPILER_FLAGS to try and coerce it into working.

Haven't thought of that! Will look into that!

nic-donaldson commented 6 years ago

I've been looking at this a little. It looks like LLVM 3.8 doesn't want to compile under new GCC versions. So on Arch you can get around this by installing gcc5 and running:

env CXX=g++-5 cmake ...

Or by patching the line in include/llvm/IR/ValueMap.h that doesn't compile to this:

bool hasMD() const { return bool(MDMap); }