Bug 32340 - [arm] libjava build failure due to missing thread synchronization primitives
Summary: [arm] libjava build failure due to missing thread synchronization primitives
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2007-06-14 10:50 UTC by Rask Ingemann Lambertsen
Modified: 2018-03-09 01:53 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: arm-unknown-elf
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 4.3.0
Last reconfirmed: 2009-04-20 05:58:18


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rask Ingemann Lambertsen 2007-06-14 10:50:03 UTC
I have configured gcc like this:

/n/08/rask/src/gcc/configure --target=arm-unknown-elf --disable-multilib --disable-nls --disable-gdb --with-newlib --enable-sim

Building libjava fails with this message:
libtool: compile:  /home/rask/build/gcc-arm-unknown-elf/./gcc/xgcc -shared-libgcc -B/home/rask/build/gcc-arm-unknown-elf/./gcc -nostdinc++ -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libstdc++-v3/src -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libstdc++-v3/src/.libs -nostdinc -B/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/newlib/ -isystem /home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/newlib/targ-include -isystem /n/08/rask/src/gcc/newlib/libc/include -B/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libgloss/arm -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libgloss/libnosys -L/n/08/rask/src/gcc/libgloss/arm -B/usr/local/arm-unknown-elf/bin/ -B/usr/local/arm-unknown-elf/lib/ -isystem /usr/local/arm-unknown-elf/include -isystem /usr/local/arm-unknown-elf/sys-include -L/home/rask/build/gcc-arm-unknown-elf/./ld -DHAVE_CONFIG_H -I. -I/n/08/rask/src/gcc/libjava -I./include -I./gcj -I/n/08/rask/src/gcc/libjava -Iinclude -I/n/08/rask/src/gcc/libjava/include -I/n/08/rask/src/gcc/libjava/classpath/include -Iclasspath/include -I/n/08/rask/src/gcc/libjava/classpath/native/fdlibm -I/n/08/rask/src/gcc/libjava/../boehm-gc/include -I../boehm-gc/include -I/n/08/rask/src/gcc/libjava/.././libjava/../gcc -I/n/08/rask/src/gcc/libjava/../zlib -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr/local\" -DTOOLEXECLIBDIR=\"/usr/local/arm-unknown-elf/lib\" -DJAVA_HOME=\"/usr/local\" -DBOOT_CLASS_PATH=\"/usr/local/share/java/libgcj-4.3.0.jar\" -DJAVA_EXT_DIRS=\"/usr/local/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/local/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/local/lib/gcj-4.3.0\" -DPATH_SEPARATOR=\":\" -DECJ_JAR_FILE=\"\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/local/lib/gcj-4.3.0/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.3.0/classmap.db\" -MT jni-libjvm.lo -MD -MP -MF .deps/jni-libjvm.Tpo -c /n/08/rask/src/gcc/libjava/jni-libjvm.cc -o jni-libjvm.o
In file included from /n/08/rask/src/gcc/libjava/include/jvm.h:35,
                 from /n/08/rask/src/gcc/libjava/jni-libjvm.cc:14:
