Skip to main content

modifying bootclasspath in CDC build

2 replies [Last post]
mmoris
Offline
Joined: 2007-04-10
Points: 0

Greetings,

I am currently building CDC foundation profile for a custom embedded system. When designing the filesystem for our embedded system, we decided to have the following paths for the phoneME VM:
/usr/local/bin/cvm
/usr/local/lib/jvm/foundation.jar
/usr/local/lib/jvm/...

First of all, I have not found a simple way of specifying the lib build output directory. The only solution I found was to modify the following lines in the defs.mk Makefile :
CVM_LIBDIR := $(CVM_BUILD_TOP)/lib/jvm
CVM_LIBDIR_ABS := $(CVM_BUILD_TOP_ABS)/lib/jvm

These modifications force the build to use lib/jvm as output directory for foundation.jar and other library related outputs. Unfortunately, whenever I try to run cvm on our target system based on this file hierarchy, I get NoClassDefFoundErrors for all classes. I can get cvm to execute properly by using one of the following approaches:
# cvm -Xbootclasspath ../lib/jvm -version
# LDCONFIG=../lib/jvm cvm

Even though these solutions technically work, they are not viable for our environment as they force us to use wrapping script when calling cvm to setup it's lib directory.

Is there any way of properly specifying what lib folder cvm should use? How and when does cvm determine what it's bootclasspath is? If there is not obvious way of doing this, should the build system be modified to allow it?

Regards,
Martin

Reply viewing options

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

Absolute paths are not built into the cvm binary. If you look in CVMinitStaticState in globals_md.c, you will find code that finds the location of the cvm binary using readlink. From here it finds the lib directory using ../lib, the assumption being that cvm is located in ../bin/cvm. This path to the lib directory is stored in the pathInfo->libPath argument. You can then look in CVMinitPathValues in utils.c to see how pathInfo->libPath is used to build up all the elements of the bootclasspath. All files in CVM_JARFILES get prepended to pathInfo->libPath. CVM_JARFILES is found in build//generated/javavm/include/build_defs.h. It is setup by the makefiles.

So, your choices are:

1. Change how CVMinitStaticState initializes pathInfo->libPath so it includes the jvm subdir
2. Change CVMinitPathValues so it appends "/jvm" to pathInfo->libPath before appending the classes in CVM_JARFILES to it.
3. Change the the makefiles so the items in CVM_JARFILES have "jvm/" prepended to them.
4. Do a fully romized build with CVM_PRELOAD_LIB=true so you have no classes on the bootclasspath.

Chris

rogerd_dev
Offline
Joined: 2007-03-21
Points: 0

Do absolute paths get built into the cvm binary?

I am learning to deploy the cvm software to an embedded system and get file not found, class not found, segmentation fault errors.

I downloaded the source files for ME Advanced, and run the builds on Suse11 (2.6.25). All runs fine building with linux-suse build scripts.

Next I copy the binary and jar files out of the build tree into a test tree. I can get this to run also, although it is not perfectly clear to me what the required files are. It depends on the build profile, foundation, basis, etc. Each profile gets its own tree.

I copy the deployed tree over to my target system, laptop running PuppyLinux (2.6.25). I got the CDC.jar profile going, but foundation.jar and basis.jar have troubles.

I see that there are differences in the build scripts for each target system. What build variables should I look at to determine if the build will run on the embedded target machine?