Error during compiling

446 views
Skip to first unread message

Giovanni Mori

unread,
Aug 2, 2013, 12:00:19 PM8/2/13
to sche...@googlegroups.com
I followed the manual's instructions (installation_en.pdf), but i get an error when trying to compile. Could someone help me understand what's happening ?
Thanks,
Giovanni

[schedulix@tst-sw-eng src]$ cd schedulix/src
[schedulix@tst-sw-eng src]$ make
cd /home/schedulix/schedulix/src; \
        mkdir -p de/independit/scheduler; \
        for fff in *; do \
                if [ "${fff}" != "de" -a ! -e de/independit/scheduler/${fff} ]; then \
                        ln -s /home/schedulix/schedulix/src/${fff} de/independit/scheduler/${fff}; \
                fi; \
        done
make[1]: Entering directory `/home/schedulix/schedulix/src/server'
make[2]: Entering directory `/home/schedulix/schedulix/src/server/parser'
/home/schedulix/schedulix/tools/bin/jflex -d /tmp Scanner.jlex
Reading "Scanner.jlex"
Constructing NFA : 2,790 states in NFA
Converting NFA to DFA :
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
1220 states before minimization, 1176 states in minimized DFA
Writing code to "/tmp/Scanner.java"

Error: Scanner can't have int and reference return type at the same time.
1 error, 0 warnings.
make[2]: *** [Scanner.java] Error 1
make[2]: Leaving directory `/home/schedulix/schedulix/src/server/parser'
make[1]: *** [commonsubdirs] Error 2
make[1]: Leaving directory `/home/schedulix/schedulix/src/server'
make: *** [commonsubdirs] Error 2

Ronald Jeninga

unread,
Aug 2, 2013, 1:50:53 PM8/2/13
to sche...@googlegroups.com
Hi Giovanni,

which version of jflex are you using?

jflex tells me:

[ronald@puma bin]$ ./jflex --version
This is JFlex 1.4.1

The version shouldn't be too critical, but a newer jflex or _very_ old versions could react strange.

What happens if you issue the command by hand?
cd $SDMSHOME/src/server/parser
$SDMSHOME/tools/bin/jflex -d /tmp Scanner.jlex

Can you send me the resulting Scanner.java? (ron...@independit.de)

Since I didn't see this error message before today, I'm curious to find out what it is.

Regards,

Ronald

Ronald Jeninga

unread,
Aug 2, 2013, 3:40:56 PM8/2/13
to sche...@googlegroups.com
Hi Giovanni,

I just downloaded JFlex 1.4.3 and tried to compile. I now get the same error message as you did.

This means: If you want to compile the software today, you'll have to install jflex 1.4.1
If you have time, you can wait until I found out how to fix it. That won't take too long I guess, unless it is caused by a bug in jflex (which I do not assume).

Best regards,

Ronald


Ronald Jeninga

unread,
Aug 2, 2013, 4:44:52 PM8/2/13
to sche...@googlegroups.com
There were two directives in the scanner code, both meaning the same. (%type int   and %integer)
Older versions of jlex didn't bother; jlex 1.4.3 gets confused.

Anyway, I removed one of the directives and it seems to work now.

Regards,

Ronald

Giovanni Mori

unread,
Aug 6, 2013, 4:30:28 AM8/6/13
to sche...@googlegroups.com
Hi Ronald,
thank you for your intervention; I downloaded the new version and the previous error disappeared.
But now I have another one:
...
g++ -O3 -fno-exceptions -Wall -Wshadow -Wpointer-arith -Wwrite-strings -Wconversion -Woverloaded-virtual -I/include -I/include/linux -DLINUX -fPIC   -c -o jobserver.o jobserver.cc
In file included from libjobserver.h:31,
                 from jobserver.cc:30:
de_independit_scheduler_jobserver_Utils.h:2:17: error: jni.h: No such file or directory
...
I see, in the file   src/jobserver/de_independit_scheduler_jobserver_Utils.h   , this directive:   #include <jni.h>
I think this causes the error, as I cannot find a file   jni.h

Can you help me ?
Thanks,
Giovanni

Ronald Jeninga

unread,
Aug 6, 2013, 4:56:40 AM8/6/13
to sche...@googlegroups.com
Hi Giovanni,

the make process needs to know where your java installation resides. That's why you have to set the JAVAHOME environment variable.
On my computer, bare CenOS6.4 using OpenJDK 1.6, it is set to

export JAVAHOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64

This can of course be different for your environment.
If you look in $SDMSHOME/src/jobserver/Makefile you'll see the "magic" in line 28 and line 79

