public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: NewBie question: Segmentation faults
  2000-04-01  0:00               ` Alexis Denis
@ 2000-04-01  0:00                 ` Anthony Green
  2000-04-01  0:00                   ` It finally compiled! [Re: NewBie question: Segmentation faults] Alexis Denis
  0 siblings, 1 reply; 12+ messages in thread
From: Anthony Green @ 2000-04-01  0:00 UTC (permalink / raw)
  To: adenis; +Cc: adenis, tromey, bryce, java-discuss

Alexis wrote:
> However, there is no mention of those variables in
> libgcj-snapshot-2000-02-18/libffi/src/powerpc/ffi.c

The comment is wrong.  They're really in libffi/src/types.c. 

Run nm on your libffi.a to make sure these symbols exist in types.o.
If not, try to figure out why.

AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California

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

* NewBie question: Segmentation faults
@ 2000-04-01  0:00 Alexis Denis
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

I give up.

I'm trying to compile the following program:
class HelloWorld {
    public static void main (String args[]) {
        System.out.println("Hello World!");
    }
}

I do the following:
gcj --main=HelloWorld -o HelloWorld HelloWorld.java

my CLASSPATH variable points to:
/home/adenis/java/classes
in which I uncompressed libgcj.zip (as recommended in the FAQ 5.1)

Everytime I run the program HelloWorld I get a core dump.

I'm running linuxppc 1999Q3. gcj comes from the archive
gcc-java-2.95.1-0a which contains:
/usr/bin/gcj
/usr/bin/gcjh
/usr/bin/jcf-dump
/usr/bin/jv-scan
/usr/lib/gcc-lib
/usr/lib/gcc-lib/ppc-redhat-linux
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.1
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.1/include
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.1/jc1
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.1/jvgenmain
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.1/nof

and I compiled libgcj 2.95.1

I read quite a bit of the archived list but I couldn't find any
solution. Please help!

Thanks,

Alexis

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00           ` Alexis Denis
@ 2000-04-01  0:00             ` Anthony Green
  2000-04-01  0:00               ` Alexis Denis
  0 siblings, 1 reply; 12+ messages in thread
From: Anthony Green @ 2000-04-01  0:00 UTC (permalink / raw)
  To: adenis; +Cc: tromey, adenis, bryce, java-discuss

Alexis wrote:
> I am now using egcs snapshot 20000214, in the last linking stages I from 
> libgcj-snapshot-2000-02-18 I still get:

Look in your build directory.  Do you have
powerpc-unknown-linux-gnu/libffi/.libs/libffi.a?

AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00 NewBie question: Segmentation faults Alexis Denis
@ 2000-04-01  0:00 ` Tom Tromey
  2000-04-01  0:00   ` Alexis Denis
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Alexis Denis; +Cc: java-discuss

>>>>> "Alexis" == Alexis Denis <adenis@EE.UManitoba.CA> writes:

Alexis> I do the following:
Alexis> gcj --main=HelloWorld -o HelloWorld HelloWorld.java

This is right.

Alexis> my CLASSPATH variable points to:
Alexis> /home/adenis/java/classes
Alexis> in which I uncompressed libgcj.zip (as recommended in the FAQ 5.1)

The FAQ doesn't recommend uncompressing libgcj.zip.

Alexis> Everytime I run the program HelloWorld I get a core dump.

Your best bet is simply to unset CLASSPATH.
Failing that, point it directly at libgcj.zip.

Do this before compiling. your program.

If that fails, send a stack trace.

Tom

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00     ` Bryce McKinlay
@ 2000-04-01  0:00       ` Alexis Denis
  2000-04-01  0:00         ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: java-discuss

This is the type of HelloWorld:
$ file HelloWorld
HelloWorld: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1,
dynamically linked (uses shared libs), not stripped

but it seems that gdb can't execute it

> Using gdb:
>
> $ gcj -g --main=HelloWorld -o HelloWorld HelloWorld.java
> $ gdb ./HelloWorld
> "run"
> "bt" when it crashes. Send us the output.
>
> Is suspect your problem is the garbage collector. You may want to try a newer
> libgcj snapshot, which has a new gc version and some PPC fixes.
>
> regards
>
>   [ bryce ]

$ gdb ./HelloWorld
GNU gdb 4.18
...
(gdb) run
Starting program: /home/adenis/java/./HelloWorld
Don't know how to run.  Try "help target".
(gdb)

