JuliaInterop / Cxx.jl

The Julia C++ Interface
Other
760 stars 107 forks source link

Cxx Crash on OS X with latest 0.5 master #254

Open protogeezer opened 8 years ago

protogeezer commented 8 years ago

building julia with latest sources (plus the recommended Make.user) results in the following crash:

et-imac-retina:julia-0.5-cxx sjbespa$ usr/bin/julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-dev+3825 (2016-05-01 18:02 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 89775a5 (0 days old master)
|__/                   |  x86_64-apple-darwin15.5.0

julia> using Cxx
WARNING: cfunction: process_cxx_exception does not returnWARNING: Could not add directory /Users/sjbespa/work/julia/julia-0.5/usr/bin/../lib/clang/3.7.1/include/ to clang search path!
In file included from :1:
In file included from :1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:435:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/wchar.h:89:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
         ^
In file included from :1:
__cxxjl_8.cpp:5:10: fatal error: 'clang/Parse/Parser.h' file not found
#include "clang/Parse/Parser.h"

There seems to be a problem with how the julia clang search path is configured:

et-imac-retina:julia-0.5-cxx sjbespa$ echo | usr/bin/clang++ -Wp,-v -x c++ - -fsyntax-only
clang -cc1 version 3.7.1 based upon LLVM 3.7.1 default target x86_64-apple-darwin15.5.0
ignoring nonexistent directory "/Users/sjbespa/work/julia/julia-0.5-cxx/usr/bin/../include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Users/sjbespa/work/julia/julia-0.5-cxx/usr/bin/../lib/clang/3.7.1/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks (framework directory)

The specific cause of the crash is that the standard library headers are in

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Keno commented 8 years ago

Try redoing Pkg.build() from the julia at julia-0.5-cxx/usr/bin/julia. It seems like it has the wrong path.

protogeezer commented 8 years ago

Thanks, that fixed the crash. There is still a warning cfunction: process_cxx_exception does not return so I’ll press on with 0.5.

Should I submit an issue on Cxx with 0.4? It’s started to throw a LoadError: ERROR: LoadError: LoadError: syntax: invalid method name "::Type{CppRef{T,CVR}}” if 0.4 is being left behind, so be it... Stephen

On May 2, 2016, at 9:20 AM, Keno Fischer notifications@github.com wrote:

Try redoing Pkg.build() from the julia at julia-0.5-cxx/usr/bin/julia. It seems like it has the wrong path.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

Keno commented 8 years ago

0.4 is being left behind

protogeezer commented 8 years ago

Trying to update to the latest master and a build that installs into /usr/local/ doesn't seem to work:

julia> Pkg.clone("https://github.com/Keno/Cxx.jl.git")
INFO: Cloning Cxx from https://github.com/Keno/Cxx.jl.git
INFO: Computing changes...
INFO: No packages to install, update or remove
INFO: Package database updated

julia> Pkg.build("Cxx")
INFO: Building Cxx
writing path.jl file
Tuning for julia installation at: /usr/local/bin
 c++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g -std=c++11   -I/usr/local/bin/../../src/support -I/usr/local/bin/../include -Isrc/clang-3.7.1/lib -Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include -Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c ../src/bootstrap.cpp -o build/bootstrap.o
../src/bootstrap.cpp:32:10: fatal error: 'clang/Sema/ScopeInfo.h' file not found
#include "clang/Sema/ScopeInfo.h"
         ^
1 error generated.
make: *** [build/bootstrap.o] Error 1
=================================================================[ ERROR: Cxx ]==================================================================

LoadError: failed process: Process(`make -j8 -f BuildBootstrap.Makefile BASE_JULIA_HOME=/usr/local/bin`, ProcessExited(2)) [2]
while loading /Users/sjbespa/.julia/v0.5/Cxx/deps/build.jl, in expression starting on line 31

=================================================================================================================================================

================================================================[ BUILD ERRORS ]=================================================================

WARNING: Cxx had build errors.

 - packages with build errors remain installed in /Users/sjbespa/.julia/v0.5
 - build the package(s) and all dependencies with `Pkg.build("Cxx")`
 - build a single package by running its `deps/build.jl` script

Any thoughts would be appreciated.

Keno commented 8 years ago

Yes, I have a fix for this, but I've been occupied with the libgit2 mess on julia proper. I will get back to this shortly.

Keno commented 8 years ago

FWIW, the fix is already on the kf/travis branch if you just want to make progress.

protogeezer commented 8 years ago

Thanks - I do need to make progress.

On Jul 22, 2016, at 5:34 PM, Keno Fischer notifications@github.com wrote:

FWIW, the fix is already on the kf/travis branch if you just want to make progress.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

protogeezer commented 8 years ago

I tried deleting the Cxx package and then created a new clone, (here's the part I'm not sure about) checked out the kf/travis branch in ~/.julia/v0.5/cxx, and then tried to build the package. It got further but then crashed with:

Scanning dependencies of target c-arcmt-test
[ 98%] Building C object tools/c-arcmt-test/CMakeFiles/c-arcmt-test.dir/c-arcmt-test.c.o
[ 98%] Building C object tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o
[ 98%] Linking CXX executable ../../bin/c-arcmt-test
[ 98%] Built target c-arcmt-test
[100%] Linking CXX executable ../../bin/c-index-test
[100%] Built target c-index-test
 c++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g -std=c++11   -I/usr/local/bin/../../src/support -I/usr/local/bin/../include -Isrc/clang-3.7.1/lib -Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include -Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c ../src/bootstrap.cpp -o build/bootstrap.o
 c++ -shared -fPIC -L/usr/local/bin/../lib -L/usr/local/bin/../lib/julia -Lbuild/clang-3.7.1/lib -ljulia-debug -lLLVM-3.7.1 -o usr/lib/libcxxffi-debug.dylib -Xlinker -all_load -lclangFrontendTool -lclangBasic -lclangLex -lclangDriver -lclangFrontend -lclangParse -lclangAST -lclangASTMatchers -lclangSema -lclangAnalysis -lclangEdit -lclangRewriteFrontend -lclangRewrite -lclangSerialization -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangStaticAnalyzerFrontend -lclangTooling -lclangToolingCore -lclangCodeGen -lclangARCMigrate  build/bootstrap.o 
 c++ -shared -fPIC -L/usr/local/bin/../lib -L/usr/local/bin/../lib/julia -Lbuild/clang-3.7.1/lib -ljulia -lLLVM-3.7.1 -o usr/lib/libcxxffi.dylib -Xlinker -all_load -lclangFrontendTool -lclangBasic -lclangLex -lclangDriver -lclangFrontend -lclangParse -lclangAST -lclangASTMatchers -lclangSema -lclangAnalysis -lclangEdit -lclangRewriteFrontend -lclangRewrite -lclangSerialization -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangStaticAnalyzerFrontend -lclangTooling -lclangToolingCore -lclangCodeGen -lclangARCMigrate  build/bootstrap.o 
Undefined symbols for architecture x86_64:
Undefined symbols for architecture x86_64:
  "llvm::raw_svector_ostream::raw_svector_ostream(llvm::SmallVectorImpl<char>&)", referenced from:
  "llvm::raw_svector_ostream::raw_svector_ostream(llvm::SmallVectorImpl<char>&)", referenced from:
      _getTypeName in bootstrap.o
      _getTypeName in bootstrap.o
  "llvm::raw_svector_ostream::~raw_svector_ostream()", referenced from:
  "llvm::raw_svector_ostream::~raw_svector_ostream()", referenced from:
      _getTypeName in bootstrap.o
      _getTypeName in bootstrap.o
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: **\* [usr/lib/libcxxffi-debug.dylib] Error 1
make: **\* Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: **\* [usr/lib/libcxxffi.dylib] Error 1
=======================================================================[ ERROR: Cxx ]=======================================================================

LoadError: failed process: Process(`make -j8 -f BuildBootstrap.Makefile BASE_JULIA_HOME=/usr/local/bin`, ProcessExited(2)) [2]
while loading /Users/sjbespa/.julia/v0.5/Cxx/deps/build.jl, in expression starting on line 32

# 

======================================================================[ BUILD ERRORS ]======================================================================

WARNING: Cxx had build errors.
- packages with build errors remain installed in /Users/sjbespa/.julia/v0.5
- build the package(s) and all dependencies with `Pkg.build("Cxx")`
- build a single package by running its `deps/build.jl` script

#