Re: Compiling jar file using gcj

Swapnil Jain <[email protected]>
Newsgroups gmane.comp.gcc.help,gmane.comp.gcc.java.devel
Message-ID <[email protected]>
i am using ubuntu 9.04 32 bit desktop edition.

gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
gcj (Ubuntu 4.3.3-5ubuntu4) 4.3.3
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)

i created a java project using netbeans. it uses 2 libraries  
RXTXcomm.jar & mysql-connector-java-5.1.7-bin.jar

after building the project thru netbeans i get the iRemote.jar file in  
the dist folder.

i want to compile it using gcj to create a binary file. i am using the  
following command

gcj -o iRemote.sh --main=iremote.controller.Controller -- 
classpath=RXTXcomm.jar:mysql-connector-java-5.1.7-bin.jar: iRemote.jar  
RXTXcomm.jar mysql-connector-java-5.1.7-bin.jar -v

i am getting a segmentation fault error (file attached)


i am also attaching strace of gcc & gcj



kindly let me know if any more information you need.

--------------------------------
Swapnil Jain
Indore
-----------------------------------------------



On 31-Aug-09, at 4:13 PM, Andrew Haley wrote:

> Swapnil Jain wrote:
>> Hi,
>>
>> now i am getting the following  Segmentation fault error.
>
> If you provide me with a complete test case (all files, all the
> commands you use) I'll have a look.
>
> Andrew.
strace-gcc.txt (text/plain, 6 KB)
execve("/usr/bin/gcc", ["gcc"], [/* 20 vars */]) = 0
brk(0)                                  = 0x8652000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f2a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=58938, ...}) = 0
mmap2(NULL, 58938, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f1b000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320h\1\0004\0\0\0\344"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1442180, ...}) = 0
mmap2(NULL, 1451632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7db8000
mprotect(0xb7f14000, 4096, PROT_NONE)   = 0
mmap2(0xb7f15000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15c) = 0xb7f15000
mmap2(0xb7f18000, 9840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f18000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7db7000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7db78d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "b\201e;"..., 4)                = 4
close(3)                                = 0
mprotect(0xb7f15000, 8192, PROT_READ)   = 0
mprotect(0x807a000, 4096, PROT_READ)    = 0
mprotect(0xb7f49000, 4096, PROT_READ)   = 0
munmap(0xb7f1b000, 58938)               = 0
brk(0)                                  = 0x8652000
brk(0x8673000)                          = 0x8673000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f29000
read(3, "# Locale name alias data base.\n# "..., 4096) = 2570
read(3, ""..., 4096)                    = 0
close(3)                                = 0
munmap(0xb7f29000, 4096)                = 0
open("/usr/lib/locale/en_IN/LC_CTYPE", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=256316, ...}) = 0
mmap2(NULL, 256316, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7d78000
close(3)                                = 0
open("/usr/lib/locale/en_IN/LC_MESSAGES", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
close(3)                                = 0
open("/usr/lib/locale/en_IN/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=53, ...}) = 0
mmap2(NULL, 53, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f29000
close(3)                                = 0
open("/usr/share/locale/en_IN/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_IN/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x80503c0, [INT], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGHUP, {0x80503c0, [HUP], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x80503c0, [TERM], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x80503c0, [PIPE], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
access("/usr/local/sbin/gcc", X_OK)     = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcc", X_OK)      = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcc", X_OK)           = -1 ENOENT (No such file or directory)
access("/usr/bin/gcc", X_OK)            = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/bin", {st_mode=S_IFDIR|0755, st_size=45056, ...}) = 0
lstat64("/usr/bin/gcc", {st_mode=S_IFLNK|0777, st_size=7, ...}) = 0
readlink("/usr/bin/gcc", "gcc-4.3"..., 4095) = 7
lstat64("/usr/bin/gcc-4.3", {st_mode=S_IFREG|0755, st_size=208068, ...}) = 0
access("/usr/local/sbin/gcc", X_OK)     = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcc", X_OK)      = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcc", X_OK)           = -1 ENOENT (No such file or directory)
access("/usr/bin/gcc", X_OK)            = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/bin", {st_mode=S_IFDIR|0755, st_size=45056, ...}) = 0
lstat64("/usr/bin/gcc", {st_mode=S_IFLNK|0777, st_size=7, ...}) = 0
readlink("/usr/bin/gcc", "gcc-4.3"..., 4095) = 7
lstat64("/usr/bin/gcc-4.3", {st_mode=S_IFREG|0755, st_size=208068, ...}) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../i486-linux-gnu/lib/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
write(2, "gcc: "..., 5gcc: )                 = 5
write(2, "no input files"..., 14no input files)       = 14
write(2, "\n"..., 1
)                    = 1
exit_group(1)                           = ?
strace-gcj.txt (text/plain, 6.3 KB)
execve("/usr/bin/gcj", ["gcj"], [/* 20 vars */]) = 0
brk(0)                                  = 0x9570000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb808c000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=58938, ...}) = 0
mmap2(NULL, 58938, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb807d000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320h\1\0004\0\0\0\344"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1442180, ...}) = 0
mmap2(NULL, 1451632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f1a000
mprotect(0xb8076000, 4096, PROT_NONE)   = 0
mmap2(0xb8077000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15c) = 0xb8077000
mmap2(0xb807a000, 9840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb807a000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f19000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f196c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "\200T\213\203"..., 4)          = 4
close(3)                                = 0
mprotect(0xb8077000, 8192, PROT_READ)   = 0
mprotect(0xb80ab000, 4096, PROT_READ)   = 0
munmap(0xb807d000, 58938)               = 0
brk(0)                                  = 0x9570000
brk(0x9591000)                          = 0x9591000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb808b000
read(3, "# Locale name alias data base.\n# "..., 4096) = 2570
read(3, ""..., 4096)                    = 0
close(3)                                = 0
munmap(0xb808b000, 4096)                = 0
open("/usr/lib/locale/en_IN/LC_CTYPE", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=256316, ...}) = 0
mmap2(NULL, 256316, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7eda000
close(3)                                = 0
open("/usr/lib/locale/en_IN/LC_MESSAGES", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
close(3)                                = 0
open("/usr/lib/locale/en_IN/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=53, ...}) = 0
mmap2(NULL, 53, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb808b000
close(3)                                = 0
open("/usr/share/locale/en_IN/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_IN/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/gcc-4.3.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x8053cf0, [INT], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGHUP, {0x8053cf0, [HUP], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x8053cf0, [TERM], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x8053cf0, [PIPE], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
access("/usr/local/sbin/gcj", X_OK)     = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcj", X_OK)      = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcj", X_OK)           = -1 ENOENT (No such file or directory)
access("/usr/bin/gcj", X_OK)            = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/bin", {st_mode=S_IFDIR|0755, st_size=45056, ...}) = 0
lstat64("/usr/bin/gcj", {st_mode=S_IFLNK|0777, st_size=7, ...}) = 0
readlink("/usr/bin/gcj", "gcj-4.3"..., 4095) = 7
lstat64("/usr/bin/gcj-4.3", {st_mode=S_IFREG|0755, st_size=212840, ...}) = 0
access("/usr/local/sbin/gcj", X_OK)     = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcj", X_OK)      = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcj", X_OK)           = -1 ENOENT (No such file or directory)
access("/usr/bin/gcj", X_OK)            = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/bin", {st_mode=S_IFDIR|0755, st_size=45056, ...}) = 0
lstat64("/usr/bin/gcj", {st_mode=S_IFLNK|0777, st_size=7, ...}) = 0
readlink("/usr/bin/gcj", "gcj-4.3"..., 4095) = 7
lstat64("/usr/bin/gcj-4.3", {st_mode=S_IFREG|0755, st_size=212840, ...}) = 0
stat64("/usr/share/java/ext/", 0xbfda9a54) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.3.3/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../i486-linux-gnu/lib/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/", X_OK) = 0
access("/usr/lib/gcc/i486-linux-gnu/4.3.3/libgcj.spec", R_OK) = 0
open("/usr/lib/gcc/i486-linux-gnu/4.3.3/libgcj.spec", O_RDONLY) = 3
stat64("/usr/lib/gcc/i486-linux-gnu/4.3.3/libgcj.spec", {st_mode=S_IFREG|0644, st_size=488, ...}) = 0
read(3, "#\n# This spec file is read by gcj"..., 488) = 488
close(3)                                = 0
write(2, "gcj: "..., 5gcj: )                 = 5
write(2, "no input files"..., 14no input files)       = 14
write(2, "\n"..., 1
)                    = 1
exit_group(1)                           = ?
Segmentation fault.txt (text/plain, 1.5 KB)
Using built-in specs.
Reading specs from /usr/lib/gcc/i486-linux-gnu/4.3.3/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcj-4.3/README.Bugs --enable-languages=c$
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
COLLECT_GCC_OPTIONS='-ffilelist-file' '-o' 'iRemote.sh' '-v' '-fbootclasspath=RXTXcomm.jar:mysql-connector-java-5.1.7-bin.jar:./:/usr/share/java/libgcj-4.3$
COLLECT_GCC_OPTIONS='-ffilelist-file' '-o' 'iRemote.sh' '-v' '-fbootclasspath=RXTXcomm.jar:mysql-connector-java-5.1.7-bin.jar:./:/usr/share/java/libgcj-4.3$
 /usr/lib/gcc/i486-linux-gnu/4.3.3/jc1 /tmp/ccM9dwPgjx -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline$
GNU Java (Ubuntu 4.3.3-5ubuntu4) version 4.3.3 (i486-linux-gnu)
        compiled by GNU C version 4.3.3, GMP version 4.2.4, MPFR version 2.4.0.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128197
Class path starts here:
    /tmp/ccU59wjn.zip/ (zip)
    RXTXcomm.jar/ (system) (zip)
    mysql-connector-java-5.1.7-bin.jar/ (system) (zip)
    ./ (system)
    /usr/share/java/libgcj-4.3.jar/ (system) (zip)
java/io/BufferedWriter.java:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcj-4.3/README.Bugs> for instructions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.