./sysdep/locks.h:11:2: error: #error Thread synchronization primitives not implemented for this platform.
In file included from /n/08/rask/src/gcc/libjava/jni-libjvm.cc:14:
/n/08/rask/src/gcc/libjava/include/jvm.h:754: error: 'obj_addr_t' does not name a type
/n/08/rask/src/gcc/libjava/include/jvm.h:763: error: 'ParkHelper' does not name a type
make[3]: *** [jni-libjvm.lo] Error 1
make[3]: Leaving directory `/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/rask/build/gcc-arm-unknown-elf'
make: *** [all] Error 2
Comment 1 Vladislav Mikhailikov 2007-07-06 13:16:32 UTC
(In reply to comment #0)
> I have configured gcc like this:
> 
> /n/08/rask/src/gcc/configure --target=arm-unknown-elf --disable-multilib
> --disable-nls --disable-gdb --with-newlib --enable-sim
> 
> Building libjava fails with this message:
> libtool: compile:  /home/rask/build/gcc-arm-unknown-elf/./gcc/xgcc
> -shared-libgcc -B/home/rask/build/gcc-arm-unknown-elf/./gcc -nostdinc++
> -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libstdc++-v3/src
> -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libstdc++-v3/src/.libs
> -nostdinc -B/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/newlib/
> -isystem
> /home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/newlib/targ-include
> -isystem /n/08/rask/src/gcc/newlib/libc/include
> -B/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libgloss/arm
> -L/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libgloss/libnosys
> -L/n/08/rask/src/gcc/libgloss/arm -B/usr/local/arm-unknown-elf/bin/
> -B/usr/local/arm-unknown-elf/lib/ -isystem /usr/local/arm-unknown-elf/include
> -isystem /usr/local/arm-unknown-elf/sys-include
> -L/home/rask/build/gcc-arm-unknown-elf/./ld -DHAVE_CONFIG_H -I.
> -I/n/08/rask/src/gcc/libjava -I./include -I./gcj -I/n/08/rask/src/gcc/libjava
> -Iinclude -I/n/08/rask/src/gcc/libjava/include
> -I/n/08/rask/src/gcc/libjava/classpath/include -Iclasspath/include
> -I/n/08/rask/src/gcc/libjava/classpath/native/fdlibm
> -I/n/08/rask/src/gcc/libjava/../boehm-gc/include -I../boehm-gc/include
> -I/n/08/rask/src/gcc/libjava/.././libjava/../gcc
> -I/n/08/rask/src/gcc/libjava/../zlib -fno-rtti -fnon-call-exceptions
> -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -Wextra -Wall
> -D_GNU_SOURCE -DPREFIX=\"/usr/local\"
> -DTOOLEXECLIBDIR=\"/usr/local/arm-unknown-elf/lib\" -DJAVA_HOME=\"/usr/local\"
> -DBOOT_CLASS_PATH=\"/usr/local/share/java/libgcj-4.3.0.jar\"
> -DJAVA_EXT_DIRS=\"/usr/local/share/java/ext\"
> -DGCJ_ENDORSED_DIRS=\"/usr/local/share/java/gcj-endorsed\"
> -DGCJ_VERSIONED_LIBDIR=\"/usr/local/lib/gcj-4.3.0\" -DPATH_SEPARATOR=\":\"
> -DECJ_JAR_FILE=\"\"
> -DLIBGCJ_DEFAULT_DATABASE=\"/usr/local/lib/gcj-4.3.0/classmap.db\"
> -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.3.0/classmap.db\" -MT jni-libjvm.lo
> -MD -MP -MF .deps/jni-libjvm.Tpo -c /n/08/rask/src/gcc/libjava/jni-libjvm.cc -o
> jni-libjvm.o
> In file included from /n/08/rask/src/gcc/libjava/include/jvm.h:35,
>                  from /n/08/rask/src/gcc/libjava/jni-libjvm.cc:14:
> ./sysdep/locks.h:11:2: error: #error Thread synchronization primitives not
> implemented for this platform.
> In file included from /n/08/rask/src/gcc/libjava/jni-libjvm.cc:14:
> /n/08/rask/src/gcc/libjava/include/jvm.h:754: error: 'obj_addr_t' does not name
> a type
> /n/08/rask/src/gcc/libjava/include/jvm.h:763: error: 'ParkHelper' does not name
> a type
> make[3]: *** [jni-libjvm.lo] Error 1
> make[3]: Leaving directory
> `/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libjava'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory
> `/home/rask/build/gcc-arm-unknown-elf/arm-unknown-elf/libjava'
> make[1]: *** [all-target-libjava] Error 2
> make[1]: Leaving directory `/home/rask/build/gcc-arm-unknown-elf'
> make: *** [all] Error 2
> 

Hi,

I do have the similliar problem. My fix is:

# Fix thread primitives
pushd libjava/sysdep
mv -v generic generic.old
ln -svf i386 generic
popd

Comment 2 patchapp@dberlin.org 2007-07-13 17:15:16 UTC
Subject: Bug number PR 32340

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01273.html
Comment 3 Rask Ingemann Lambertsen 2007-07-16 10:32:15 UTC
Subject: Bug 32340

