oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.43k stars 1.64k forks source link

managed LLVM undefined symbol #3104

Open schiebel opened 3 years ago

schiebel commented 3 years ago

Describe GraalVM and your environment :

bash$ make test
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
ERROR: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore11DataManager10theirMutexE
org.graalvm.polyglot.PolyglotException: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore11DataManager10theirMutexE
    at com.oracle.truffle.llvm.parser.LLVMParserRuntime.lookupGlobal(LLVMParserRuntime.java:87)
    at com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver$InternalVisitor.visit(LLVMSymbolReadResolver.java:437)
    at com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable.accept(GlobalVariable.java:52)
    at com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable.accept(GlobalVariable.java:38)
    at com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver.resolve(LLVMSymbolReadResolver.java:538)
    at com.oracle.truffle.llvm.ParserDriver.lambda$createDebugInfo$0(ParserDriver.java:357)
    at java.util.HashMap.forEach(HashMap.java:1289)
    at com.oracle.truffle.llvm.ParserDriver.createDebugInfo(ParserDriver.java:356)
    at com.oracle.truffle.llvm.ParserDriver.parseBinary(ParserDriver.java:349)
    at com.oracle.truffle.llvm.ParserDriver.parseLibraryWithSource(ParserDriver.java:384)
    at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:141)
    at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:127)
    at com.oracle.truffle.llvm.ParserDriver.parse(ParserDriver.java:98)
    at com.oracle.truffle.llvm.DefaultLoader.load(DefaultLoader.java:45)
    at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:470)
    at com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:848)
    at com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1495)
    at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:311)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.access$300(PolyglotSourceCache.java:56)
    at com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:223)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
    at com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:369)
    at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:940)
    at org.graalvm.polyglot.Context.eval(Context.java:347)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.execute(LLVMLauncher.java:249)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.launch(LLVMLauncher.java:75)
    at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:124)
    at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:71)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.main(LLVMLauncher.java:53)
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
make: *** [makefile:69: test] Error 1

Have you verified this issue still happens when using the latest snapshot? I do not have EE development snapshots available.

Describe the issue Building with managed EE LLVM does not run due to an undefined symbol. Building with graalvm-ce-java8-20.3.0 (not managed) fails with a different error. Using graalvm-ce-java8-21.1.0-dev resolves the different error.

Code snippet or code repository that reproduces the issue

The attached makefile makefile.txt can be used to checkout the test code from:

https://github.com/casacore/casacore

build the test case, and run the test.

Steps to reproduce the issue Please include both build steps as well as run steps

  1. bash$ cp makefile.txt makefile
  2. bash$ make setup
  3. bash$ make
  4. bash$ make test

Expected behavior

The makefile test target outputs the expected output:

Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0

before running the test code.

Additional context

make clean can be used to delete the intermediate code. make UNMANAGED=1 can be used to build the native version which can then be run with make UNMANAGED=1 test:

bash$ make UNMANAGED=1 test
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0

The makefile is configured for the default locations for the Java virtual machines on macOS. This likely needs to be changed for testing on linux.

munishchouhan commented 3 years ago

@schiebel thanks for reporting the issue we will check it out and let you know the outcome

munishchouhan commented 3 years ago

@schiebel when I tired the reproducer I got the following error: graalvm-ee-java8-20.3.0/Contents/Home/jre/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o Error2.o casacore/casa/Exceptions/Error2.cc casacore/casa/Exceptions/Error2.cc:226:10: error: no viable conversion from returned value of type 'int' to function return type 'casacore::String' return strerror_r(error, buffer, sizeof buffer); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/casacore/casa/BasicSL/String.h:223:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const casacore::String &' for 1st argument class String : public string { ^ include/casacore/casa/BasicSL/String.h:254:3: note: candidate constructor not viable: no known conversion from 'int' to 'const std::__1::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument String(const string& str, size_type pos=0, size_type n=npos) : ^ include/casacore/casa/BasicSL/String.h:262:3: note: candidate constructor not viable: no known conversion from 'int' to 'const casacore::Char *' (aka 'const char *') for 1st argument String(const Char* s) : string(s) {} ^ include/casacore/casa/BasicSL/String.h:277:3: note: candidate constructor not viable: no known conversion from 'int' to 'const casacore::SubString &' for 1st argument String(const SubString &str) : string(str.ref_p, str.pos_p, str.len_p) {} ^ include/casacore/casa/BasicSL/String.h:279:3: note: candidate constructor not viable: no known conversion from 'int' to 'std::__1::ostringstream &' (aka 'basic_ostringstream<char> &') for 1st argument String(ostringstream &os); ^ include/casacore/casa/BasicSL/String.h:275:12: note: explicit constructor is not a candidate explicit String(Char c) : string(1, c) {} ^ 1 error generated. make: *** [Error2.o] Error 1

