lcm-proj/lcm

Build fails on Ubuntu 18.04 with default-jdk

shayosler opened this issue · 5 comments

The current build instructions (as of 7606629) recommend default-jdk or openjdk-9-jdk. openjdk-9-jdk is not available on Ubuntu 18.04, and with the default-jdk package the build fails with

[ 76%] Building CXX object test/c/CMakeFiles/test-c-client.dir/client.cpp.o
[ 77%] Building CXX object test/c/CMakeFiles/test-c-udpm_test.dir/udpm_test.cpp.o
org/hamcrest/core/AllOf.java:60: error: no suitable method found for allOf(List<Matcher<? super T#1>>)
        return allOf(Arrays.asList(matchers));
               ^
    method AllOf.<T#2>allOf(Iterable<Matcher<? super T#2>>) is not applicable
      (inference variable T#3 has incompatible bounds
        equality constraints: Matcher<? super CAP#1>
        lower bounds: Matcher<? super T#1>)
    method AllOf.<T#1>allOf(Matcher<? super T#1>...) is not applicable
      (no instance(s) of type variable(s) T#3 exist so that List<T#3> conforms to Matcher<? super T#1>)
    method AllOf.<T#4>allOf(Matcher<? super T#4>,Matcher<? super T#4>) is not applicable
      (cannot infer type-variable(s) T#4
        (actual and formal argument lists differ in length))
    method AllOf.<T#5>allOf(Matcher<? super T#5>,Matcher<? super T#5>,Matcher<? super T#5>) is not applicable
      (cannot infer type-variable(s) T#5
        (actual and formal argument lists differ in length))
    method AllOf.<T#6>allOf(Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>) is not applicable
      (cannot infer type-variable(s) T#6
        (actual and formal argument lists differ in length))
    method AllOf.<T#7>allOf(Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>) is not applicable
      (cannot infer type-variable(s) T#7
        (actual and formal argument lists differ in length))
    method AllOf.<T#8>allOf(Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>) is not applicable
      (cannot infer type-variable(s) T#8
        (actual and formal argument lists differ in length))
  where T#1,T#2,T#3,T#4,T#5,T#6,T#7,T#8 are type-variables:
    T#1 extends Object declared in method <T#1>allOf(Matcher<? super T#1>...)
    T#2 extends Object declared in method <T#2>allOf(Iterable<Matcher<? super T#2>>)
    T#3 extends Object declared in method <T#3>asList(T#3...)
    T#4 extends Object declared in method <T#4>allOf(Matcher<? super T#4>,Matcher<? super T#4>)
    T#5 extends Object declared in method <T#5>allOf(Matcher<? super T#5>,Matcher<? super T#5>,Matcher<? super T#5>)
    T#6 extends Object declared in method <T#6>allOf(Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>)
    T#7 extends Object declared in method <T#7>allOf(Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>)
    T#8 extends Object declared in method <T#8>allOf(Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>)
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object super: T#1 from capture of ? super T#1
org/hamcrest/core/AnyOf.java:50: error: no suitable method found for anyOf(List<Matcher<? super T#1>>)
        return anyOf(Arrays.asList(matchers));
               ^
    method AnyOf.<T#2>anyOf(Iterable<Matcher<? super T#2>>) is not applicable
      (inference variable T#3 has incompatible bounds
        equality constraints: Matcher<? super CAP#1>
        lower bounds: Matcher<? super T#1>)
    method AnyOf.<T#1>anyOf(Matcher<? super T#1>...) is not applicable
      (no instance(s) of type variable(s) T#3 exist so that List<T#3> conforms to Matcher<? super T#1>)
    method AnyOf.<T#4>anyOf(Matcher<T#4>,Matcher<? super T#4>) is not applicable
      (cannot infer type-variable(s) T#4
        (actual and formal argument lists differ in length))
    method AnyOf.<T#5>anyOf(Matcher<T#5>,Matcher<? super T#5>,Matcher<? super T#5>) is not applicable
      (cannot infer type-variable(s) T#5
        (actual and formal argument lists differ in length))
    method AnyOf.<T#6>anyOf(Matcher<T#6>,Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>) is not applicable
      (cannot infer type-variable(s) T#6
        (actual and formal argument lists differ in length))
    method AnyOf.<T#7>anyOf(Matcher<T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>) is not applicable
      (cannot infer type-variable(s) T#7
        (actual and formal argument lists differ in length))
    method AnyOf.<T#8>anyOf(Matcher<T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>) is not applicable
      (cannot infer type-variable(s) T#8
        (actual and formal argument lists differ in length))
  where T#1,T#2,T#3,T#4,T#5,T#6,T#7,T#8 are type-variables:
    T#1 extends Object declared in method <T#1>anyOf(Matcher<? super T#1>...)
    T#2 extends Object declared in method <T#2>anyOf(Iterable<Matcher<? super T#2>>)
    T#3 extends Object declared in method <T#3>asList(T#3...)
    T#4 extends Object declared in method <T#4>anyOf(Matcher<T#4>,Matcher<? super T#4>)
    T#5 extends Object declared in method <T#5>anyOf(Matcher<T#5>,Matcher<? super T#5>,Matcher<? super T#5>)
    T#6 extends Object declared in method <T#6>anyOf(Matcher<T#6>,Matcher<? super T#6>,Matcher<? super T#6>,Matcher<? super T#6>)
    T#7 extends Object declared in method <T#7>anyOf(Matcher<T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>,Matcher<? super T#7>)
    T#8 extends Object declared in method <T#8>anyOf(Matcher<T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>,Matcher<? super T#8>)
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object super: T#1 from capture of ? super T#1
org/hamcrest/CoreMatchers.java:234: warning: [dep-ann] deprecated item is not annotated with @Deprecated
  public static <T> org.hamcrest.Matcher<T> is(java.lang.Class<T> type) {
                                            ^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
1 warning
test/java/hamcrest-core-1.3/CMakeFiles/hamcrest-core.dir/build.make:106: recipe for target 'test/java/hamcrest-core-1.3/CMakeFiles/hamcrest-core.dir/java_compiled_hamcrest-core' failed
make[2]: *** [test/java/hamcrest-core-1.3/CMakeFiles/hamcrest-core.dir/java_compiled_hamcrest-core] Error 1
CMakeFiles/Makefile2:1986: recipe for target 'test/java/hamcrest-core-1.3/CMakeFiles/hamcrest-core.dir/all' failed
make[1]: *** [test/java/hamcrest-core-1.3/CMakeFiles/hamcrest-core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

The build completes succesfully with openjdk-8-jdk

I had a similar problem, where the build was successful, but running any of the lcm tools with a GUI component (e.g. lcm-spy or lcm-logplayer-gui) resulted in the following error:

$ lcm-spy
Unrecognized option: -Xincgc
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit. 

This is caused by an incompatibility with jdk-11 (obtained via sudo apt install default-jdk, from the build instructions); replacing all jdk-11 components with jdk-8 appears to fix it.

i am installing on mac, the same problem even I used jdk8. Any ideas to solve this? Or can I skip install this part?

Similar problem. I can compile with java-8-openjdk-amd64 but not with java-11-openjdk-amd64. For those who need a quick fix I ran sudo update-alternatives --config javac and chose a different version.

This problem can be solved by removing the -Xincgc option from the lcm-spy and lcm-logplayer-gui run scripts (after build). I'm using jdk11 on Ubuntu 18.04.

Corresponding command-line options produce warning messages and it is recommended to avoid using them. These options will be removed in one of the next major releases.

  • The -Xincgc option is deprecated

REF: https://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

Attempt to fix upstream

xref PR #300

rgov commented

The Ubuntu 18.04 package name for the Java 8 JDK is openjdk-8-jdk. I used sudo apt-get remove --purge 'openjdk-*' to remove any other version I had installed. It is important to start over with a clean build directory if you change the JDK so that old .class files don't get used.