Author: rask
Date: Mon Jul 16 10:32:05 2007
New Revision: 126675

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126675
Log:
	PR target/32340
	* configure.host (arm*-elf | strongarm*-elf | xscale*-elf): Use the
	new sysdeps/arm directory.

Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/configure.host

Comment 4 Ramana Radhakrishnan 2009-04-20 05:58:17 UTC
The build is broken currently for arm-none-eabi targets on trunk. 

Attempting a simple fix of supporting arm-eabi* got me past the error reported in the original bug report. but I still get a failure with the following error message.

 /home/ramana/cos/build-java-also/./gcc/xgcc -shared-libgcc -B/home/ramana/cos/build-java-also/./gcc -nostdinc++ -L/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libstdc++-v3/src -L/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libstdc++-v3/src/.libs -nostdinc -B/home/ramana/cos/build-java-also/arm-none-eabi/thumb/newlib/ -isystem /home/ramana/cos/build-java-also/arm-none-eabi/thumb/newlib/targ-include -isystem /home/ramana/cos/combined/newlib/libc/include -B/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libgloss/arm -L/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libgloss/libnosys -L/home/ramana/cos/combined/libgloss/arm -B/usr/local/arm-none-eabi/bin/ -B/usr/local/arm-none-eabi/lib/ -isystem /usr/local/arm-none-eabi/include -isystem /usr/local/arm-none-eabi/sys-include -L/home/ramana/cos/build-java-also/./ld -mthumb -DHAVE_CONFIG_H -I. -I../../../../combined/libjava -I./include -I./gcj -I../../../../combined/libjava -Iinclude -I../../../../combined/libjava/include -I../../../../combined/libjava/classpath/include -Iclasspath/include -I../../../../combined/libjava/classpath/native/fdlibm -I../../../../combined/libjava/../boehm-gc/include -I../boehm-gc/include -I../../../../combined/libjava/.././libjava/../gcc -I../../../../combined/libjava/../zlib -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr/local\" -DTOOLEXECLIBDIR=\"/usr/local/arm-none-eabi/lib/thumb\" -DJAVA_HOME=\"/usr/local\" -DBOOT_CLASS_PATH=\"/usr/local/share/java/libgcj-4.5.0.jar\" -DJAVA_EXT_DIRS=\"/usr/local/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/local/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/local/lib/thumb/gcj-4.5.0-10\" -DPATH_SEPARATOR=\":\" -DECJ_JAR_FILE=\"\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/local/lib/thumb/gcj-4.5.0-10/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.5.0-10/classmap.db\" -g -O2 -mthumb -MT jni-libjvm.lo -MD -MP -MF .deps/jni-libjvm.Tpo -c ../../../../combined/libjava/jni-libjvm.cc -o jni-libjvm.o
In file included from ../../../../combined/libjava/include/jvmpi.h:17,
                 from ../../../../combined/libjava/include/jvm.h:670,
                 from ../../../../combined/libjava/jni-libjvm.cc:14:
../../../../combined/libjava/classpath/include/jni.h:660: note: the mangling of ‘va_list’ has changed in GCC 4.4
In file included from ../../../../combined/libjava/jni-libjvm.cc:14:
../../../../combined/libjava/include/jvm.h:795: error: ‘ParkHelper’ does not name a type
make[5]: *** [jni-libjvm.lo] Error 1
make[5]: Leaving directory `/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libjava'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/ramana/cos/build-java-also/arm-none-eabi/thumb/libjava'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory `/home/ramana/cos/build-java-also/arm-none-eabi/libjava'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory `/home/ramana/cos/build-java-also/arm-none-eabi/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/ramana/cos/build-java-also'
Comment 5 Andrew Haley 2009-04-20 08:48:27 UTC
Subject: Re:  [arm] libjava build failure due to missing
 thread synchronization primitives