schiebel commented 3 years ago

Thanks @mcraj017 for trying it. I tried a build fresh using graalvm-ee-java8-21.0.0 on macos in hopes that perhaps the problem had been resolved. Unfortunately, I see the same original error and I do not see your problem with Error2.cc. Here is the compile line when I build with this new release of graalvm:

/Library/Java/JavaVirtualMachines/graalvm-ee-java8-20.3.0/Contents/Home/jre/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o Error2.o casacore/casa/Exceptions/Error2.cc

It seems like your message might indicate some other problem on your end... When I look at the file you get an error with (Error2.o) I see:

bash$ cat -n casacore/casa/Exceptions/Error2.cc  | tail -38 | head -9
   220  #if !__linux__ || (!_GNU_SOURCE && (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600))
   221    if (strerror_r(error, buffer, sizeof buffer) == 0) {
   222      return String(buffer);
   223    }
   224    return "errno " + String::toString(error);
   225  #else
   226    auto result = strerror_r(error, buffer, sizeof buffer);
   227    return result == 0 || (size_t) result == (size_t) buffer ? String(buffer) : "errno " + String::toString(error);
   228  #endif
bash$ 

So line 226 sets result to an intermediate value, it is declared as auto so there is no implied type, and on line 227 the character array buffer is used to construct the return value. The only int involved in the return on 227 is error but here the function involved is String::toString which is a templated member function so it should be defined for int. Are you using macos or linux? (though it shouldn't make a difference)

schiebel commented 3 years ago

@mcraj017 maybe what would help is if you could attach the output of:

graalvm-ee-java8-20.3.0/Contents/Home/jre/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -E casacore/casa/Exceptions/Error2.cc

Thanks again!

munishchouhan commented 3 years ago

@schiebel I am using Mac Mojave here is the output of the above command: ouput.txt

schiebel commented 3 years ago

Thanks @mcraj017! To me, it seems like this is a bigger problem than the one I reported. The un-preprocessed code is:

   215  String SystemCallError::errorMessage(int error)
   216  {
   217    // Use strerror_r for thread-safety.
   218    char buffer[128];
   219    // There are two incompatible versions of versions of strerror_r()
   220  #if !__linux__ || (!_GNU_SOURCE && (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600))
   221    if (strerror_r(error, buffer, sizeof buffer) == 0) {
   222      return String(buffer);
   223    }
   224    return "errno " + String::toString(error);
   225  #else
   226    auto result = strerror_r(error, buffer, sizeof buffer);
   227    return result == 0 || (size_t) result == (size_t) buffer ? String(buffer) : "errno " + String::toString(error);
   228  #endif
   229  }

The preprocessed output I get for this function is:

String SystemCallError::errorMessage(int error)
{

  char buffer[128];

  auto result = strerror_r(error, buffer, sizeof buffer);
  return result == 0 || (size_t) result == (size_t) buffer ? String(buffer) : "errno " + String::toString(error);

}

But your preprocessed output for this function is:

String SystemCallError::errorMessage(int error)
{

  char buffer[128];

  return strerror_r(error, buffer, sizeof buffer);

}

It seems like some extra preprocessor optimization is going on that seems strange.

schiebel commented 3 years ago

Maybe try the most recent release of graalvm?

munishchouhan commented 3 years ago

@schiebel I tried with the GraalVM 21.0 but still not able to reproduce i tried below command too graalvm-ee-java8-21.0.0/Contents/Home/jre/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -E casacore/casa/Exceptions/Error2.cc

here is the output output_graalvm21.txt

schiebel commented 3 years ago

Thank you for testing @mcraj017

I cannot repeat the failure you experience on MacOS. I would suggest that we explore the problem on linux. I get the same error on linux and MacOS. These are the steps I use to reproduce the problem on linux:

-bash-4.1$ tar zxf graalvm-ee-java8-linux-amd64-21.0.0.tar.gz
-bash-4.1$ export JAVA_HOME=`pwd`/graalvm-ee-java8-21.0.0
-bash-4.1$ export PATH=$JAVA_HOME/bin:$PATH
-bash-4.1$ type lli
lli is /tmp/bug-report/graalvm-ee-java8-21.0.0/bin/lli
-bash-4.1$ export MANAGED_TOOLCHAIN_PATH=`lli --llvm.managed --print-toolchain-path`
-bash-4.1$ PATH=$MANAGED_TOOLCHAIN_PATH:$PATH
-bash-4.1$ type clang++
clang++ is /tmp/bug-report/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/bin/clang++
-bash-4.1$ type gu
gu is /tmp/bug-report/graalvm-ee-java8-21.0.0/bin/gu
-bash-4.1$ gu install -L llvm-toolchain-installable-java8-linux-amd64-21.0.0.jar 
Processing Component archive: llvm-toolchain-installable-java8-linux-amd64-21.0.0.jar
Installing new component: LLVM.org toolchain (org.graalvm.llvm-toolchain, version 21.0.0)
-bash-4.1$ md5sum makefile
58b17ad561b1e17c2cd45f7bf92f8b13  makefile
-bash-4.1$ make LLI=`which lli` setup
-bash-4.1$ make LLI=`which lli`
-bash-4.2$ LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` nativetest
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
-bash-4.1$ LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` test
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
ERROR: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore10TableTrace10theirMutexE
org.graalvm.polyglot.PolyglotException: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore10TableTrace10theirMutexE
    at com.oracle.truffle.llvm.parser.LLVMParserRuntime.lookupGlobal(LLVMParserRuntime.java:96)
    at com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable.createNode(GlobalVariable.java:75)
    at com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver.resolve(LLVMSymbolReadResolver.java:136)
    at com.oracle.truffle.llvm.ParserDriver.lambda$createDebugInfo$1(ParserDriver.java:371)
    at java.util.HashMap.forEach(HashMap.java:1289)
    at com.oracle.truffle.llvm.ParserDriver.createDebugInfo(ParserDriver.java:370)
    at com.oracle.truffle.llvm.ParserDriver.parseBinary(ParserDriver.java:352)
    at com.oracle.truffle.llvm.ParserDriver.parseLibraryWithSource(ParserDriver.java:398)
    at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:144)
    at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:130)
    at com.oracle.truffle.llvm.ParserDriver.parse(ParserDriver.java:101)
    at com.oracle.truffle.llvm.DefaultLoader.load(DefaultLoader.java:45)
    at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:480)
    at com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:848)
    at com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1502)
    at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:311)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.access$300(PolyglotSourceCache.java:56)
    at com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:223)
    at com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
    at com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:371)
    at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:940)
    at org.graalvm.polyglot.Context.eval(Context.java:347)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.execute(LLVMLauncher.java:249)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.launch(LLVMLauncher.java:75)
    at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:124)
    at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:71)
    at com.oracle.truffle.llvm.launcher.LLVMLauncher.main(LLVMLauncher.java:53)
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
make: *** [test] Error 1
-bash-4.1$ 