Hope this helps.

Cordiali saluti (I guess;),

Ronald

Giovanni Mori

unread,
Aug 6, 2013, 5:14:47 AM8/6/13
to sche...@googlegroups.com
Opps, I defined a JAVA_HOME variable, not JAVAHOME.

Now "make" has done his job, it maked the BICsuite.jar file !!!


Thanks again for your support.
Mit freundlichen Grüßen (it's my turn to guess...  ;) ,
Giovanni

Nariman Abdullayev

unread,
Jul 10, 2014, 1:55:22 AM7/10/14
to sche...@googlegroups.com
I have the following error during the compilation

javac -cp /root/schedulix/schedulix-master/src:/usr/lib64/java/swt.jar:/root/schedulix/jna-4.1.0.jar -O MiniParse.java
MiniParse.java:295: error: constructor MiniParse in class MiniParse cannot be applied to given types;
        MiniParse s = new MiniParse(System.in);
                      ^
  required: Reader
  found: InputStream
  reason: actual argument InputStream cannot be converted to Reader by method invocation conversion

1 error
make[1]: *** [MiniParse.class] Error 1
make[1]: Leaving directory `/root/schedulix/schedulix-master/src/tools'

Ronald Jeninga

unread,
Jul 10, 2014, 4:03:55 AM7/10/14
to sche...@googlegroups.com
Hi Nariman,

can you give me some more information?
Which Java do you use? Which jflex do you use?

Since line 295 of MiniParse.java here is a comment, I assume that we use different versions of jflex. (I use 1.4.1 here at the moment)
Can you post line 290-300 of the Java file?

Regards,

Ronald

Nariman Abdullayev

unread,
Jul 10, 2014, 4:19:08 AM7/10/14
to sche...@googlegroups.com
Hi Roland,

I use jflex right from  http://jflex.de/download.html - version 1.6.0

MiniParse.java lines 300 - 305

public static void main(String argv[])
{
    int i;

    try {

        MiniParse s = new MiniParse(System.in);
        while(s.advance()) {
            if(s.token() == STATEMENT) {
                System.err.println("\"" + s.value().toString() + "\"");
                s.initValue();
            }
        }
    } catch(IOException ioe) {
        // continue;
    }

do you thing I need older version of JFlex?

Nariman Abdullayev

unread,
Jul 10, 2014, 4:20:36 AM7/10/14
to sche...@googlegroups.com
and

java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

host Lnux - 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

Ronald Jeninga

unread,
Jul 10, 2014, 4:32:39 AM7/10/14
to sche...@googlegroups.com
Hi Nariman,

not so hasty, I'm going to try the 1.6.0 jflex myself first.

The Java version shouldn't be a problem. I use a 1.7.0_55 Java. But the main difference should be bugfixes. I don't expect substantial architectural changes between 1.7.0_09 and 1.7.0_55.

I'll be back as soon as I have any results.

Regards,

Ronald

Ronald Jeninga

unread,
Jul 10, 2014, 5:21:55 AM7/10/14
to sche...@googlegroups.com
Hi Nariman,

Got some results now.

1. If I use jflex 1.6.0 I get the same compile error (which proves that jflex 1.6.0 is the villain ;)
2. Something "nice":

[ronald@cheetah tools]$ /home/ronald/schedulix/tools/bin/jflex --version
This is JFlex 1.6.0
[ronald@cheetah tools]$ /home/ronald/schedulix/tools/bin/jflex --help

Usage: jflex <options> <input-files>

Where <options> can be one or more of
-d <directory>    write generated file to <directory>
--skel <file>     use external skeleton <file>
--pack            set default code generation method (default)
--jlex            strict JLex compatibility
--legacydot       dot (.) metachar matches [^\n] instead of
                 
[^\n\r\u000B\u000C\u0085\u2028\u2029]
--inputstreamctor    include a scanner constructor taking InputStream (default)
--noinputstreamctor  don't include a scanner constructor taking InputStream
--nomin           skip minimization step
--nobak           don'
t create backup files
--dump            display transition tables
--dot             write graphviz .dot files for the generated automata (alpha)
--verbose
-v                display generation progress messages (default)
--quiet
-q                display errors only
--time            display generation time statistics
--version         print the version number of this copy of jflex
--info            print system + JDK information
--uniprops <ver>  print all supported properties for Unicode version <ver>
--help
-h                print this message

This is JFlex 1.6.0
Have a nice day!
[ronald@cheetah tools]$ /home/ronald/schedulix/tools/bin/jflex --inputstreamctor MiniParse.jlex
Reading "MiniParse.jlex"
Constructing NFA : 47 states in NFA
Converting NFA to DFA :
................
22 states before minimization, 15 states in minimized DFA
Old file "MiniParse.java" saved as "MiniParse.java~"
Writing code to "MiniParse.java"

Warning: Emitting deprecated InputStream constructor. The inputstreamctor option will cause this constructor to be emitted in JFlex 1.6; the version after 1.6 will never emit this constructor.


Note that they write that specifying the --inputstreamctor  flag yields the default behaviour. But then a warning is issued and an extra constructor is generated in the java code.
We need this constructor.

3. You need some changes to the Makefiles to get the software compiled with jflex 1.6.0.
I assume they didn't optimize out the scanning functionality as well. Still some strange behaviour can happen. It would be a help to us if you can try it.
Please drop me a note if the system is up and running and seems to function well.

Anyway the changes you need are:

[ronald@cheetah src]$ git diff
diff
--git a/src/Makefile.CommonRules b/src/Makefile.CommonRules
index
207d1fd..202bd48 100644
--- a/src/Makefile.CommonRules
+++ b/src/Makefile.CommonRules
@@ -72,7 +72,7 @@ commongensubdirs:
        egrep
-e "^//yy" < $@ | sed 's!//yy!!' > parser.tables
 
 
%.java: %.jlex
-       $(JLEX) -d /tmp $<
+       $(JLEX) --inputstreamctor -d /tmp $<
        $
(SED) -e 's/zzCMapL\[zzInput\]/(((zzInput >= 0) \&\& (zzInput < zzCMapL.length)) ? zzCMapL\[zzInput\] : 0)/' /tmp/$@ >$@
        rm
-f /tmp/$@
 
diff
--git a/src/shell/Makefile b/src/shell/Makefile
index a2472f9
..058b2dd 100644
--- a/src/shell/Makefile
+++ b/src/shell/Makefile
@@ -44,7 +44,7 @@ syntax:
        $
(JAY) MiniParser.jay < /dev/null
 
 
MiniScanner.java:       MiniScanner.jlex MiniParser.java
-       $(JLEX) -d /tmp -skel skeleton.nested MiniScanner.jlex
+       $(JLEX) --inputstreamctor -d /tmp -skel skeleton.nested MiniScanner.jlex
        $
(SED) -e 's/zzCMapL\[zzInput\]/(((zzInput >= 0) \&\& (zzInput < zzCMapL.length)) ? zzCMapL\[zzInput\] : 0)/' /tmp/$@ >$@
        rm
-f /tmp/$@
 
diff
--git a/src/tools/Makefile b/src/tools/Makefile
index
4525ef7..384afec 100644
--- a/src/tools/Makefile
+++ b/src/tools/Makefile
@@ -45,5 +45,5 @@ Scanner.java: Scanner.jlex
        $
(JLEX) Scanner.jlex
 
 
MiniParse.java: MiniParse.jlex
-       $(JLEX) MiniParse.jlex
+       $(JLEX) --inputstreamctor MiniParse.jlex


I hope this helps.

Regards,

Ronald





Nariman Abdullayev

unread,
Jul 10, 2014, 7:39:13 AM7/10/14
to sche...@googlegroups.com
Thank you for the quick reply. I did as you advised but the result was the same. I decided to update java files.

I updated: sdmsh.java and MiniParse.java

actually I changed:

MiniParse s = new MiniParse(System.in);
to
MiniParse s = new MiniParse(new InputStreamReader(System.in));

and get successful compilation... now I am on the next step - how to make it all up and running... 

Ronald Jeninga

unread,
Jul 10, 2014, 8:03:22 AM7/10/14
to sche...@googlegroups.com
you're welcome :-)

changing MiniParse.java is permitted of course, but since it is generated code (from MiniParse.jlex), I think the better idea is to change the jlex file.
There's no problem with the change to sdmsh.java.

I just checked the availability of the jflex flag in jflex 1.4.1. It is missing :-(
It'll be the best idea to change the java/jlex files indeed, making the build process independent of the jflex version.

If you encounter any problems with the installation, don't hesitate to ask.

Regards,

Ronald

Ronald Jeninga

unread,
Jul 10, 2014, 11:14:41 AM7/10/14
to sche...@googlegroups.com
Hi Nariman,

Just for the record. I accepted the idea of using the other constructor for the scanners, changed the sources and pushed them to github.

Thanks,

Ronald
Reply all
Reply to author
Forward
0 new messages