ramana at gcc dot gnu dot org wrote:
> ------- Comment #4 from ramana at gcc dot gnu dot org  2009-04-20 05:58 -------
> The build is broken currently for arm-none-eabi targets on trunk. 
> 
> Attempting a simple fix of supporting arm-eabi* got me past the error reported
> in the original bug report. but I still get a failure with the following error
> message.

I'm not quite sure what you're trying to do.

What did you change to support arm-eabi* ?

Andrew.
Comment 6 Ramana Radhakrishnan 2009-04-20 14:30:52 UTC
Hi Andrew, 

> 
> 
> I'm not quite sure what you're trying to do.
> 
> What did you change to support arm-eabi* ?

I changed libjava/configure.host to also support arm-eabi (arm*-elf|arm*-eabi)but that probably wasn't enough. Given that arm-elf appears to be supported for this as per the last comment in the bug report, I thought it would make sense to have it working for arm-eabi.

I decided to go back and try an arm-elf build as well just now. I get a failure with jni-libjvm.cc with an error about ParkHelper not naming a type. Hence this appears to be broken on trunk as revision 146222 for arm-elf as well as arm-eabi.


Ramana
> 
> Andrew.
> 

Comment 7 Andrew Haley 2009-04-20 15:44:07 UTC
Subject: Re:  [arm] libjava build failure due to missing
 thread synchronization primitives

>> I'm not quite sure what you're trying to do.
>>
>> What did you change to support arm-eabi* ?
> 
> I changed libjava/configure.host to also support arm-eabi
> (arm*-elf|arm*-eabi)but that probably wasn't enough. Given that arm-elf appears
> to be supported for this as per the last comment in the bug report, I thought
> it would make sense to have it working for arm-eabi.
> 
> I decided to go back and try an arm-elf build as well just now. I get a failure
> with jni-libjvm.cc with an error about ParkHelper not naming a type. Hence this
> appears to be broken on trunk as revision 146222 for arm-elf as well as
> arm-eabi.

Probably.  The java.lang.concurrent library requires thread support,
so the only way you're going to get it to run with no threads is to
create dummy definitions for ParkHelper.  That should be easy, since
null definitions for park() and unpark() will be fine.

Just add these to libjava/no-threads.cc and libjava/include/no-threads.h.

Andrew.
Comment 8 Eduardo Costa 2009-06-01 19:48:02 UTC
(In reply to comment #7)
> Subject: Re:  [arm] libjava build failure due to missing
>  thread synchronization primitives
> 
> >> I'm not quite sure what you're trying to do.
> >>
> >> What did you change to support arm-eabi* ?
> > 
> > I changed libjava/configure.host to also support arm-eabi
> > (arm*-elf|arm*-eabi)but that probably wasn't enough. Given that arm-elf appears
> > to be supported for this as per the last comment in the bug report, I thought
> > it would make sense to have it working for arm-eabi.
> > 
> > I decided to go back and try an arm-elf build as well just now. I get a failure
> > with jni-libjvm.cc with an error about ParkHelper not naming a type. Hence this
> > appears to be broken on trunk as revision 146222 for arm-elf as well as
> > arm-eabi.
> 
> Probably.  The java.lang.concurrent library requires thread support,
> so the only way you're going to get it to run with no threads is to
> create dummy definitions for ParkHelper.  That should be easy, since
> null definitions for park() and unpark() will be fine.
> 
> Just add these to libjava/no-threads.cc and libjava/include/no-threads.h.
> 
> Andrew.
> 

I tryed this:

libjava/include/no-threads.h

struct ParkHelper
{
  void init ();
  void deactivate ();
  void destroy ();
  void park (jboolean isAbsolute, jlong time);
  void unpark ();
};

libjava/no-threads.cc

void ParkHelper::init () {}
void ParkHelper::deactivate () {}
void ParkHelper::destroy () {}
void ParkHelper::park (jboolean isAbsolute, jlong time) {}
void ParkHelper::unpark () {}

But I got more errors on libjava/sysdep/arm/locks.h (thumb mode does not recognize swp and swpne). 
Comment 9 Eric Gallager 2018-03-09 01:53:25 UTC
libjava has been removed from gcc.