Skip to main content

romgen does not halt

25 replies [Last post]
selenau
Offline
Joined: 2006-10-11
Points: 0

after I built cldc (bvd) pcsl tools from trunk, I got stuck at midp (linux_fb_gcc) / romgen. I tried to run romgen manually with verbose and increase heap but nothing changed.

[Loaded javax/microedition/rms/RecordEnumeration]
[Loaded javax/microedition/rms/RecordListener]
[Loaded javax/microedition/rms/RecordEnumerationImpl]
[Loaded javax/microedition/rms/RecordFilter]
[Loaded javax/microedition/rms/RecordStore$1]
[Loaded javax/microedition/rms/RecordStore$SecurityTrusted]
[Loaded javax/microedition/rms/RecordStore]
[Loaded javax/microedition/rms/RecordStoreNotOpenException]
Done! in 6.57 seconds
... reading system property: microedition.encoding
[full GC <251658K+10485K=262144K> 61K+6438K -> 1498K, 88473684 hrticks]
Heap 0xa7fcd000-0xa8143954, 0xa8143954, 0xa8143954-0xab476c8c
[full GC <251658K+10485K=262144K> 1498K+27K -> 1479K, 71344844 hrticks]
Heap 0xa7fcd000-0xa813ed9c, 0xa813ed9c, 0xa813ed9c-0xab4720d4

[Verify heap]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
selenau
Offline
Joined: 2006-10-11
Points: 0

==============================
starting PRODUCT build
==============================
gmake[1]: Entering directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/product'
gmake[1]: Nothing to be done for `dependencies'.
gmake[1]: Leaving directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/product'
gmake[1]: Entering directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/product'
==================================================
GNU_TOOLS_DIR = /usr/local/armx
==================================================
...
...
...
... ROMImage_11.cpp
... ROMImage_12.cpp
linking ../bin/cldc_vm ...
../bin/libcldc_vm.a(Interpreter_arm.o)(.data+0x8b8): In function `gp_trace_bytecode_ptr':
: undefined reference to `trace_bytecode'
collect2: ld returned 1 exit status
gmake[1]: *** [../bin/cldc_vm] Error 1
gmake[1]: Leaving directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/product'
gmake: *** [_product] Error 2

danila
Offline
Joined: 2006-09-24
Points: 0

Yes, this is a known failure.
We are working on a proper fix.
Hope it will be fine today.

billp
Offline
Joined: 2006-09-19
Points: 0

When you're suspicious of the ROMizer, you can turn off all optimizations and see if that solves your problem. THen it's a matter of figuring out which one is the culprit. Stuart is on the right track with his previous reply. To turn off the ROMizer optimization you'll need to either run the romizer manually and use the -EnableBaseOptimizations argument or tweak the jvm.make makefile to pass this argument to the ROMizer (instead of +EnableAllROMOptimizations flag).

bill

Actually for the midp build you'll need to tweak the build/common/makefiles/cldc_vm.gmk file to pass this flag.

Message was edited by: billp

selenau
Offline
Joined: 2006-10-11
Points: 0

"gmake clean" my trunk copy. re-checkout from trunk. do the build with -EnableBaseOptimizations in jvm.make file.

This is first run.
----------------------
.....
[3254] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3255] EntryFrame
[3256] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3257] EntryFrame
[3258] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3259] EntryFrame
[3260] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3261] EntryFrame
[3262] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3263] EntryFrame
[3264] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3265] EntryFrame
[3266] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3267] EntryFrame
[3268] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3269] EntryFrame
[3270] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3271] EntryFrame
[3272] com/sun/cldchi/jvm/JVM.createSysImage bci=0
[3273] EntryFrame
[3274] gmake[1]: *** [../generated/ROMImage.cpp] Segmentation fault
gmake[1]: Leaving directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/debug'
gmake: *** [_debug] Error 2
ERROR: MIDP_USE_ABB () is not set to a boolean value
gmake: *** [MIDP_USE_ABB] Error 255

This is second run. (I re-entered build command)
---------------------------

If romizer fails, increase your heap size.
E.g., =HeapCapacity80M

Starting free heap = 13045 KB
Loading classes...Done! in 0.913 seconds
... reading system property: microedition.encoding
Fatal signal SIGSEGV: errno=0; code=2; addr=0x804aee5
[Dumping all threads]
Current thread = 0x40002000

[Thread: 0x40002000 *** CURRENT ***]

#
# VM Error, assertion failure
#
# Error ID: /work/pxa/phoneME/feature_bvd/sources/cldc/src/vm/share/handles/ExecutionStack.cpp, 30
#
# assert(is_null() || JVMUniverse:: is_bootstrapping() || JVMObjectHeap::is_gc_active() || is_execution_stack(), "dynamic type check")
#
gmake[1]: *** [../generated/ROMImage.cpp] Trace/breakpoint trap
gmake[1]: Leaving directory `/work/pxa/phoneME/feature_bvd/build/cldc/linux_bvd/target/debug'
gmake: *** [_debug] Error 2
ERROR: MIDP_USE_ABB () is not set to a boolean value
gmake: *** [MIDP_USE_ABB] Error 255