Running the nativetest target shows that the executable runs when executed as an ELF executable, but the test target shows that it fails with an undefined symbol when run with lli. The makefile used is the attached makefile.txt file.

munishchouhan commented 3 years ago

@schiebel can you please try 21.0.02 https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-21.0.0.2 i tried again and got the below error:

$ make LLI=`which lli` setup
if [ ! -d casacore ]; then git clone https://github.com/casacore/casacore.git; ( cd casacore && git checkout graalvm ); fi; if [ ! -d include ]; then mkdir include; fi; if [ ! -d include/casacore ]; then (cd include && mkdir casacore); fi; if [ ! -e include/casacore/tables ]; then (cd include/casacore && ln -s ../../casacore/tables); fi; if [ ! -e include/casacore/casa ]; then (cd include/casacore && ln -s ../../casacore/casa); fi; if [ ! -e include/casacore/measures ]; then (cd include/casacore && ln -s ../../casacore/measures); fi; if [ ! -e include/casacore/casa/config.h ]; then (echo "$CONFIG_H" >> include/casacore/casa/config.h); fi
Munishs-MacBook-Pro:casacore hv0ij4$ make LLI=`which lli`
/Users/hv0ij4/Downloads/graalvm-ee-java8-21.0.0.2/Contents/Home/jre/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o Error2.o casacore/casa/Exceptions/Error2.cc
casacore/casa/Exceptions/Error2.cc:226:10: error: no viable conversion from returned value of type 'int' to function return type
      'casacore::String'
  return strerror_r(error, buffer, sizeof buffer);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/casacore/casa/BasicSL/String.h:223:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion
      from 'int' to 'const casacore::String &' for 1st argument
