From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29788 invoked by alias); 20 Oct 2014 06:19:19 -0000 Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org Received: (qmail 29776 invoked by uid 89); 20 Oct 2014 06:19:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_NEUTRAL,TVD_RCVD_IP autolearn=no version=3.3.2 X-HELO: mail.dimjasevic.net Received: from 19.246.102.46.static.intovps.com (HELO mail.dimjasevic.net) (46.102.246.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Oct 2014 06:19:17 +0000 Received: from [10.0.0.31] (c-24-6-217-84.hsd1.ca.comcast.net [24.6.217.84]) by mail.dimjasevic.net (Postfix) with ESMTPSA id 1B79F13416BA for ; Mon, 20 Oct 2014 08:19:13 +0200 (CEST) Message-ID: <1413785951.4798.12.camel@neelix> Subject: Compiling Scala-generated bytecode From: Marko =?UTF-8?Q?Dimja=C5=A1evi=C4=87?= To: java-patches@gcc.gnu.org Date: Mon, 20 Oct 2014 06:19:00 -0000 Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-RuP9Lpbf4zrtoh/rzTom" Mime-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00022.txt.bz2 --=-RuP9Lpbf4zrtoh/rzTom Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-length: 2618 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=3D/usr/share/java/scala-library-2.9.2.jar:. *.class --main=3DHelloWorld=20 /tmp/ccFGxiOv.o: In function `void HelloWorld $::main(JArray*)': 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=3Dgcj COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Debian 4.7.2-3' --with-bugurl=3Dfile:///usr/share/doc/gcj-4.7/README.Bugs --enable-languages=3Dc,c++,java --prefix=3D/usr --program-suffix=3D-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --with-gxx-include-dir=3D/usr/include/c++/4.7 --libdir=3D/usr/lib --enable-nls --with-sysroot=3D/ --enable-clocale=3Dgnu --enable-libstdcxx-time=3Dyes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --disable-browser-plugin --enable-java-awt=3Dgtk --enable-gtk-cairo --with-java-home=3D/usr/lib/jvm/java-1.5.0-gcj-4.7/jre --enable-java-home --with-jvm-root-dir=3D/usr/lib/jvm/java-1.5.0-gcj-4.7 --with-jvm-jar-dir=3D/usr/lib/jvm-exports/java-1.5.0-gcj-4.7 --with-arch-directory=3Damd64 --with-ecj-jar=3D/usr/share/java/eclipse-ecj.jar --with-arch-32=3Di586 --with-tune=3Dgeneric --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-3) --=20 Kind regards, Marko Dimja=C5=A1evi=C4=87 http://dimjasevic.net/marko --=-RuP9Lpbf4zrtoh/rzTom Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJURKlfAAoJEGjtezy5N0tH+AgP/jVPEBxFjgdJmFtLudp6/MTY N6fOOfhf093iIpxkGse2EFTp7VrAPKFta6mPnMqysgXLjLYlnX63Fcrrx6+EXtwX gSBIfS48KlvMQSzimxmJnon7Wkh3Fsf+ErPHCJAhT0vMczqKCGzRh5OIx2UE224Y KEGzoGu2mPyRJ/AYBDpkeiymz82vDOHDDOhayv/8ro5VamPKRSVko7E3UC8y+lsm YXr0tMyUnEK8ur9sH5ilJiE7DbNCgYwKJUcD/DKof47xe79P22NrGQx+3c8MBbw5 y2BPNeLIMNgePWCwVFlliwGLgsOFk/djfy6S2hhbGkyt6JlJ2pJqAHsTPBMJ6Wld bd9l0Sb93vciGQtg2Md1YdQYHJF/h4fFDhLVUPLt6CSCHi5Omm4cZxwGwg+8PLzW sBZWEKpMFJaqzZMCiiGpi/0pPAzGahyi0VML41MrBltEChgJKemN1jGRwlE5kBuI NeLRJ4IQgzv2qbmo0iq1bt+BCJwgnO69h2wZvBrNkvmvGyTwqGWcEUOSVse2+XCy ZY/71p08kmWjuCiPOf5r+dpvwbqd0LhoFwNLSYuA/Uxd+5WefkUTxeQ67Hhty9mv /bNlP9/xVKIrjUhIrx+LKdg1Rn8sJecydhcdG2DuiNkDDi5KmrYkUJ6a+32t9reJ 6h6V9OstvfFOmxQ2tawA =flcN -----END PGP SIGNATURE----- --=-RuP9Lpbf4zrtoh/rzTom--