danila
Offline
Joined: 2006-09-24
Points: 0

Hi!
I'm trying to reproduce the build problems you described on my side.
Could you provide the following info:
- the exact env vars settings and build commands you used,
- error messages when you try to build unmodified cldc trunk copy.

Thanks,
Danila

selenau
Offline
Joined: 2006-10-11
Points: 0

[root@argelinux phoneME]# export
declare -x COLORTERM="gnome-terminal"
declare -x CVS_RSH="ssh"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-IEpAvebu2I,guid=96dee50befaaaef0535a990045dbf174"
declare -x DESKTOP_STARTUP_ID=""
declare -x DISPLAY="unix:1001.0"
declare -x GNOME_DESKTOP_SESSION_ID="Default"
declare -x GNOME_KEYRING_SOCKET="/tmp/keyring-TCBVn8/socket"
declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/selenau/.gtkrc-1.2-gnome2"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="argelinux"
declare -x INPUTRC="/etc/inputrc"
declare -x KDEDIR="/usr"
declare -x KDE_IS_PRELINKED="1"
declare -x KDE_NO_IPV6="1"
declare -x LANG="en_US.UTF-8"
declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="selenau"
declare -x LS_COLORS="no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"
declare -x MAIL="/var/spool/mail/selenau"
declare -x NXSESSIONID="argelinux-1001-B9F3CC512B51D95F5F123438D72A467A"
declare -x OLDPWD
declare -x PATH="/usr/kerberos/sbin:/sbin:/usr/local/arm/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/selenau/bin"
declare -x PWD="/work/pxa/phoneME"
declare -x QTDIR="/usr/lib/qt-3.3"
declare -x QTINC="/usr/lib/qt-3.3/include"
declare -x QTLIB="/usr/lib/qt-3.3/lib"
declare -x SESSION_MANAGER="local/argelinux:/tmp/.ICE-unix/5917"
declare -x SHELL="/bin/bash"
declare -x SHLVL="4"
declare -x SSH_AGENT_PID="5919"
declare -x SSH_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass"
declare -x SSH_AUTH_SOCK="/tmp/ssh-GRGkDX5917/agent.5917"
declare -x SSH_CLIENT="127.0.0.1 46928 22"
declare -x SSH_CONNECTION="127.0.0.1 46928 127.0.0.1 22"
declare -x TERM="xterm"
declare -x USER="selenau"
declare -x WINDOWID="16822686"
declare -x XAUTHORITY="/root/.xauth0DV1ua"

I created two scripts for getting latest from trunk and build it.

get from trunk
-------------------------------------
#!/bin/bash

#hello
echo kentkart get trunk script for \"phoneME feature\"

