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

Build failure with llvm trunk #5984

Closed
octoploid opened this issue Feb 28, 2014 · 7 comments
Closed

Build failure with llvm trunk #5984

octoploid opened this issue Feb 28, 2014 · 7 comments

Comments

@octoploid
Copy link
Contributor

Two issues:

codegen.cpp: In function ‘void jl_dump_bitcode(char*)’:
codegen.cpp:288:33: error: no matching function for call to ‘llvm::raw_fd_ostream::raw_fd_ostream(char*&, std::string&)’
     raw_fd_ostream OS(fname, err);
                                 ^
codegen.cpp:288:33: note: candidates are:
In file included from /usr/local/include/llvm/ExecutionEngine/ObjectBuffer.h:21:0,
                 from /usr/local/include/llvm/ExecutionEngine/RuntimeDyld.h:18,
                 from /usr/local/include/llvm/ExecutionEngine/JITMemoryManager.h:13,
                 from codegen.cpp:31:
/usr/local/include/llvm/Support/raw_ostream.h:354:3: note: llvm::raw_fd_ostream::raw_fd_ostream(int, bool, bool)
   raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
   ^
/usr/local/include/llvm/Support/raw_ostream.h:354:3: note:   no known conversion for argument 2 from ‘std::string {aka std::basic_string<char>}’ to ‘bool’
/usr/local/include/llvm/Support/raw_ostream.h:349:3: note: llvm::raw_fd_ostream::raw_fd_ostream(const char*, std::string&, llvm::sys::fs::OpenFlags)
   raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
   ^
/usr/local/include/llvm/Support/raw_ostream.h:349:3: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/llvm/Support/raw_ostream.h:310:7: note: llvm::raw_fd_ostream::raw_fd_ostream(const llvm::raw_fd_ostream&)
 class raw_fd_ostream : public raw_ostream {
       ^
/usr/local/include/llvm/Support/raw_ostream.h:310:7: note:   candidate expects 1 argument, 2 provided
codegen.cpp: In function ‘void init_julia_llvm_env(llvm::Module*)’:
codegen.cpp:3958:28: error: no matching function for call to ‘llvm::legacy::FunctionPassManager::add(llvm::DataLayout*&)’
     FPM->add(jl_data_layout);
                            ^
codegen.cpp:3958:28: note: candidate is:
In file included from /usr/local/include/llvm/PassManager.h:27:0,
                 from codegen.cpp:32:
/usr/local/include/llvm/IR/LegacyPassManager.h:83:8: note: virtual void llvm::legacy::FunctionPassManager::add(llvm::Pass*)
   void add(Pass *P);
        ^
/usr/local/include/llvm/IR/LegacyPassManager.h:83:8: note:   no known conversion for argument 1 from ‘llvm::DataLayout*’ to ‘llvm::Pass*’

[pao: formatting]

@kmsquire
Copy link
Member

Can you please give

  1. the platform you're trying to build on
  2. the C/C++ compiler version you're using

@ihnorton
Copy link
Member

These appear to be upstream API changes - someone else reported the same thing on another thread.

@octoploid
Copy link
Contributor Author

  1. Linux x86-64
  2. gcc-4.9

First issue can be fixed with:

diff --git a/src/codegen.cpp b/src/codegen.cpp
index 034d49b5e7f3..67f9df02d73e 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -285,7 +285,7 @@ extern "C"
 void jl_dump_bitcode(char* fname)
 {
     std::string err;
-    raw_fd_ostream OS(fname, err);
+    raw_fd_ostream OS(fname, err, sys::fs::F_None);
     jl_gen_llvm_gv_array();
 #ifdef USE_MCJIT
     WriteBitcodeToFile(shadow_module, OS);

@octoploid
Copy link
Contributor Author

Second issue can be fixed by:

diff --git a/src/codegen.cpp b/src/codegen.cpp
index 034d49b5e7f3..3c51a71aca93 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -136,7 +136,7 @@ static std::map<int, std::string> argNumberStrings;
 static FunctionPassManager *FPM;

 #ifdef LLVM32
-static DataLayout *jl_data_layout;
+static DataLayoutPass *jl_data_layout;
 #else
 static TargetData *jl_data_layout;
 #endif
@@ -3951,7 +3951,7 @@ static void init_julia_llvm_env(Module *m)
     FPM = new FunctionPassManager(m);

 #ifdef LLVM32
-    jl_data_layout = new DataLayout(*jl_ExecutionEngine->getDataLayout());
+    jl_data_layout = new DataLayoutPass(*jl_ExecutionEngine->getDataLayout());
 #else 
     jl_data_layout = new TargetData(*jl_ExecutionEngine->getTargetData());
 #endif

The variable should probably be renamed, but you get the idea.

ihnorton added a commit to ihnorton/julia that referenced this issue Mar 1, 2014
@tkelman
Copy link
Contributor

tkelman commented Mar 1, 2014

@ihnorton that was me in #3134 (comment) - commit 475eb52 fixed the raw_fd_ostream errors, but I'm having trouble with the DataLayoutPass part now:

codegen.cpp:139:8: error: ‘DataLayoutPass’ does not name a type
 static DataLayoutPass *jl_data_layout; 
        ^
codegen.cpp: In function ‘void init_julia_llvm_env(llvm::Module*)’:
codegen.cpp:3960:5: error: ‘jl_data_layout’ was not declared in this scope
     jl_data_layout = new llvm::DataLayoutPass(*jl_ExecutionEngine->getDataLayout());
     ^
codegen.cpp:3960:26: error: expected type-specifier
     jl_data_layout = new llvm::DataLayoutPass(*jl_ExecutionEngine->getDataLayout());
                          ^
codegen.cpp:3960:26: error: expected ‘;’
make[2]: *** [codegen.o] Error 1
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

This is on Ubuntu-armv7l, GCC 4.8.1.

@octoploid
Copy link
Contributor Author

You need an up-to-date llvm trunk version. DataLayoutPass was introduced end of February.

@tkelman
Copy link
Contributor

tkelman commented Mar 1, 2014

@octoploid thanks, I thought it was downloaded just a few days ago but I'll do an update and try again.

@mbauman mbauman mentioned this issue Mar 22, 2014
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

4 participants