I compiled gcc 2.95.2 and I tried to compile libgcj-snapshot-2000-02-18:
first it was complaining that java-array.h didn't exist in some .h files that I
couldn't find. So I just linked libjava/include/java-array.h to
libjava/gcj/array.h
It then seemed to compile fine but at the last link for libgcj.so I got:

gnu/gcj/convert/BytesToUnicode.o: In function
`gnu::gcj::convert::BytesToUnicode::getDefaultDecodingClass(void)':
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/BytesToUnicode.java:34:
undefined reference to `_Jv_Throw'
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/BytesToUnicode.java:34:
relocation truncated to fit: R_PPC_REL24 _Jv_Throw
gnu/gcj/convert/BytesToUnicode.o: In function
`gnu::gcj::convert::BytesToUnicode::getDecoder(java::lang::String *)':
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/BytesToUnicode.java:76:
undefined reference to `_Jv_Throw'
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/BytesToUnicode.java:76:
relocation truncated to fit: R_PPC_REL24 _Jv_Throw
gnu/gcj/convert/UnicodeToBytes.o: In function
`gnu::gcj::convert::UnicodeToBytes::getDefaultEncodingClass(void)':
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/UnicodeToBytes.java:31:
undefined reference to `_Jv_Throw'
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/UnicodeToBytes.java:31:
relocation truncated to fit: R_PPC_REL24 _Jv_Throw
gnu/gcj/convert/UnicodeToBytes.o: In function
`gnu::gcj::convert::UnicodeToBytes::getEncoder(java::lang::String *)':
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/UnicodeToBytes.java:74:
undefined reference to `_Jv_Throw'
/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava/../../../../libgcj-snapshot-2000-02-18/libjava/gnu/gcj/convert/UnicodeToBytes.java:74:
relocation truncated to fit: R_PPC_REL24 _Jv_Throw
.libs/libgcj.so: undefined reference to `ffi_type_float'
.libs/libgcj.so: undefined reference to `ffi_type_sint8'
.libs/libgcj.so: undefined reference to `ffi_prep_cif'
.libs/libgcj.so: undefined reference to `__va_arg_type_violation(void)'
.libs/libgcj.so: undefined reference to `ffi_type_pointer'
.libs/libgcj.so: undefined reference to `ffi_call'
.libs/libgcj.so: undefined reference to `ffi_type_uint16'
.libs/libgcj.so: undefined reference to `ffi_type_double'
.libs/libgcj.so: undefined reference to `ffi_type_sint32'
.libs/libgcj.so: undefined reference to `ffi_type_sint16'

collect2: ld returned 1 exit status
make[4]: *** [jv-convert] Error 1
make[4]: Leaving directory
`/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/nof/libjava'
make[2]: *** [multi-do] Error 1
make[2]: Leaving directory
`/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/libjava'
make[1]: *** [all-multi] Error 2
make[1]: Leaving directory
`/home/adenis/install/libgcj/build/powerpc-unknown-linux-gnu/libjava'
make: *** [all-target-libjava] Error 2

Things don't seem to be working overly well for me :)

Alexis

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00       ` Alexis Denis
@ 2000-04-01  0:00         ` Tom Tromey
  2000-04-01  0:00           ` Alexis Denis
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Alexis Denis; +Cc: Bryce McKinlay, java-discuss

Alexis> I compiled gcc 2.95.2 and I tried to compile
Alexis> libgcj-snapshot-2000-02-18:

This won't work.  You have to use the latest gcj to compile the latest
libgcj.

Tom

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00   ` Alexis Denis
@ 2000-04-01  0:00     ` Bryce McKinlay
  2000-04-01  0:00       ` Alexis Denis
  0 siblings, 1 reply; 12+ messages in thread
From: Bryce McKinlay @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Alexis Denis; +Cc: java-discuss

Alexis Denis wrote:

> I get the following:
> HelloWorld.java:0: Can't find default package `java.lang'. Check the
> CLASSPATH environment variable and the access to the archives.
> 1 error

It sounds like gcc was not installed in the same place as libgcj, or perhaps
it was not compiled correctly. gcj *should* be able to find its classes, but
if it can't you can use CLASSPATH to help it out.

