开发者

Statically Linking a GCJ Application on Ubuntu Natty

开发者 https://www.devze.com 2023-04-13 04:23 出处:网络
I\'m trying to statically link a GCJ application and it looks like theres some misconfiguration somewhere. I\'m just using the standard gcj installation on natty and I have both libgcj11 and libgcj开发

I'm trying to statically link a GCJ application and it looks like theres some misconfiguration somewhere. I'm just using the standard gcj installation on natty and I have both libgcj11 and libgcj开发者_高级运维11-dev installed.

My test application is:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

I do:

gcj -static-libgcj --main=HelloWorldApp HelloWorldApp.java

then i get the following error

/usr/bin/ld: cannot find -lgcj
collect2: ld returned 1 exit status

Anyone know how to fix this?


Distros generally do not ship libgcj.a. Static linking does not work extremely well with gcj, anyway, mostly because not all of the class dependencies can be found -- compiled-in resources and also the use of reflection in the core library cause things to go missing at link time, unless you take special care to link them in by hand.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号