llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.11k stars 12.01k forks source link

Build problems on OpenBSD #2095

Closed llvmbot closed 17 years ago

llvmbot commented 17 years ago
Bugzilla Link 1723
Resolution REMIND
Resolved on Oct 11, 2007 05:34
Version 2.1
OS OpenBSD
Attachments Minimal build fixes for OpenBSD
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

LLVM 2.1 doesn't install out of the box on OpenBSD-currend amd64. The minimum fixes needed to fix things for me are:

1) include/llvm/Pass.h doesn't know about intptr_t. Quick hack: include stdint.h. There's probably a more idiomatic way of fixing this.

2) include/llvm/ADT/DenseMap.h uses new style C++ casts which GCC 3.3.5 doesn't understand. Revert a previous patch which added these (nowhere else in the code base seems to have this problem).

3) Makefile.rules tries to install files as root during the normal build process (i.e. before "make install"). This then causes an error for LLVMHello. I've hacked this so that in the offending rule, install is only called if the compiler target is itself install. I suspect this is not OpenBSD specific, and would affect anyone who compiles as a normal user, calling only "make install" as root.

llvmbot commented 17 years ago

Hi all,

Has anyone been able to look at patch #​3, where Makefile.rules can try to incorrectly install things as root during the normal build process?

-Laurie

lattner commented 17 years ago

Ok, patch applied, thanks! http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071001/054318.html

llvmbot commented 17 years ago

Dear Chris,

hrm, can you try this?

reinterpret_cast<whatever*>(intptr_t(-1))

does that work?

On the back of your suggestion, I had another look at this, and it turns out that the necessary fix is much easier than it first appeared after my trawl through the CVS history. The attached patch is all that is needed.

-Laurie

--- include/llvm/ADT/DenseMap.h.orig Sun Oct 7 09:07:02 2007 +++ include/llvm/ADT/DenseMap.h Sun Oct 7 09:13:37 2007 @@ -35,8 +35,8 @@ struct DenseMapKeyInfo<T> { static inline T getEmptyKey() { return reinterpret_cast<T>(-1); } static inline T getTombstoneKey() { return reinterpret_cast<T>(-2); } static unsigned getHashValue(const T PtrVal) {

lattner commented 17 years ago

hrm, can you try this?

reinterpret_cast<whatever*>(intptr_t(-1))

does that work?

-Chris

lattner commented 17 years ago

The densemap changes look like they are because reinterpret_cast isn't working. Switching to a C-style cast will be bad, because it breaks users of -Wold-style-cast. Why isn't reinterpret_cast working?

-Chris

asl commented 17 years ago

Dear Anton,

1) include/llvm/Pass.h doesn't know about intptr_t. Quick hack: include stdint.h. There's probably a more idiomatic way of fixing this. could you please check, whether including llvm/Support/DataTypes.h fixes this problem for you?

Indeed it does fix the problem - and I think your suggestion comes under the "more idiomatic" heading so that's good :)

-Laurie

Thanks, I commited the fix. I'll let Chris review DenseMap.h stuff :)

llvmbot commented 17 years ago

Dear Anton,

1) include/llvm/Pass.h doesn't know about intptr_t. Quick hack: include stdint.h. There's probably a more idiomatic way of fixing this. could you please check, whether including llvm/Support/DataTypes.h fixes this problem for you?

Indeed it does fix the problem - and I think your suggestion comes under the "more idiomatic" heading so that's good :)

-Laurie

asl commented 17 years ago

Laurence,

Created an attachment (id=1153) [details] Minimal build fixes for OpenBSD

LLVM 2.1 doesn't install out of the box on OpenBSD-currend amd64. The minimum fixes needed to fix things for me are:

1) include/llvm/Pass.h doesn't know about intptr_t. Quick hack: include stdint.h. There's probably a more idiomatic way of fixing this. could you please check, whether including llvm/Support/DataTypes.h fixes this problem for you?

llvmbot commented 17 years ago

assigned to @lattner