> >
> > Failing that, point it directly at libgcj.zip.
>
> I then did:
> export CLASSPATH=/usr/local/share/libgcj.zip
> It compiles fine but it still segfaulted. Do you think I should compile gcj
> myself?
>
> > If that fails, send a stack trace.
>
> Sorry how do I do that?

Using gdb:

$ gcj -g --main=HelloWorld -o HelloWorld HelloWorld.java
$ gdb ./HelloWorld
"run"
"bt" when it crashes. Send us the output.

Is suspect your problem is the garbage collector. You may want to try a newer
libgcj snapshot, which has a new gc version and some PPC fixes.

regards

  [ bryce ]


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

* Re: It finally compiled! [Re: NewBie question: Segmentation faults]
  2000-04-01  0:00                   ` It finally compiled! [Re: NewBie question: Segmentation faults] Alexis Denis
@ 2000-04-01  0:00                     ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Alexis Denis; +Cc: green, tromey, bryce, java-discuss

Alexis>     - The symbol inf in java/lang/Double.h was not defined so
Alexis> I just deleted any reference to it in the file as in the
Alexis> Double.h from 2.95.1

Could you send me your failing (unedited) Double.h?
THanks.

Alexis>     - The libffi library was not linked into libgcj.so. After
Alexis> looking around for awhile, I found out that the libffi was not
Alexis> properly copied into the nof directory. I copied it made a
Alexis> clean compile and it worked.

Oops -- multilib failure.  This is my fault.  I'll fix it.

Alexis> Now I compiled gdb-000220 and I still get the following error
Alexis> when running the program:
Alexis> Starting program: /home/adenis/java/HelloWorld
Alexis> Don't know how to run.  Try "help target".

That's annoying.  You'll have to talk to the gdb hackers about what is
wrong there.

Tom

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00         ` Tom Tromey
@ 2000-04-01  0:00           ` Alexis Denis
  2000-04-01  0:00             ` Anthony Green
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Alexis Denis, Bryce McKinlay, java-discuss

> 
> Alexis> I compiled gcc 2.95.2 and I tried to compile
> Alexis> libgcj-snapshot-2000-02-18:
> 
> This won't work.  You have to use the latest gcj to compile the latest
> libgcj.
> 
> Tom
> 
I am now using egcs snapshot 20000214, in the last linking stages I from 
libgcj-snapshot-2000-02-18 I still get:

.libs/libgcj.so: undefined reference to `ffi_type_float'
.libs/libgcj.so: undefined reference to `ffi_type_sint8'
.libs/libgcj.so: undefined reference to `ffi_prep_cif'
.libs/libgcj.so: undefined reference to `ffi_type_pointer'
.libs/libgcj.so: undefined reference to `ffi_call'
.libs/libgcj.so: undefined reference to `ffi_type_uint16'
.libs/libgcj.so: undefined reference to `ffi_type_double'
.libs/libgcj.so: undefined reference to `ffi_type_sint32'
.libs/libgcj.so: undefined reference to `ffi_type_sint16'
.libs/libgcj.so: undefined reference to `ffi_type_void'
.libs/libgcj.so: undefined reference to `ffi_type_sint64'
collect2: ld returned 1 exit status
make[4]: *** [jv-convert] Error 1
make[4]: Leaving directory `/home/adenis/install/libgcj/build/powerpc-unknown-li
nux-gnu/nof/libjava'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/adenis/install/libgcj/build/powerpc-unknown-li
nux-gnu/nof/libjava'
make[2]: *** [multi-do] Error 1
make[2]: Leaving directory `/home/adenis/install/libgcj/build/powerpc-unknown-li
nux-gnu/libjava'
make[1]: *** [all-multi] Error 2
make[1]: Leaving directory `/home/adenis/install/libgcj/build/powerpc-unknown-li
nux-gnu/libjava'
make: *** [all-target-libjava] Error 2

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

* It finally compiled! [Re: NewBie question: Segmentation faults]
  2000-04-01  0:00                 ` Anthony Green
@ 2000-04-01  0:00                   ` Alexis Denis
  2000-04-01  0:00                     ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: green; +Cc: tromey, bryce, java-discuss

I encountered teo problems during the compile:
    - The symbol inf in java/lang/Double.h was not defined so I just deleted
any reference to it in the file as in the Double.h from 2.95.1
    - The libffi library was not linked into libgcj.so. After looking around
