thSoft / elysium

LilyPond IDE for Eclipse
http://elysium.thsoft.hu
14 stars 3 forks source link

No LilyPond errors displayed #175

Closed Singond closed 6 years ago

Singond commented 6 years ago

Hello, I've noticed a bug in the new version of Elysium: Building a project does not show the error messages or warnings thrown by the LilyPond compiler. They do not appear in the Problems view, nor they are marked with underlines in the editor, see the screenshot below:

elysium

I'm using the following snippet which is expected to display an octave check error:

\version "2.18.0"

\relative c' {
    c e d c,=''
}

Compiling this file from terminal using lilypond octavecheck.ly prints the following output:

GNU LilyPond 2.18.2
Processing `octavecheck.ly'
Parsing...
octavecheck.ly:4:16: warning: octave check failed; expected "c''", found: "c"
    c  e d 
               c,=''
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `octavecheck.ps'...
Converting to `./octavecheck.pdf'...
Success: compilation successfully completed

I'm running Eclipse Oxygen.2 and Elysium 0.5.3. I've tested this and got the same results on my two Linux systems (both Ubuntu 16.04) and on Windows 7 system. As far as I can remember, the bug was not present on Elysium 0.5.2 running under Windows.

Eclipse uses the same LilyPond installation as when running from terminal:

$ which lilypond
/usr/bin/lilypond

$ lilypond --version
GNU LilyPond 2.18.2

Copyright (c) 1996--2012 by
  Han-Wen Nienhuys <hanwen@xs4all.nl>
  Jan Nieuwenhuizen <janneke@gnu.org>
  and others.

This program is free software.  It is covered by the GNU General Public
License and you are welcome to change it and/or distribute copies of it
under certain conditions.  Invoke as `lilypond --warranty' for more
information.

I'm attaching screenshots of my settings in case I missed something there.

elysium-compiler elysium-validation

Can anybody confirm this issue?

nittka commented 6 years ago

Thanks for the detailed report! I notice that the LilyPond compiler output contains only a warning and no error. I think warnings have never been passed on. So the result should be the same in the previous version of Elysium.

Could you please check whether LilyPond compilation "errors" are really not shown (as you write that warnings and errors thrown by the compiler are not shown)?

For your information: The validation preferences deal only with issues raised by Elysium's own validation. As automatic compilation may be turned off, we do some validation in particular with respect to linking. Errors raised by LilyPond cannot be configured here. Note also, that Elysium's linking is currently being rewritten, so (non-)errors concerning (un-)found includes or assignments can definitely occur in Elysium 0.5.3.

nittka commented 6 years ago

Sorry, I revise my previous remark about the warnings. They should be shown and in fact with the given example, I see the warning on my Windows machine (both in the current snapshot version and Elysium 0.5.3 in a Mars installation). So there is definitely some investigating to be done.