#set directory to work
if [ -z $1 ]
then
#generate unique directory name
BASE_DIR=`pwd`/trunk_`date +%Y%m%d%H%M`
else
#use first parameter as directory name
BASE_DIR=`pwd`/$1
fi

#check if BASE_DIR exists
if [ -e $BASE_DIR ]; then
echo A directory named $BASE_DIR already exists, using it.
else
echo Creating directory $BASE_DIR.
mkdir -p $BASE_DIR/sources
fi

cd $BASE_DIR/sources

#internal variables
SVN_PARAM="--username guest"

#latest
svn checkout https://phoneme.dev.java.net/svn/phoneme/components/tools/trunk tools $SVN_PARAM
svn checkout https://phoneme.dev.java.net/svn/phoneme/components/pcsl/trunk pcsl $SVN_PARAM
svn checkout https://phoneme.dev.java.net/svn/phoneme/components/cldc/trunk cldc $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/midp/trunk midp $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jpeg/trunk jpeg $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr177/trunk jsr177 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr135/trunk jsr135 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/pisces/trunk pisces $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr211/trunk jsr211 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr120/trunk jsr120 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr172/trunk jsr172 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/jsr135/trunk jsr135 $SVN_PARAM
#svn checkout https://phoneme.dev.java.net/svn/phoneme/components/javacall/trunk javacall $SVN_PARAM

build
--------------
#!/bin/bash

#hello
echo kentkart trunk build script for \"phoneME feature\"

#set directory to work
if [ -z $1 ]
then
#generate unique directory name
BASE_DIR=`pwd`/trunk_`date +%Y%m%d%H%M`
else
#use first parameter as directory name
BASE_DIR=`pwd`/$1
fi

#check if BASE_DIR exists
if [ -e $BASE_DIR ]; then
echo A directory named $BASE_DIR found.
else
echo No such directory named $BASE_DIR found.
exit
fi

cd $BASE_DIR/sources

#phoneME variables
export JDK_DIR=/usr/local/java/j2sdk1.4.2_12
export GNU_TOOLS_DIR=/usr/local/armx
export JVMWorkSpace=$BASE_DIR/sources/cldc
export JVMBuildSpace=$BASE_DIR/build/cldc
export PCSL_PLATFORM=linux_arm_gcc
export PCSL_OUTPUT_DIR=$BASE_DIR/build/pcsl
#export VERBOSE_BUILD=true
export TOOLS_DIR=$BASE_DIR/sources/tools
export TOOLS_OUTPUT_DIR=$BASE_DIR/build/tools
export MIDP_OUTPUT_DIR=$BASE_DIR/build/midp
export CLDC_DIST_DIR=$BASE_DIR/build/cldc/linux_bvd/dist
export JPEG_DIR=$BASE_DIR/sources/jpeg
export PISCES_DIR=$BASE_DIR/sources/pisces
export JSR_211_DIR=$BASE_DIR/sources/jsr211
export JSR_120_DIR=$BASE_DIR/sources/jsr120
export JSR_172_DIR=$BASE_DIR/sources/jsr172
export JSR_135_DIR=$BASE_DIR/sources/jsr135
export JSR_234_DIR=$BASE_DIR/sources/jsr135
export ANC_JAVACALL_DIR=$BASE_DIR/sources/javacall
#export JSR_239_DIR=$BASE_DIR/sources/jsr239
#export JSR_239_SDK_DIR=$BASE_DIR/sources/jsr239

export USE_DEBUG_ROMGEN=true
export USE_DEBUG_ROMGEN_SYMBOLS=true

#BUILD
cd pcsl
gmake NETWORK_MODULE=bsd/generic $2
cd ..
#directory below sets build!
cd cldc/build/linux_bvd
gmake ENABLE_PCSL=true $2
cd $BASE_DIR/sources
cd midp/build/linux_fb_gcc
gmake CPU=arm $2

----------

I use this scripts like:

#feature-get feature
#feature-build feature

----------
>>>- error messages when you try to build unmodified cldc trunk copy.
I just get 4 prefix errors I mentioned in other thread. (http://forums.java.net/jive/message.jspa?messageID=202865#202865)

I believe but not sure, if I fix them after they failed I got different error while building midp, if I fix them before building cldc, I got different error while building midp.

jonathan
Offline
Joined: 2003-06-12
Points: 0

I don't know if this will help, but I have noticed that it is safer to define build variables on the make command line than as environment variables. Environment variables do not always make it into the build system, which was very confusing for me when I first tried building.

Here is an excerpt from the build guide I'm writing for the commercial product:

-----
Build options should always be specified on the make command line. In some cases, it is possible to use environment variables to supply values to the build system, but it is a bad idea.

For example, suppose you did something like this:

export SOME_OPTION=true
make

If SOME_OPTION has no definition in the build system, the environment variable’s value will be used. On the other hand, if SOME_OPTION is defined with a default value in the build system, the value of the environment variable is ignored.

Mechanisms that work some times and not other times will only lead to pain and frustration.

Instead, define all build options on the make command line, like this:

make SOME_OPTION=true

This always works as you expect.
-----

selenau
Offline
Joined: 2006-10-11
Points: 0

Thanks for the tip, but I tried latest from trunk and nothing changed.

selenau
Offline
Joined: 2006-10-11
Points: 0

downloaded latest from trunk.
fix prefix errors.
build with debug_romgen flags, build finished.
when run usertest, I got:

./usertest
REPORT: midp_get_field_id: can't find field, clazz=0xbffffa40 name=runtimeInfo sig=Lcom/sun/midp/main/RuntimeInfo;

stuart_marks
Offline
Joined: 2006-08-24
Points: 0

Strange. This error message results from one of the calls to midp_get_field_id() in midpCommandState.c. It's looking in the CommandState class for the runtimeInfo field, which is of type com.sun.midp.main.RuntimeInfo. The field is definitely declared in the CommandState.java file.

One thing that might cause this problem is that the romizer renames (obfuscates) classes in order to save space. This causes errors in code that needs to look up classes by name. I notice that the ROM configuration file

midp/build/common/config/rom.config

was updated to avoid renaming nonpublic fields of the RuntimeInfo class. I think this was checked in a few hours before your latest post, selenau. Do you have rev 2343 of rom.config?

Looking at this a bit more closely, the RuntimeInfo class might need to be declared also in the DontRenameClass section of rom.config, since this class name is referenced in the field lookup. This is a bit of a guess though.

This is primarily aimed at alexey_z, since he's making changes in this area.

s'marks

selenau
Offline
Joined: 2006-10-11
Points: 0

It still waits. Same configuration with arm has no problems.

pansa3
Offline
Joined: 2006-10-19
Points: 0

First of all make cleanup - run "gmake clean"

So romgen shall be hanging after run now. So run it under debugger, break after some execution time and post here the stacktrace.

I will try to reproduce the problem here.

selenau
Offline
Joined: 2006-10-11
Points: 0

(gdb) bt
#0 0x0809634f in JVMCompiler::get_next_pinned_entry ()

pansa3
Offline
Joined: 2006-10-19
Points: 0

Couldn't reproduce it :(. What gcc are you using? Could I see the full stacktrace? Have you modified any rom config files?

selenau
Offline
Joined: 2006-10-11
Points: 0

[selenau@argelinux src]$ arm-linux-gcc --version
arm-linux-gcc (GCC) 3.3.2

I did not modified any rom config files.

How do I get the full stack trace?

pansa3
Offline
Joined: 2006-10-19
Points: 0

>How do I get the full stack trace?
"where" command should work.

It looks you are precompiling some methods. Try to look for such lines inside *.cfg files -
precompile = <..names here..> and comment them(or just remove temporary). Try to create clean build and see if there are any errors.

selenau
Offline
Joined: 2006-10-11
Points: 0

(gdb) where full
#0 0x0809634d in JVMCompiler::get_next_pinned_entry ()
No symbol table info available.

#gcc --version
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)
Copyright (C) 2006 Free Software Foundation, Inc.