class String : public string {
      ^
include/casacore/casa/BasicSL/String.h:254:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const std::__1::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument
  String(const string& str, size_type pos=0, size_type n=npos) :
  ^
include/casacore/casa/BasicSL/String.h:262:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const casacore::Char *' (aka 'const char *') for 1st argument
  String(const Char* s) : string(s) {}
  ^
include/casacore/casa/BasicSL/String.h:277:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const casacore::SubString &' for 1st argument
  String(const SubString &str) : string(str.ref_p, str.pos_p, str.len_p) {}
  ^
include/casacore/casa/BasicSL/String.h:279:3: note: candidate constructor not viable: no known conversion from 'int' to
      'std::__1::ostringstream &' (aka 'basic_ostringstream<char> &') for 1st argument
  String(ostringstream &os);
  ^
include/casacore/casa/BasicSL/String.h:275:12: note: explicit constructor is not a candidate
  explicit String(Char c) : string(1, c) {}
           ^
1 error generated.
make: *** [Error2.o] Error 1
schiebel commented 3 years ago

Thanks for the feedback. The problem is with using managed mode. Does the community edition support managed mode?

schiebel commented 3 years ago

@mcraj017 maybe it would be better if we approach this a different way. The error you encounter is immaterial to this problem so I have changed this function so that it will no longer fail to compile. Please give it another try (you will have to start from scratch since I updated the branch that the test build uses).

Unfortunately, since I don't see this problem I am unable to anticipate future compilation issues you may encounter, but we can work through them as they occur. Thanks for your help.

munishchouhan commented 3 years ago

@schiebel thanks I will try it again Managed execution mode for LLVM bitcode is possible with GraalVM Enterprise only.

munishchouhan commented 3 years ago

@schiebel at step $make i got this error:

casacore/casa/Exceptions/Error2.cc:226:10: error: no viable conversion from returned value of type 'int' to function return type 'casacore::String'
  return strerror_r(error, buffer, sizeof buffer);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/casacore/casa/BasicSL/String.h:223:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to
      'const casacore::String &' for 1st argument
class String : public string {
      ^
include/casacore/casa/BasicSL/String.h:254:3: note: candidate constructor not viable: no known conversion from 'int' to 'const std::__1::string &' (aka
      'const basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument
  String(const string& str, size_type pos=0, size_type n=npos) :
  ^
include/casacore/casa/BasicSL/String.h:262:3: note: candidate constructor not viable: no known conversion from 'int' to 'const casacore::Char *'
      (aka 'const char *') for 1st argument
  String(const Char* s) : string(s) {}
  ^
include/casacore/casa/BasicSL/String.h:277:3: note: candidate constructor not viable: no known conversion from 'int' to 'const casacore::SubString &' for
      1st argument
  String(const SubString &str) : string(str.ref_p, str.pos_p, str.len_p) {}
  ^
include/casacore/casa/BasicSL/String.h:279:3: note: candidate constructor not viable: no known conversion from 'int' to 'std::__1::ostringstream &'
      (aka 'basic_ostringstream<char> &') for 1st argument
  String(ostringstream &os);
  ^
include/casacore/casa/BasicSL/String.h:275:12: note: explicit constructor is not a candidate
  explicit String(Char c) : string(1, c) {}
           ^
1 error generated.
make: *** [Error2.o] Error 1
schiebel commented 3 years ago

@mcraj017, thank you for trying the build. I believe you did not start from scratch. This file no longer has any calls to strerror_r. Please start from scratch:

  1. bash$ export JAVA_HOME=`pwd`/graalvm-ee-java8-21.0.0
  2. bash$ export PATH=$JAVA_HOME/bin:$PATH
  3. bash$ cp makefile.txt makefile
  4. bash$ make LLI=`which lli` setup
  5. bash$ make LLI=`which lli`
  6. bash$ LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` nativetest
  7. bash$ LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` test

The description has become a bit muddied so I included the steps for both our benefit. The native test succeeds (no undefined symbols) while the managed test fails (with an undefined symbol).

munishchouhan commented 3 years ago

@schiebel below is the execution in my mac

github % cd 3104/casacore 
casacore % echo $JAVA_HOME
/Users/<UserName>/Downloads/graalvm-ee-java8-21.1.0/Contents/Home
casacore % echo $PATH
...:/Users/hv0ij4/Downloads/graalvm-ee-java8-21.1.0/Contents/Home/bin
casacore % mv /Users/hv0ij4/Downloads/makefile.txt makefile
casacore % which lli
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/bin/lli
casacore % make LLI=`which lli` setup
if [ ! -d casacore ]; then git clone https://github.com/casacore/casacore.git; ( cd casacore && git checkout graalvm ); fi; if [ ! -d include ]; then mkdir include; fi; if [ ! -d include/casacore ]; then (cd include && mkdir casacore); fi; if [ ! -e include/casacore/tables ]; then (cd include/casacore && ln -s ../../casacore/tables); fi; if [ ! -e include/casacore/casa ]; then (cd include/casacore && ln -s ../../casacore/casa); fi; if [ ! -e include/casacore/measures ]; then (cd include/casacore && ln -s ../../casacore/measures); fi; if [ ! -e include/casacore/casa/config.h ]; then (echo "$CONFIG_H" >> include/casacore/casa/config.h); fi
casacore % make LLI=`which lli`
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o tTable_1.o casacore/tables/Tables/test/tTable_1.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o ScaColDesc_tmpl.o casacore/tables/Tables/ScaColDesc_tmpl.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o BaseColumn.o casacore/tables/Tables/BaseColumn.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o PlainTable.o casacore/tables/Tables/PlainTable.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o PlainColumn.o casacore/tables/Tables/PlainColumn.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o ConcatColumn.o casacore/tables/Tables/ConcatColumn.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o BaseColDesc.o casacore/tables/Tables/BaseColDesc.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o TableError.o casacore/tables/Tables/TableError.cc
/Users/hv0ij4/Downloads/graalvm-ee-java11-21.0.0.2/Contents/Home/languages/llvm/managed/bin/clang++ -std=c++11 -Iinclude -I. -DNDEBUG -DGRAALVM -Wall -O3 -g -c -o Error2.o casacore/casa/Exceptions/Error2.cc
casacore/casa/Exceptions/Error2.cc:226:10: error: no viable conversion from returned value of type 'int' to function return type
      'casacore::String'
  return strerror_r(error, buffer, sizeof buffer);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/casacore/casa/BasicSL/String.h:223:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion
      from 'int' to 'const casacore::String &' for 1st argument
class String : public string {
      ^
include/casacore/casa/BasicSL/String.h:254:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const std::__1::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument
  String(const string& str, size_type pos=0, size_type n=npos) :
  ^
include/casacore/casa/BasicSL/String.h:262:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const casacore::Char *' (aka 'const char *') for 1st argument
  String(const Char* s) : string(s) {}
  ^
include/casacore/casa/BasicSL/String.h:277:3: note: candidate constructor not viable: no known conversion from 'int' to
      'const casacore::SubString &' for 1st argument
  String(const SubString &str) : string(str.ref_p, str.pos_p, str.len_p) {}
  ^
include/casacore/casa/BasicSL/String.h:279:3: note: candidate constructor not viable: no known conversion from 'int' to
      'std::__1::ostringstream &' (aka 'basic_ostringstream<char> &') for 1st argument
  String(ostringstream &os);
  ^
include/casacore/casa/BasicSL/String.h:275:12: note: explicit constructor is not a candidate
  explicit String(Char c) : string(1, c) {}
           ^
1 error generated.
make: *** [Error2.o] Error 1
schiebel commented 3 years ago

@mcraj017 please do the following:

github % cd 3104/casacore
casacore % git pull
casacore % cd ..

and the redo the steps.

munishchouhan commented 3 years ago

@schiebel ok sure

munishchouhan commented 3 years ago

@schiebel still same error

schiebel commented 3 years ago

Hmm, thanks for the quick testing... if you do:

github % cd 3104/casacore
casacore %  git log | head -1

Do you see this output:

commit 031d69f9c13092bb6bb14baf1fccb8c69a5d3530
munishchouhan commented 3 years ago

@schiebel no its different

% cd 3104/casacore
casacore % git log | head -1
commit 45bb7eacdc1061084187e8292fb7c38ae0285e0d
schiebel commented 3 years ago

Thanks @mcraj017. Unfortunately, it seems that it has not been updated. Please do the following and post the output:

github % cd 3104
3104 % rm -rf casacore && git clone https://github.com/casacore/casacore.git
3104 % cd casacore
casacore % git checkout graalvm
casacore % git log | head -1
casacore % cd ..

and then retry the build.

munishchouhan commented 3 years ago

@schiebel thanks for the steps, finally i got the error:

% LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` nativetest
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
/bin/sh: ../tTable_1: cannot execute binary file
make: *** [nativetest] Error 126
hv0ij4@dhcp-10-191-36-184 3104 %  LD_LIBRARY_PATH=`pwd`/graalvm-ee-java8-21.0.0/jre/languages/llvm/managed/lib make LLI=`which lli` test
---expected-output---------------------------------------------------------------
Invalid Table operation: SetupNewTable::bindColumn, object already used by Table
status: 0
---------------------------------------------------------------------------------
ERROR: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore8TaQLNode10theirMutexE
org.graalvm.polyglot.PolyglotException: java.lang.IllegalStateException: Retrieving unknown global symbol in LLVMParserRuntime: _ZN8casacore8TaQLNode10theirMutexE
        at com.oracle.truffle.llvm.parser.LLVMParserRuntime.lookupGlobal(LLVMParserRuntime.java:104)
        at com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable.createNode(GlobalVariable.java:75)
        at com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver.resolve(LLVMSymbolReadResolver.java:136)
        at com.oracle.truffle.llvm.ParserDriver.lambda$createDebugInfo$2(ParserDriver.java:413)
        at java.util.HashMap.forEach(HashMap.java:1289)
        at com.oracle.truffle.llvm.ParserDriver.createDebugInfo(ParserDriver.java:412)
        at com.oracle.truffle.llvm.ParserDriver.parseBinary(ParserDriver.java:356)
        at com.oracle.truffle.llvm.ParserDriver.parseLibraryWithSource(ParserDriver.java:434)
        at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:146)
        at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:132)
        at com.oracle.truffle.llvm.ParserDriver.parse(ParserDriver.java:103)
        at com.oracle.truffle.llvm.DefaultLoader.load(DefaultLoader.java:45)
        at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:508)
        at com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:854)
        at com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1508)
        at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:311)
        at com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
        at com.oracle.truffle.polyglot.PolyglotSourceCache.access$300(PolyglotSourceCache.java:56)
        at com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:223)
        at com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
        at com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:371)
        at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1049)
        at org.graalvm.polyglot.Context.eval(Context.java:353)
        at com.oracle.truffle.llvm.launcher.LLVMLauncher.execute(LLVMLauncher.java:249)
        at com.oracle.truffle.llvm.launcher.LLVMLauncher.launch(LLVMLauncher.java:75)
        at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:124)
        at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:71)
        at com.oracle.truffle.llvm.launcher.LLVMLauncher.main(LLVMLauncher.java:53)
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
make: *** [test] Error 1
munishchouhan commented 3 years ago

@schiebel I have raised bug with my team and we will fix this in future releases

schiebel commented 3 years ago

Thanks for your patience @mcraj017