Could you please let me know, what the LilyPond console output in Eclipse looks like (and maybe the language settings from the Eclipse configuration). Elysium invokes the compiler with the locale of the running JVM and then parses the console output. My guess ist that the error/warning marker words for recognizing errors and warnings do not produce a match (unsupported language? see https://github.com/thSoft/elysium/blob/master/org.elysium.parent/org.elysium.ui/src/org/elysium/ui/compiler/problems/ProblemParser.java).

@thSoft: Maybe this is a further reason to write the command used for invoking LilyPond to the console, it would make checking the parameters much easier.

Singond commented 6 years ago

The console output in Elysium (on Ubuntu 16.04) is rather brief:

Log level set to 287
LilyPond terminated in 0.841 seconds.

My system language is set to English, my Eclipse is in English and there is no user.language key in the eclipse.ini file used to launch the application. Is there any other language setting I may have missed?

$ echo $LANG
en_US.UTF-8
nittka commented 6 years ago

OK. This explains the missing warnings - there is no console output to be parsed. Could you please confirm, that invoking compilation via Elysium actually produces the output (delete pdf, compile, check if it is present) - maybe also setting output to verbose checking whether more output is produced? This would hint that while the compilation actually happens, the output does not make it to Elysium's console. A possible explanation is that we parse only the error stream. If for some reason the LilyPond compile output goes only to the regular stream, it would not be processed at all.

By the way, on my Linux machine, I get the "Log level set" output only when enabling verbose output, and while the console output actually contains errors and warnings, they do not seem to be parsed correctly (not shown in editor), see #178.

Singond commented 6 years ago

As I have just noticed, I already have checked the verbose output option in preferences.

I deleted the PDF file and recompiled the source code to no success. The PDF is produced, but there are still no problems reported and the console output is missing. I tried this with both manual and automatic build.

Singond commented 6 years ago

I have just tried creating my custom lilypond command which redirects all stdout to stderr:

mylilypond

#!/bin/sh
lilypond "$@" 1>&2

I have set this as the Path to LilyPond executable in Eclipse preferences, but there is no difference: There is still no console output shown.

nittka commented 6 years ago

I have two more hypotheses for the missing console output:

Could you check in the Eclipse logs whether you find an exception thrown or caught in CancellableProcessUtils (try also running Eclipse from the command line directly - my hope would be that a potential Exception appears in the terminal)? Could you also confirm, whether deactivating verbose output yields the same result? Did you run the compile on a completely fresh project+file? (Just desparate... old file markers should not cause any problems but who knows)

Without being able to "really" reproduce the problem, it is hard to check whether the changes I make have any positive effect. How adventurous do you feel about setting up an Elysium development workspace and helping to debug (we have an Oomph setup file that should simplify the setting up)?

Singond commented 6 years ago

Thanks for the tip with running Eclipse from the terminal. I launched Eclipse, deleted the PDF file, changed the first note in the source and recompiled. There is indeed an exception thrown when compiling. This is the output shown in the terminal:

~$ /opt/eclipse/oxygen-2/eclipse 
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized.  Will retry after the state location is initialized.
org.eclipse.m2e.logback.configuration: Logback config file: <path to XML file>
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://999.fwk556773329:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://999.fwk556773329:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
org.eclipse.m2e.logback.configuration: Initializing logback
log4j:WARN No appenders could be found for logger (org.eclipse.xtext.ui.internal.Activator).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "compile octavecheck.ly" java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    at org.elysium.ui.compiler.problems.ProblemParser.<clinit>(ProblemParser.java:52)
    at org.elysium.ui.compiler.CompilerOutputProcessor.processOutput(CompilerOutputProcessor.java:37)
    at org.elysium.ui.compiler.CancellableProcessUtils$2.run(CancellableProcessUtils.java:53)
    at java.lang.Thread.run(Thread.java:748)
nittka commented 6 years ago

This explains the behaviour. In the last Elysium release one major change was raising the Xtext version to 2.10. I would bet, you have a later version installed. The required/allowed Guava versions of Xtext 2.10 and Xtext 2.13 differ - and Objects.firstNonNull was moved to MoreObjects.forstNonNull. Hence the exception. Do you depend on the latest Xtext version or could you downgrade to Xtext 2.10 for your Elysium-Eclipse?

Thanks once more for reporting the issue and helping to track down the cause.

nittka commented 6 years ago

You can eliminate you mylilypond command. I don't think there will be problems with the pull request dealing with this issue. Guava API will be made compatible, error stream and regular one will be merged (so manually redirecting any stream will be unnecessary) and exception handling will be improved (showing potential problems not only in the terminal, but in the eclipse error log.

Singond commented 6 years ago

Indeed, my installation details show that I'm using version 2.12.0 of the Xtext plugin. Once I figure out how to downgrade the Xtext plugin, I'll try and post the results.

Anyway, thanks for all the help!

Singond commented 6 years ago

Hooray! Installing older version of Xtext was not easy (after removing Elysium, I installed Xtext Redistributable 2.10, reinstalled Elysium, which was now not working, so I removed Xtext Redistributable, which left me miraculously with Xtext plugin still installed, but made Elysium work again), but I am happy to say that the warnings are now shown.

Thanks again for your assistance.