public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiling Scala-generated bytecode
@ 2014-10-20  6:19 Marko Dimjašević
  2014-10-20  8:04 ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: Marko Dimjašević @ 2014-10-20  6:19 UTC (permalink / raw)
  To: java-patches

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-20 21:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20  6:19 Compiling Scala-generated bytecode Marko Dimjašević
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ć

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).