for awhile, I found out that the libffi was not properly copied into the nof
directory. I copied it made a clean compile and it worked.
    - I compiled my HelloWorld program and it worked too (that moment was
pretty exhilirating :)

Now I compiled gdb-000220 and I still get the following error when running the
program:
Starting program: /home/adenis/java/HelloWorld
Don't know how to run.  Try "help target".

I compiled the program with:
gcj -g --main=HelloWorld -o HelloWorld HelloWorld.java
and:
gcj -g1 --main=HelloWorld -o HelloWorld HelloWorld.java

The gdb issue is not as important as the compiler issue (it would be nice to be
able to have a debugger but I could do without it). But I wanted to thank you
all for your patient help to a beginner,

Thanks,

Alexis

Anthony Green wrote:

> Alexis wrote:
> > However, there is no mention of those variables in
> > libgcj-snapshot-2000-02-18/libffi/src/powerpc/ffi.c
>
> The comment is wrong.  They're really in libffi/src/types.c.
>
> Run nm on your libffi.a to make sure these symbols exist in types.o.
> If not, try to figure out why.
>
> AG
>
> --
> Anthony Green                                                        Red Hat
>                                                        Sunnyvale, California

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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00 ` Tom Tromey
@ 2000-04-01  0:00   ` Alexis Denis
  2000-04-01  0:00     ` Bryce McKinlay
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: egcs; +Cc: java-discuss

Tom Tromey wrote:

> Your best bet is simply to unset CLASSPATH.

I get the following:
HelloWorld.java:0: Can't find default package `java.lang'. Check the
CLASSPATH environment variable and the access to the archives.
1 error



>
> Failing that, point it directly at libgcj.zip.

I then did:
export CLASSPATH=/usr/local/share/libgcj.zip
It compiles fine but it still segfaulted. Do you think I should compile gcj
myself?

> If that fails, send a stack trace.

Sorry how do I do that?

Alexis



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

* Re: NewBie question: Segmentation faults
  2000-04-01  0:00             ` Anthony Green
@ 2000-04-01  0:00               ` Alexis Denis
  2000-04-01  0:00                 ` Anthony Green
  0 siblings, 1 reply; 12+ messages in thread
From: Alexis Denis @ 2000-04-01  0:00 UTC (permalink / raw)
  To: green; +Cc: adenis, tromey, bryce, java-discuss

> 
> 
> Alexis wrote:
> > I am now using egcs snapshot 20000214, in the last linking stages I from 
> > libgcj-snapshot-2000-02-18 I still get:
> 
> Look in your build directory.  Do you have
> powerpc-unknown-linux-gnu/libffi/.libs/libffi.a?
Hi Anthony,

ls powerpc-unknown-linux-gnu/libffi/.libs/
ffitest  libffi-2.00-beta.so  libffi.a  libffi.la  libffi.lai  libffi.so

However, I looked in the generated powerpc-unknown-linux-gnu/libffi/include/ffi.h and there is:
/* These are defined in ffi.c */
extern ffi_type ffi_type_void;
extern ffi_type ffi_type_uint8;
extern ffi_type ffi_type_sint8;
extern ffi_type ffi_type_uint16;
extern ffi_type ffi_type_sint16;
extern ffi_type ffi_type_uint32;
extern ffi_type ffi_type_sint32;
extern ffi_type ffi_type_uint64;
extern ffi_type ffi_type_sint64;
extern ffi_type ffi_type_float;
extern ffi_type ffi_type_double;
extern ffi_type ffi_type_longdouble;
extern ffi_type ffi_type_pointer;

However, there is no mention of those variables in libgcj-snapshot-2000-02-18/libffi/src/powerpc/ffi.c

Alexis

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

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 NewBie question: Segmentation faults Alexis Denis
2000-04-01  0:00 ` Tom Tromey
2000-04-01  0:00   ` Alexis Denis
2000-04-01  0:00     ` Bryce McKinlay
2000-04-01  0:00       ` Alexis Denis
2000-04-01  0:00         ` Tom Tromey
2000-04-01  0:00           ` Alexis Denis
2000-04-01  0:00             ` Anthony Green
2000-04-01  0:00               ` Alexis Denis
2000-04-01  0:00                 ` Anthony Green
2000-04-01  0:00                   ` It finally compiled! [Re: NewBie question: Segmentation faults] Alexis Denis
2000-04-01  0:00                     ` Tom Tromey

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