Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict between system and julia's LLVM #34

Closed
cbecker opened this issue Dec 7, 2014 · 17 comments
Closed

Conflict between system and julia's LLVM #34

cbecker opened this issue Dec 7, 2014 · 17 comments

Comments

@cbecker
Copy link
Contributor

cbecker commented Dec 7, 2014

I am not sure what I am doing wrong, but I am getting errors that suggest that there is a conflict between the LLVM installed on my linux box (archlinux) and the one julia builds. Is there a way to make Cxx exclusively use julia's LLVM?

julia> Pkg.build("Cxx")
INFO: Building Cxx
Tuning for julia installation at: /data/phd/github/julia.4/usr/bin
    CC /home//.julia/v0.4/Cxx/deps/build/bootstrap.o
In file included from /usr/include/llvm/IR/ValueMap.h:30:0,
                 from ../src/bootstrap.cpp:14:
/usr/include/llvm/IR/ValueHandle.h:27:7: error: redefinition of ‘class llvm::PointerLikeTypeTraits<llvm::ValueHandleBase**>’
 class PointerLikeTypeTraits<ValueHandleBase**> {
       ^
In file included from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ADT/ValueMap.h:31:0,
                 from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ExecutionEngine/ExecutionEngine.h:22,
                 from ../src/bootstrap.cpp:13:
/data/phd/github/julia.4/usr/bin/../../usr/include/llvm/Support/ValueHandle.h:27:7: error: previous definition of ‘class llvm::PointerLikeTypeTraits<llvm::ValueHandleBase**>’
 class PointerLikeTypeTraits<ValueHandleBase**> {
@sjkelly
Copy link
Contributor

sjkelly commented Dec 19, 2014

What does your Make.user for Julia look like?

@Keno
Copy link
Collaborator

Keno commented Jan 4, 2015

Is this fixed by putting all the llvm includes in angle brackets?

@cbecker
Copy link
Contributor Author

cbecker commented Jan 4, 2015

Hi sorry for the late reply, I was away for a while.
My Make.user file is

LLVM_ASSERTIONS=1
#LLVM_VER=svn
BUILD_LLVM_CLANG=1
BUILD_LLDB=1
LLDB_VER=master
USE_LLVM_SHLIB=1
#LLDB_DISABLE_PYTHON=1
#LLVM_DEBUG=1

@Keno, you suggest going through all .h files and change the include directives?

@Keno
Copy link
Collaborator

Keno commented Jan 4, 2015

No, just in bootstrap.cpp

@cbecker
Copy link
Contributor Author

cbecker commented Jan 4, 2015

mm no, I still get the redefinition error.

@Keno
Copy link
Collaborator

Keno commented Jan 4, 2015

Can I see the output of

julia> ENV["VERBOSE"] = "1"
julia> Pkg.build("Cxx")

@cbecker
Copy link
Contributor Author

cbecker commented Jan 4, 2015

Sure, here it goes (truncated after a few lines, it just continues..)

julia> Pkg.build("Cxx")
INFO: Building Cxx
Tuning for julia installation at: /data/phd/github/julia.4/usr/bin
 g++ -m64 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g -std=c++11   -I/data/phd/github/julia.4/usr/bin/../../usr/include -I/data/phd/github/julia.4/usr/bin/../../src/support -I/data/phd/github/julia.4/usr/include -I/data/phd/github/julia.4/usr/bin/../../deps/llvm-3.3/tools/clang/lib -c ../src/bootstrap.cpp -o build/bootstrap.o
In file included from /usr/include/llvm/IR/ValueMap.h:30:0,
                 from ../src/bootstrap.cpp:14:
/usr/include/llvm/IR/ValueHandle.h:27:7: error: redefinition of ‘class llvm::PointerLikeTypeTraits<llvm::ValueHandleBase**>’
 class PointerLikeTypeTraits<ValueHandleBase**> {
       ^
In file included from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ADT/ValueMap.h:31:0,
                 from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ExecutionEngine/ExecutionEngine.h:22,
                 from ../src/bootstrap.cpp:13:
/data/phd/github/julia.4/usr/bin/../../usr/include/llvm/Support/ValueHandle.h:27:7: error: previous definition of ‘class llvm::PointerLikeTypeTraits<llvm::ValueHandleBase**>’
 class PointerLikeTypeTraits<ValueHandleBase**> {
       ^
In file included from /usr/include/llvm/IR/ValueMap.h:30:0,
                 from ../src/bootstrap.cpp:14:
/usr/include/llvm/IR/ValueHandle.h:41:7: error: redefinition of ‘class llvm::ValueHandleBase’
 class ValueHandleBase {
       ^
In file included from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ADT/ValueMap.h:31:0,
                 from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ExecutionEngine/ExecutionEngine.h:22,
                 from ../src/bootstrap.cpp:13:
/data/phd/github/julia.4/usr/bin/../../usr/include/llvm/Support/ValueHandle.h:41:7: error: previous definition of ‘class llvm::ValueHandleBase’
 class ValueHandleBase {
       ^
In file included from /usr/include/llvm/IR/ValueMap.h:30:0,
                 from ../src/bootstrap.cpp:14:
/usr/include/llvm/IR/ValueHandle.h:145:7: error: redefinition of ‘class llvm::WeakVH’
 class WeakVH : public ValueHandleBase {
       ^
In file included from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ADT/ValueMap.h:31:0,
                 from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ExecutionEngine/ExecutionEngine.h:22,
                 from ../src/bootstrap.cpp:13:
/data/phd/github/julia.4/usr/bin/../../usr/include/llvm/Support/ValueHandle.h:145:7: error: previous definition of ‘class llvm::WeakVH’
 class WeakVH : public ValueHandleBase {
       ^
In file included from /usr/include/llvm/IR/ValueMap.h:30:0,
                 from ../src/bootstrap.cpp:14:
/usr/include/llvm/IR/ValueHandle.h:166:19: error: redefinition of ‘struct llvm::simplify_type<llvm::WeakVH>’
 template<> struct simplify_type<WeakVH> {
                   ^
In file included from /data/phd/github/julia.4/usr/bin/../../usr/include/llvm/ADT/ValueMap.h:31:0,

@Keno
Copy link
Collaborator

Keno commented Jan 4, 2015

That looks ok, but looking back in your Make.user, I see LLVM_VER commented out. Cxx.jl requires LLVM svn and won't work with 3.3.

@cbecker
Copy link
Contributor Author

cbecker commented Jan 6, 2015

@Keno, good point.
Now I tried with Make.user:

LLVM_ASSERTIONS=1
LLVM_VER=svn
BUILD_LLVM_CLANG=1
BUILD_LLDB=1
LLDB_VER=master
USE_LLVM_SHLIB=1
#LLDB_DISABLE_PYTHON=1
#LLVM_DEBUG=1

and after doing make I get an error:

Already up-to-date.
Already up-to-date.
Already up-to-date.
Already up-to-date.
Already up-to-date.
/bin/sh: line 3: ../configure: No such file or directory
Makefile:504: recipe for target 'llvm-svn/build_Release+Asserts/config.status' failed
make[2]: *** [llvm-svn/build_Release+Asserts/config.status] Error 127
Makefile:101: recipe for target 'julia-release' failed
make[1]: *** [julia-release] Error 2
Makefile:49: recipe for target 'release' failed
make: *** [release] Error 2
[cjb@laptop julia.4]$ make
Already up-to-date.
Already up-to-date.
Already up-to-date.
Already up-to-date.
Already up-to-date.
/bin/sh: line 3: ../configure: No such file or directory
Makefile:504: recipe for target 'llvm-svn/build_Release+Asserts/config.status' failed
make[2]: *** [llvm-svn/build_Release+Asserts/config.status] Error 127
Makefile:101: recipe for target 'julia-release' failed
make[1]: *** [julia-release] Error 2
Makefile:49: recipe for target 'release' failed
make: *** [release] Error 2

@sjkelly
Copy link
Contributor

sjkelly commented Jan 20, 2015

@cbecker if possible, just have your Make.user look like the following:

override LLDB_VER=master
override LLVM_VER=svn
override LLVM_ASSERTIONS=1
override BUILD_LLVM_CLANG=1
override BUILD_LLDB=1
override USE_LLVM_SHLIB=1
override LLDB_DISABLE_PYTHON=1

@cbecker
Copy link
Contributor Author

cbecker commented Jan 21, 2015

Hi, that seems to fix it.
I got some errors with lpthread, but then they disappeared.
As in the readme of the git repo, I added the pthread library dependence, but afterwards doing make on julia's source code root folder would not process anything else.
I am running now make test, seems fine so far.

however, now I can do the following, though I still get some errors:

./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+2839 (2015-01-21 02:39 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 8b4e9e9 (0 days old master)
|__/                   |  x86_64-unknown-linux-gnu

julia> Pkg.build("Cxx")
INFO: Building Cxx
Tuning for julia installation at: /data/phd/github/julia.4/usr/bin
Not building debug library because corresponding julia DEBUG library does not exist.
To build, simply run the build again once the library at
/data/phd/github/julia.4/usr/bin/../../usr/lib/libjulia-debug.so
has been built.

julia> using Cxx
ERROR: LoadError: LoadError: Could not find C++ standard library
 in include at ./boot.jl:249
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:249
 in include_from_node1 at ./loading.jl:128
 in reload_path at ./loading.jl:152
 in _require at ./loading.jl:67
 in require at ./loading.jl:52
 in print at ./string.jl
while loading /home/cjb/.julia/v0.4/Cxx/src/initialization.jl, in expression starting on line 251
while loading /home/cjb/.julia/v0.4/Cxx/src/Cxx.jl, in expression starting on line 152

@cbecker
Copy link
Contributor Author

cbecker commented Jan 26, 2015

could ERROR: LoadError: LoadError: Could not find C++ standard library be because CXX.jl is only looking for stdlibs in system folders, and in this case julia is only residing in its local folder?

@cbecker
Copy link
Contributor Author

cbecker commented Jan 26, 2015

@sjkelly , @Keno

I think I found the problem, it has to do with the include/library folders. My system has the following include path: /usr/include/c++/4.9.2/x86_64-unknown-linux-gnu/, that is c++ + version + triple

While Cxx.jl looks for something like triple + c++ + version. Therefore, include paths do not work. This issue is in initialization.jl. I will submit a patch soon.

cbecker added a commit to cbecker/Cxx.jl that referenced this issue Jan 26, 2015
@cbecker
Copy link
Contributor Author

cbecker commented Jan 26, 2015

The fix is here.

Everything was working fine, until I pulled the newest master from Keno/Cxx.jl and now I get the folloowing error:

Warning: error initializing module Cxx:
BoundsError(a=Array{Cxx.ClangCompiler, 1}[], i=(1,))

But the include folders seem correct.

@sjkelly
Copy link
Contributor

sjkelly commented Jan 26, 2015

I think it is related to: #74 (comment)

I saw the same error but haven't rebuilt LLVM yet, so I am not sure if it is related to that.

@Keno is this a new issue?

Keno added a commit that referenced this issue Jan 27, 2015
@Keno Keno closed this as completed in 5efa559 Jan 27, 2015
@Keno
Copy link
Collaborator

Keno commented Jan 27, 2015

Hadn't tested the new code on Linux. Should be fixed now.

@cbecker
Copy link
Contributor Author

cbecker commented Jan 27, 2015

@Keno indeed, working now, that's great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants