public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marko Dimjašević" <marko@dimjasevic.net>
To: java-patches@gcc.gnu.org
Subject: Compiling Scala-generated bytecode
Date: Mon, 20 Oct 2014 06:19:00 -0000	[thread overview]
Message-ID: <1413785951.4798.12.camel@neelix> (raw)

[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]

Hi all,

I've been trying to compile Scala-generated bytecode to native machine
code, but without luck so far.

Here's the program I want to compile:

object HelloWorld {
	def main(args: Array[String]) {
	  println("Hello, Scala World!")
	}
}

I can easily compile it to bytecode:

$ scalac HelloWorld.scala

This generates two files: HelloWorld.class and HelloWorld$.class.

Then I'd like to compile these class files to the machine code. Here is
my attempt:

$ gcj --classpath=/usr/share/java/scala-library-2.9.2.jar:. *.class
--main=HelloWorld 
/tmp/ccFGxiOv.o: In function `void HelloWorld
$::main(JArray<java::lang::String*>*)':
HelloWorld$.class:(.text+0x39): undefined reference to `scala::Predef
$::class$'
HelloWorld$.class:(.text+0x4a): undefined reference to `scala::Predef
$::MODULE$'
HelloWorld$.class:(.text+0x73): undefined reference to `void
scala::Predef$::println(java::lang::Object*)'
/tmp/ccFGxiOv.o:(.data+0xf8): undefined reference to
`scala::ScalaObject::class$'
collect2: error: ld returned 1 exit status


All of these undefined reference classes are in scala-library-2.9.2.jar.
What am I missing?

Here are details on GCJ that I have:

$ gcj -v
Using built-in specs.
Reading specs from /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
COLLECT_GCC=gcj
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-3'
--with-bugurl=file:///usr/share/doc/gcj-4.7/README.Bugs
--enable-languages=c,c++,java --prefix=/usr --program-suffix=-4.7
--enable-shared --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-time=yes --enable-gnu-unique-object
--disable-libmudflap --enable-plugin --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.7/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.7
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.7
--with-arch-directory=amd64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-3)


-- 
Kind regards,
Marko Dimjašević
http://dimjasevic.net/marko


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2014-10-20  6:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20  6:19 Marko Dimjašević [this message]
2014-10-20  8:04 ` Andrew Haley
2014-10-20 13:50   ` Marko Dimjašević
2014-10-20 21:46     ` Andrew Hughes
2014-10-20 21:51       ` Marko Dimjašević

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413785951.4798.12.camel@neelix \
    --to=marko@dimjasevic.net \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).