Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-01

Some questions regarding jvmbackend port

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo

I finally managed to compile the latest revision of jvmbackend port, however I've got some problems during compilation and execution:

1. The wiki instruction

The first paragraph says:

"Building the JVM compiler, RTL and utilities is currently not yet supported using the top-level makefile"

yet in "Building the compiler and RTL" section it says:

"Execute the following command in the top level directory of the checked out sources"

which in turn would execute the top-level makefile, right? The fact is that I can only compile through this top-level makefile, compiling directly from each directory (i.e. compiler, rtl, utils) doesn't work, the makefile doesn't understand jvm-java/jvm-android target.

In "Building the fpcjres utility":

Again "Run the following command in the top level directory of the checked out sources", however running "make all" doesn't build anything from utils directory, it builds ppc386 and rtl though. For this one, I must cd to utils/fpcres manually and execute the command from there (the previous "make all" is required, because it's used to compile fpc(j)res).

Using simple script, I can now install everything to the normal fpc binary/library tree.

2. Execution

I try a simple hello world program:

uses
  jdk15;
begin
  jlsystem.fout.println('hello, world');
end.

Executing ppcjvm -vt hello.pas gives:

... // unimportant lines
Assembling program
Searching file /bin/jvm-java/jasmin.jar... not found Searching file /bin/jvm-java/JASMIN.JAR... not found Searching file /usr/lib/fpc/2.7.1/jasmin.jar... not found Searching file /usr/lib/fpc/2.7.1/JASMIN.JAR... not found Searching file /usr/local/sbin/jasmin.jar... not found Searching file /usr/local/sbin/JASMIN.JAR... not found Searching file /usr/local/bin/jasmin.jar... not found Searching file /usr/local/bin/JASMIN.JAR... not found Searching file /usr/sbin/jasmin.jar... not found
Searching file /usr/sbin/JASMIN.JAR... not found
Searching file /usr/bin/jasmin.jar... found
Using assembler: /usr/bin/jasmin.jar // <-- yep, assembler found Searching file /bin/jvm-java/jvm-java-java... not found Searching file /bin/jvm-java/JVM-JAVA-JAVA... not found Searching file /usr/lib/fpc/2.7.1/jvm-java-java... not found Searching file /usr/lib/fpc/2.7.1/JVM-JAVA-JAVA... not found Searching file /usr/local/sbin/jvm-java-java... not found Searching file /usr/local/sbin/JVM-JAVA-JAVA... not found Searching file /usr/local/bin/jvm-java-java... not found Searching file /usr/local/bin/JVM-JAVA-JAVA... not found Searching file /usr/sbin/jvm-java-java... not found Searching file /usr/sbin/JVM-JAVA-JAVA... not found Searching file /usr/bin/jvm-java-java... not found Searching file /usr/bin/JVM-JAVA-JAVA... not found Searching file /sbin/jvm-java-java... not found
Searching file /sbin/JVM-JAVA-JAVA... not found
Searching file /bin/jvm-java-java... not found
Searching file /bin/JVM-JAVA-JAVA... not found
Searching file /usr/games/jvm-java-java... not found Searching file /usr/games/JVM-JAVA-JAVA... not found Error: Assembler jvm-java-java not found, switching to external assembling // <-- eh?
Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

The assembler used is supposed to be jasmin.jar, right? So what is this jvm-java-java for? If it's for executing jasmin, it should be plain java and I already have it installed and tested.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Some-questions-regarding-jvmbackend-port-tp5129886p5129886.html Sent from the Free Pascal - General mailing list .
Sven Barth
to leledumbo: I finally managed to compile the latest revision of jvmbackend port, however I've got…
leledumbo wrote 14 lines
I finally managed to compile the latest revision of jvmbackend port, however I've got some problems during compilation and execution: 1. The wiki instruction The first paragraph says: "Building the JVM compiler, RTL and utilities is currently not yet supported using the top-level makefile" yet in "Building the compiler and RTL" section it says: "Execute the following command in the top level directory of the checked out sources"

It seems that the first paragraph wasn't updated when the second one was changed. The variant with the top level makefile is the correct one.

Show quoted text 39 lines
Assembling program Searching file /bin/jvm-java/jasmin.jar... not found Searching file /bin/jvm-java/JASMIN.JAR... not found Searching file /usr/lib/fpc/2.7.1/jasmin.jar... not found Searching file /usr/lib/fpc/2.7.1/JASMIN.JAR... not found Searching file /usr/local/sbin/jasmin.jar... not found Searching file /usr/local/sbin/JASMIN.JAR... not found Searching file /usr/local/bin/jasmin.jar... not found Searching file /usr/local/bin/JASMIN.JAR... not found Searching file /usr/sbin/jasmin.jar... not found Searching file /usr/sbin/JASMIN.JAR... not found Searching file /usr/bin/jasmin.jar... found Using assembler: /usr/bin/jasmin.jar //<-- yep, assembler found Searching file /bin/jvm-java/jvm-java-java... not found Searching file /bin/jvm-java/JVM-JAVA-JAVA... not found Searching file /usr/lib/fpc/2.7.1/jvm-java-java... not found Searching file /usr/lib/fpc/2.7.1/JVM-JAVA-JAVA... not found Searching file /usr/local/sbin/jvm-java-java... not found Searching file /usr/local/sbin/JVM-JAVA-JAVA... not found Searching file /usr/local/bin/jvm-java-java... not found Searching file /usr/local/bin/JVM-JAVA-JAVA... not found Searching file /usr/sbin/jvm-java-java... not found Searching file /usr/sbin/JVM-JAVA-JAVA... not found Searching file /usr/bin/jvm-java-java... not found Searching file /usr/bin/JVM-JAVA-JAVA... not found Searching file /sbin/jvm-java-java... not found Searching file /sbin/JVM-JAVA-JAVA... not found Searching file /bin/jvm-java-java... not found Searching file /bin/JVM-JAVA-JAVA... not found Searching file /usr/games/jvm-java-java... not found Searching file /usr/games/JVM-JAVA-JAVA... not found Error: Assembler jvm-java-java not found, switching to external assembling //<-- eh? Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted The assembler used is supposed to be jasmin.jar, right? So what is this jvm-java-java for? If it's for executing jasmin, it should be plain java and I already have it installed and tested.

Pass "-XP " (without the quotes, but with the space after the parameter) to the compiler, then it will not prepend "jvm-java-" to the java binary. You might also want to check your fpc.cfg as there it might add the cpu-os-prefix unconditionally if it detects a crosscompilation (check for #IFDEF CROSSCOMPILING or similar together with "-XP...").

Regards,
Sven

leledumbo
to Sven Barth
Pass "-XP " (without the quotes, but with the space after the parameter)

to the compiler, then it will not prepend "jvm-java-" to the java binary. You might also want to check your fpc.cfg as there it might add the cpu-os-prefix unconditionally if it detects a crosscompilation (check for #IFDEF CROSSCOMPILING or similar together with "-XP...").

Just as I thought, it must be something with -XP. I forgot to add #IFNDEF CPUJVM around that option. Thanks.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Some-questions-regarding-jvmbackend-port-tp5129886p5130062.html Sent from the Free Pascal - General mailing list .
Jonas Maebe
to Sven Barth: It seems that the first paragraph wasn't updated when the second one was changed. The…
Sven Barth wrote 14 lines
On 08.01.2012 21:03, leledumbo wrote: > 1. The wiki instruction > > The first paragraph says: > > "Building the JVM compiler, RTL and utilities is currently not yet supported > using the top-level makefile" > > yet in "Building the compiler and RTL" section it says: > > "Execute the following command in the top level directory of the checked out > sources" It seems that the first paragraph wasn't updated when the second one was changed. The variant with the top level makefile is the correct one.

I've fixed the wiki article.

Jonas

leledumbo
to leledumbo: to the compiler, then it will not prepend "jvm-java-" to the java binary. You might also…

Since the title is still valid, I'd like ask about the usage of java collections in generic style. For instance java.util.ArrayList. How can I construct JUArrayList with Integer constraint as in Java?

e.g.: ArrayList<Integer> a = new ArrayList<Integer>;
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Some-questions-regarding-jvmbackend-port-tp5129886p5130153.html Sent from the Free Pascal - General mailing list .
Jonas Maebe
to leledumbo
leledumbo wrote 5 lines
Since the title is still valid, I'd like ask about the usage of java collections in generic style. For instance java.util.ArrayList. How can I construct JUArrayList with Integer constraint as in Java? e.g.: ArrayList<Integer> a = new ArrayList<Integer>;

Java-style generics are a Java-language-level feature (they work via type-erasure at the language level) that does not exist in FPC. The FPC JVM port enables compiling Pascal code into Java bytecode. It does not add Java language features to the Object Pascal language (except to the extent required for interoperability with Java bytecode).

You simply have to use them like in the Java language before JDK 1.5: by typecasting the return values (which are JLObject) into JLInteger.

Jonas