pansa3
Offline
Joined: 2006-10-19
Points: 0

try to create build with these varaibles set to true -

ENABLE_DEBUG_ROMGEN=true
ENABLE_DEBUG_ROMGEN_SYMBOLS=true

this shall help with symbol tables.

selenau
Offline
Joined: 2006-10-11
Points: 0

flags did not worked. still no symbol table available.

I couldn't find this time but I think, I saw something like flags not recognized.

danila
Offline
Joined: 2006-09-24
Points: 0

Hi!
The flags are USE_DEBUG_ROMGEN and USE_DEBUG_ROMGEN_SYMBOLS.

selenau
Offline
Joined: 2006-10-11
Points: 0

It's possibly my mistake but maybe related;

#./usertest
REPORT: midp_get_field_id: can't find field, clazz=0xbffffa40 name=runtimeInfo sig=Lcom/sun/midp/main/RuntimeInfo;

selenau
Offline
Joined: 2006-10-11
Points: 0

trunk builds after I fix prefix errors in two files (see other thread).

but I get the error in previous post

selenau
Offline
Joined: 2006-10-11
Points: 0

Now I can't even build cldc (bvd or arm) from trunk.

copying empty ROMImage.cpp
... ROMImage.cpp
... ReflectNatives.cpp
... _MergedSrc001.cpp
{standard input}: Assembler messages:
{standard input}:3216: Error: bad instruction `int $03'
{standard input}:3353: Error: bad instruction `int $03'
{standard input}:3912: Error: bad instruction `int $03'
{standard input}:4029: Error: bad instruction `int $03'
{standard input}:4545: Error: bad instruction `int $03'
{standard input}:4808: Error: bad instruction `int $03'
{standard input}:4825: Error: bad instruction `int $03'
make[1]: *** [_MergedSrc001.o] Error 1

selenau
Offline
Joined: 2006-10-11
Points: 0

{standard input}:3353: Error: bad instruction `int $03'
{standard input}:3912: Error: bad instruction `int $03'
{standard input}:4029: Error: bad instruction `int $03'
{standard input}:4545: Error: bad instruction `int $03'

Sorry my mistake, It happens when you mix target and host compilers.

selenau
Offline
Joined: 2006-10-11
Points: 0

after I over-write romgen
cp ...../old/cldc/linux_arm/dist/bin/romgen ...../cldc/linux_bvd/dist/bin/romgen

It went fine until

... linking /work/pxa/phoneME/build/midp/bin/arm/runMidlet
/work/pxa/phoneME/build/midp/obj/arm/ROMImage.o(.rodata+0x1a504): undefined reference to `Java_com_sun_midp_suspend_SuspendSystem_0004MIDPSystem_suspended0'
/work/pxa/phoneME/build/midp/obj/arm/ROMImage.o(.rodata+0x1a520): undefined reference to `Java_com_sun_midp_suspend_SuspendSystem_0004MIDPSystem_allMidletsKilled'
/work/pxa/phoneME/build/cldc/linux_bvd/dist/lib/libcldc_vm.a(_MergedSrc004.o)(.text+0xafbc): In function `JVMROM::compiled_method_from_address(unsigned char*)':
: undefined reference to `_rom_compiled_methods_count'
/work/pxa/phoneME/build/cldc/linux_bvd/dist/lib/libcldc_vm.a(_MergedSrc004.o)(.text+0xafc0): In function `JVMROM::compiled_method_from_address(unsigned char*)':
: undefined reference to `_rom_compiled_methods'
collect2: ld returned 1 exit status
make: *** [/work/pxa/phoneME/build/midp/bin/arm/runMidlet] Error 1