LoopPerfect / buckaroo

The decentralized package manager for C++ and friends 🏝️
https://buckaroo.pm
MIT License
936 stars 33 forks source link

build failure #109

Closed toulouse closed 7 years ago

toulouse commented 7 years ago

On a mac with the latest buck, buckaroo fails to build. I avoid using brew, so this is a problem for me. Tested on javac 1.8.0_31 and 1.8.0_144.

BUILD FAILED: //:buckaroo failed with exit code 1:
javac
stderr: /Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/Either.java:38: error: incompatible types: inferred type does not conform to upper bound(s)
        return join(Optional::of, x -> Optional.empty());
                   ^
    inferred: java.util.Optional<? extends java.lang.Object>
    upper bound(s): java.util.Optional<L>,java.lang.Object
/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/Either.java:42: error: incompatible types: inferred type does not conform to upper bound(s)
        return join(x -> Optional.empty(), Optional::of);
                   ^
    inferred: java.util.Optional<? extends java.lang.Object>
    upper bound(s): java.util.Optional<R>,java.lang.Object
/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/MoreObservables.java:-1: note: Some input files use unchecked or unsafe operations.

/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/MoreObservables.java:-1: note: Recompile with -Xlint:unchecked for details.

Errors: 2. Warnings: 0.
njlr commented 7 years ago

Hi @toulouse

I think your issue might be the same as https://github.com/LoopPerfect/buckaroo/issues/68.

Basically, certain versions of Java have a bug in their type-inference system. If you upgrade Java the issue should go away.

When building from source, I would recommend checking out a release branch to ensure that you are building a supported version of the code:

git checkout release/1.2.1

This mimics the brew script.

toulouse commented 7 years ago

https://en.wikipedia.org/wiki/Java_version_history#cite_ref-270 1.8.0_144 was released last Wednesday.

toulouse at muspell | ~/c/T/buckaroo on ±master
% git checkout release/1.2.1       
Branch release/1.2.1 set up to track remote branch release/1.2.1 from origin.
Switched to a new branch 'release/1.2.1'
toulouse at muspell | ~/c/T/buckaroo on ±release/1.2.1
% buck build :buckaroo-cli   
BUILD FAILED: //:buckaroo failed with exit code 1:
javac
stderr: /Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/Either.java:38: error: incompatible types: inferred type does not conform to upper bound(s)
        return join(Optional::of, x -> Optional.empty());
                   ^
    inferred: java.util.Optional<? extends java.lang.Object>
    upper bound(s): java.util.Optional<L>,java.lang.Object
/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/Either.java:42: error: incompatible types: inferred type does not conform to upper bound(s)
        return join(x -> Optional.empty(), Optional::of);
                   ^
    inferred: java.util.Optional<? extends java.lang.Object>
    upper bound(s): java.util.Optional<R>,java.lang.Object
/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/MoreObservables.java:-1: note: Some input files use unchecked or unsafe operations.

/Users/toulouse/code/Tools/buckaroo/src/main/java/com/loopperfect/buckaroo/MoreObservables.java:-1: note: Recompile with -Xlint:unchecked for details.

Errors: 2. Warnings: 0.

[-] PROCESSING BUCK FILES...FINISHED 0.0s [100%] 🐳  New buck daemon
[-] DOWNLOADING... (0.00 B/S AVG, TOTAL: 0.00 B, 0 Artifacts)
[-] BUILDING...FINISHED 3.5s [100%] (31/31 JOBS, 1 UPDATED, 1 [3.2%] CACHE MISS)
toulouse at muspell | ~/c/T/buckaroo on ±release/1.2.1
% javac -version
javac 1.8.0_144
toulouse at muspell | ~/c/T/buckaroo on ±release/1.2.1
% 
njlr commented 7 years ago

Ah, my mistake.

I'm using java version "1.8.0_92", so I will upgrade to try to reproduce your issue.

toulouse commented 7 years ago

On my end, I'm still seeing if having an older and a newer version installed is a problem; maybe buck is using the older one despite the newer one being around.

njlr commented 7 years ago

You can control the exact javac inside Buck config. Try this:

Create a file .buckconfig.local in the root of the Buckaroo project.

[tools]
  javac = /usr/bin/javac

Then you can tweak the path as required.

toulouse commented 7 years ago

I decided to just hit it with a big hammer and move the older java out from /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk. Lo and behold, killing the older java worked. Seems the older one was being used for some reason.

Thanks!