Hmm,
the integrity testing reports that HDK builds of Harmony crashes in Windows,
the error message is like
[java] build-native:
[java]
[java] -compile-native:
[java] [echo] Compiling SAMSA natives
[java] [echo]
harmony.jdktools=C:\harmony.cc\infra\build\checkouts\hdk\working_jdktools
[java] [echo] Making "" in
C:\harmony.cc\infra\build\checkouts\hdk\working_jdktools\modules\samsa\src\main\native/samsa/windows
[java] [exec] nmake /NOLOGO -f makefile.javae
[java] [exec] cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo
-FIsehmap.h -D_X86_=1 -DWIN32 -D_WIN32 -W3 -D_WIN95 -D_WIN32_WINDOWS=0x0400
/D_WIN32_DCOM -D_WIN32_IE=0x0500 -DWINVER=0x0400 -Zi -Od -WX -GF -Gs -MD
-Zm400 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_DEPRECATE -D_DLL -D_MT -D_WINSOCKAPI_
/IC:\harmony.cc\infra\build\checkouts\hdk\working_classlib\deploy\include
/IC:\harmony.cc\infra\build\checkouts\hdk\working_classlib\deploy\jdk\include
/I. -Fo..\samsa.obj ..\samsa.c
[java] [exec] samsa.c
[java] [exec] link /NOLOGO /INCREMENTAL:NO /NOLOGO
-subsystem:console,4.0 -subsystem:console /debug /opt:icf /opt:ref
-out:samsa.exe -machine:i386 setargv.obj ..\samsa.obj kernel32.lib
wsock32.lib advapi32.lib
[java] [exec] if exist samsa.exe.manifest mt -manifest
samsa.exe.manifest -outputresource:samsa.exe;#1
[java] [exec] nmake /NOLOGO -f makefile.javaw
[java] [exec] cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo
-FIsehmap.h -D_X86_=1 -DWIN32 -D_WIN32 -W3 -D_WIN95 -D_WIN32_WINDOWS=0x0400
/D_WIN32_DCOM -D_WIN32_IE=0x0500 -DWINVER=0x0400 -Zi -Od -WX -GF -Gs -MD
-Zm400 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_DEPRECATE -D_DLL -D_MT -D_WINSOCKAPI_
/IC:\harmony.cc\infra\build\checkouts\hdk\working_classlib\deploy\include
/IC:\harmony.cc\infra\build\checkouts\hdk\working_classlib\deploy\jdk\include
/I. -Fojavaw.obj javaw.c
[java] [exec] javaw.c
[java] [exec] link /NOLOGO /INCREMENTAL:NO /NOLOGO
-subsystem:console,4.0 -subsystem:windows /debug /opt:icf /opt:ref
-out:javaw.exe -machine:i386 setargv.obj javaw.obj ..\samsa.obj
kernel32.lib wsock32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib
winspool.lib
[java] [exec] javaw.obj : error LNK2019: unresolved external
symbol _isJRERoot referenced in function [EMAIL PROTECTED]
[java] [exec] javaw.exe : fatal error LNK1120: 1 unresolved
externals
[java] [exec] NMAKE : fatal error U1077: 'link' : return code
'0x460'
[java] [exec] Stop.
[java] [exec] NMAKE : fatal error U1077: '"C:\Program
Files\Microsoft Visual Studio .NET 2003\VC7\BIN\nmake.exe"' : return code
'0x2'
[java] [exec] Stop.
I can reproduce the building error in some other machines, in my
understanding the error is caused by this commit. Can we have a check for
that?
On Mon, Oct 27, 2008 at 6:56 AM, <[EMAIL PROTECTED]> wrote:
> Author: hindessm
> Date: Sun Oct 26 15:56:01 2008
> New Revision: 708057
>
> URL: http://svn.apache.org/viewvc?rev=708057&view=rev
> Log:
> Allow jretools to run from jdk/bin as well as jre/bin. Some preparations
> for removing the duplicate code from the jdk tools jar. Incidentally, I
> think the jartool and keysigner .dat files are broken but I'm just updating
> them until I have time to test this theory.
>
> Modified:
> harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
>
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
>
>
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/jartool.dat
>
>
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/javac.dat
>
>
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/keysigner.dat
>
> Modified: harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
> URL:
> http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/build.xml?rev=708057&r1=708056&r2=708057&view=diff
>
> ==============================================================================
> --- harmony/enhanced/jdktools/trunk/modules/samsa/build.xml (original)
> +++ harmony/enhanced/jdktools/trunk/modules/samsa/build.xml Sun Oct 26
> 15:56:01 2008
> @@ -78,6 +78,18 @@
> <copy file="${hy.samsa.exe}"
> tofile="${jdktools.deploy.dir}/bin/appletviewer${exe.suffix}" />
> <chmod file="${jdktools.deploy.dir}/bin/appletviewer${exe.suffix}"
> perm="ugo+x" />
>
> + <copy file="${hy.samsa.exe}"
> tofile="${jdktools.deploy.dir}/bin/keytool${exe.suffix}" />
> + <chmod file="${jdktools.deploy.dir}/bin/keytool${exe.suffix}"
> perm="ugo+x" />
> +
> + <copy file="${hy.samsa.exe}"
> tofile="${jdktools.deploy.dir}/bin/unpack200${exe.suffix}" />
> + <chmod file="${jdktools.deploy.dir}/bin/unpack200${exe.suffix}"
> perm="ugo+x" />
> +
> + <copy file="${hy.samsa.exe}"
> tofile="${jdktools.deploy.dir}/bin/pack200${exe.suffix}" />
> + <chmod file="${jdktools.deploy.dir}/bin/pack200${exe.suffix}"
> perm="ugo+x" />
> +
> + <copy file="${hy.samsa.exe}"
> tofile="${jdktools.deploy.dir}/bin/policytool${exe.suffix}" />
> + <chmod file="${jdktools.deploy.dir}/bin/policytool${exe.suffix}"
> perm="ugo+x" />
> +
> <copy file="${hy.samsa.exe}"
> tofile="${jretools.deploy.dir}/bin/keytool${exe.suffix}" />
> <chmod file="${jretools.deploy.dir}/bin/keytool${exe.suffix}"
> perm="ugo+x" />
>
>
> Modified:
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
> URL:
> http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c?rev=708057&r1=708056&r2=708057&view=diff
>
> ==============================================================================
> ---
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
> (original)
> +++
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
> Sun Oct 26 15:56:01 2008
> @@ -34,7 +34,6 @@
> #include <dlfcn.h>
> #endif
>
> -#define TOOL_JAR "tools.jar"
> #define JRE_CLASS_PREFIX "org.apache.harmony.jretools."
> #define JDK_CLASS_PREFIX "org.apache.harmony.tools."
> #define CLASS_POSTFIX ".Main"
> @@ -46,9 +45,15 @@
> #define JDK_WEXE_POSTFIX "\\jre\\bin\\javaw.exe"
> #define JRE_EXE_POSTFIX "\\bin\\java.exe"
> #define JRE_WEXE_POSTFIX "\\bin\\javaw.exe"
> -#define JRE_TEST_FILE "\\bin\\harmony.properties"
> +#define JRE_TEST_PREFIX "\\jre\\bin"
> #define LIB_POSTFIX "\\lib\\"
> +#define JRE_LIB_POSTFIX "\\jre\\lib\\"
> +#define DATA_POSTFIX "\\bin\\data\\"
> +#define JRE_DATA_POSTFIX "\\jre\\bin\\data\\"
> +#define TOOL_JAR "\\lib\\tools.jar"
> +#define JRE_TOOL_JAR "\\jre\\lib\\tools.jar"
> #define CLASSPATH_SEP ";"
> +#define EXE_SUFFIX ".exe"
> #else
> #define PATH_SEPARATOR_CHAR '/'
> #define PATH_SEPARATOR "/"
> @@ -56,9 +61,15 @@
> #define JDK_WEXE_POSTFIX "/jre/bin/javaw"
> #define JRE_EXE_POSTFIX "/bin/java"
> #define JRE_WEXE_POSTFIX "/bin/javaw"
> -#define JRE_TEST_FILE "/bin/harmony.properties"
> +#define JRE_TEST_PREFIX "/jre/bin"
> #define LIB_POSTFIX "/lib/"
> +#define JRE_LIB_POSTFIX "/jre/lib/"
> +#define DATA_POSTFIX "/bin/data/"
> +#define JRE_DATA_POSTFIX "/jre/bin/data/"
> +#define TOOL_JAR "/lib/tools.jar"
> +#define JRE_TOOL_JAR "/jre/lib/tools.jar"
> #define CLASSPATH_SEP ":"
> +#define EXE_SUFFIX ""
> #endif
>
> typedef struct ToolData {
> @@ -69,8 +80,9 @@
> char *cleanToolName(const char *);
> char *getExeDir();
> char *getRoot();
> -TOOLDATA *getToolData(const char *, const char *);
> -int isJRERoot(const char*);
> +TOOLDATA *getToolData(const char *, const char *, int toolType);
> +int getToolType(const char*, const char*);
> +char* jarFile(const char*, const char*);
>
> /**
> * main
> @@ -109,7 +121,7 @@
> TOOLDATA *pToolData = (TOOLDATA *) malloc(sizeof(TOOLDATA));
>
> int isJavaw = 0;
> - int isJRE = 0;
> + int toolType = 0; /* 0 = JRE tool, 1 = JDK tool, 2 = JRE tool in
> jdk/bin */
>
> /*
> * get the root and the construct invocation path for exe
> @@ -139,9 +151,9 @@
>
> isJavaw = strcmp(toolName, "javaw") == 0;
>
> - isJRE = isJRERoot(root);
> - if (isJRE == -1) {
> - fprintf(stderr, "Unable to determine type of JDK/JRE\n");
> + toolType = getToolType(root, toolName);
> + if (toolType == -1) {
> + fprintf(stderr, "Unable to determine type (JDK/JRE) of tool\n");
> return 1;
> }
>
> @@ -149,10 +161,9 @@
> * get the 'tool data' - right now, this is just the jars
> * specificly needed by this tool
> */
> - pToolData = getToolData(toolName, root);
> + pToolData = getToolData(toolName, root, toolType);
>
> if (pToolData == NULL) {
> - fprintf(stderr, "Unable to get tool data for %s", toolName);
> return 2;
> }
>
> @@ -164,9 +175,9 @@
> * If we're javaw then we need to javaw to command line
> */
> if (isJavaw) {
> - strcat(fullExePath, isJRE ? JRE_WEXE_POSTFIX : JDK_WEXE_POSTFIX);
> + strcat(fullExePath, toolType ? JDK_WEXE_POSTFIX :
> JRE_WEXE_POSTFIX);
> } else {
> - strcat(fullExePath, isJRE ? JRE_EXE_POSTFIX : JDK_EXE_POSTFIX);
> + strcat(fullExePath, toolType ? JDK_EXE_POSTFIX : JRE_EXE_POSTFIX);
> }
>
> /*
> @@ -190,8 +201,8 @@
> myArgv[newIndex++] = argv[i] + 2;
> }
> }
> -
> - size = (strlen(root) + strlen(LIB_POSTFIX)) * pToolData->numJars +
> +
> + size = strlen(root) * pToolData->numJars +
> strlen(CLASSPATH_SEP) * (pToolData->numJars - 1) + 1;
>
> for (i = 0; i < pToolData->numJars; i++) {
> @@ -201,13 +212,11 @@
> classpath = (char *) malloc(size * sizeof(char));
>
> strcpy(classpath, root);
> - strcat(classpath, LIB_POSTFIX);
> strcat(classpath, pToolData->jarList[0]);
>
> for (i = 1; i < pToolData->numJars; i++) {
> strcat(classpath, CLASSPATH_SEP);
> strcat(classpath, root);
> - strcat(classpath, LIB_POSTFIX);
> strcat(classpath, pToolData->jarList[i]);
> }
>
> @@ -215,10 +224,10 @@
> myArgv[newIndex++] = classpath;
>
> buffer =
> - (char *) malloc(strlen(isJRE ? JRE_CLASS_PREFIX :
> JDK_CLASS_PREFIX)
> + (char *) malloc(strlen(toolType==1 ? JDK_CLASS_PREFIX :
> JRE_CLASS_PREFIX)
> + strlen(toolName) + strlen(CLASS_POSTFIX) + 1);
>
> - strcpy(buffer, isJRE ? JRE_CLASS_PREFIX : JDK_CLASS_PREFIX);
> + strcpy(buffer, toolType==1 ? JDK_CLASS_PREFIX : JRE_CLASS_PREFIX);
> strcat(buffer, toolName);
> strcat(buffer, CLASS_POSTFIX);
>
> @@ -476,18 +485,20 @@
> }
>
> /***********************************************************************
> - * getToolData()
> + * getToolData(const char* toolName, const char* root, int toolType)
> *
> * Read the bin/data/<toolname>.dat file and
> * return the list of jars needed for this tool
> * Format :
> - * ToolJar = <jar1name>
> - * ToolJar = <jar2name>
> - * ToolJar = <jar3name>
> + * JDKToolJar = <jdkjar1name>
> + * JDKToolJar = <jdkjar2name>
> + * JREToolJar = <jrejar1name>
> + * JREToolJar = <jrejar2name>
> *
> + * Obviously, JRE tools should not reference any JDK jars.
> * If the data file doesn't exist, it will return tools.jar
> */
> -TOOLDATA *getToolData(const char *toolName, const char *root) {
> +TOOLDATA *getToolData(const char *toolName, const char *root, int
> toolType) {
>
> FILE *fp = NULL;
> char key[256];
> @@ -497,11 +508,14 @@
> TOOLDATA *pToolData = NULL;
>
> if (toolName == NULL || root == NULL) {
> + fprintf(stderr, "Unable to get tool data for %s", toolName);
> return NULL;
> }
>
> pToolData = (TOOLDATA *) malloc(sizeof(TOOLDATA));
> if (pToolData == NULL) {
> + fprintf(stderr,
> + "Unable to get tool data for %s: out of memory",
> toolName);
> return NULL;
> }
>
> @@ -510,57 +524,94 @@
> /*
> * assumes that the data files are in bin/data with a ".dat" extension
> */
> - temp = (char *) malloc(strlen(root) + strlen(PATH_SEPARATOR) +
> strlen("bin")
> - + strlen(PATH_SEPARATOR) + strlen("data") +
> strlen(PATH_SEPARATOR) + strlen(toolName)
> - + strlen(".dat") + 1);
> + temp = (char *) malloc(strlen(root)
> + + strlen(toolType==2
> + ? JRE_DATA_POSTFIX
> + : DATA_POSTFIX)
> + + strlen(toolName)
> + + strlen(".dat") + 1);
>
> if (temp == NULL) {
> + fprintf(stderr,
> + "Unable to get tool data for %s: out of memory",
> toolName);
> free(pToolData);
> return NULL;
> }
>
> strcpy(temp, root);
> - strcat(temp, PATH_SEPARATOR);
> - strcat(temp, "bin");
> - strcat(temp, PATH_SEPARATOR);
> - strcat(temp, "data");
> - strcat(temp, PATH_SEPARATOR);
> + strcat(temp, toolType==2 ? JRE_DATA_POSTFIX : DATA_POSTFIX);
> strcat(temp, toolName);
> strcat(temp, ".dat");
>
> //printf("tool data file = %s\n", temp);
>
> fp = fopen(temp, "r");
> + free(temp);
>
> if (fp) {
> - while (EOF != (count= fscanf(fp, "%s = %s\n", key, value))) {
> + while (EOF != (count = fscanf(fp, "%s = %s\n", key, value))) {
> // printf("count = %d : %s = %s\n", count, key, value);
> +
> + if (count != 2)
> + continue;
>
> - if (count == 2 && !strcmp("ToolJar", key)) {
> + if (!strcmp("JREToolJar", key)) {
> pToolData->jarList = (char **) realloc(pToolData->jarList,
> (pToolData->numJars + 1) * sizeof(char *));
> - pToolData->jarList[pToolData->numJars++] = strdup(value);
> + pToolData->jarList[pToolData->numJars] =
> + jarFile(toolType ? JRE_LIB_POSTFIX : LIB_POSTFIX,
> value);
> + if (pToolData->jarList[pToolData->numJars] == NULL) {
> + fprintf(stderr,
> + "Unable to get tool data for %s: out of
> memory",
> + toolName);
> + free(pToolData);
> + return NULL;
> + }
> + pToolData->numJars++;
> + } else if (!strcmp("JDKToolJar", key) ) {
> + if (toolType != 1) {
> + fprintf(stderr,
> + "Invalid tool data for %s: jre tool using jdk
> jar",
> + toolName);
> + free(pToolData);
> + return NULL;
> + }
> + pToolData->jarList = (char **) realloc(pToolData->jarList,
> (pToolData->numJars + 1) * sizeof(char *));
> + pToolData->jarList[pToolData->numJars] =
> + jarFile(LIB_POSTFIX, value);
> + if (pToolData->jarList[pToolData->numJars] == NULL) {
> + fprintf(stderr,
> + "Unable to get tool data for %s: out of
> memory",
> + toolName);
> + free(pToolData);
> + return NULL;
> + }
> + pToolData->numJars++;
> }
> }
>
> fclose(fp);
> - }
> - else {
> - pToolData->jarList = (char **) realloc(pToolData->jarList,
> (pToolData->numJars + 1) * sizeof(char *));
> - pToolData->jarList[pToolData->numJars++] = TOOL_JAR;
> + } else {
> + if (toolType == 0 || toolType == 1) {
> + pToolData->jarList = (char **) realloc(pToolData->jarList,
> (pToolData->numJars + 1) * sizeof(char *));
> + pToolData->jarList[pToolData->numJars++] = TOOL_JAR;
> + }
> + if (toolType) {
> + pToolData->jarList = (char **) realloc(pToolData->jarList,
> (pToolData->numJars + 1) * sizeof(char *));
> + pToolData->jarList[pToolData->numJars++] = JRE_TOOL_JAR;
> + }
> }
>
> - free(temp);
> -
> return pToolData;
> }
>
>
> /*****************************************************************
> - * isJRERoot(const char* root)
> + * getToolType(const char* root, const char* toolName)
> *
> - * returns 1 if root is the jre root
> + * returns 0 if this is a jre too1 in the jre/bin, 1 if this is a jdk
> + * tool in the jdk/bin, and 2 if this is a jre tool in the
> jdk/bin
> */
> -int isJRERoot(const char* root) {
> +int getToolType(const char* root, const char* toolName) {
>
> char *temp = NULL;
> #if defined(WIN32)
> @@ -570,23 +621,59 @@
> int rc;
> #endif
>
> - temp = (char *) malloc(strlen(root) + strlen(JRE_TEST_FILE) + 1);
> + temp = (char *) malloc(strlen(root) + strlen(JRE_TEST_PREFIX) +
> + 1 + strlen(toolName) + strlen(EXE_SUFFIX) +
> + 1);
>
> if (temp == NULL) {
> return -1;
> }
>
> strcpy(temp, root);
> - strcat(temp, JRE_TEST_FILE);
> + strcat(temp, JRE_TEST_PREFIX);
>
> #if defined(WIN32)
> result = GetFileAttributes((LPCTSTR) temp);
> + if (result == 0xFFFFFFFF) {
> + free(temp);
> + return 0;
> + }
> +
> +#else
> + rc = lstat(temp, &statbuf);
> + if (rc == -1) {
> + free(temp);
> + return 0;
> + }
> +#endif
> +
> + strcat(temp, PATH_SEPARATOR);
> + strcat(temp, toolName);
> +
> +#if defined(WIN32)
> + strcat(temp, EXE_SUFFIX);
> + result = GetFileAttributes((LPCTSTR) temp);
> free(temp);
> - return result == 0xFFFFFFFF ? 0 : 1;
> + return result == 0xFFFFFFFF ? 1 : 2;
> #else
> rc = lstat(temp, &statbuf);
> free(temp);
> - return rc == -1 ? 0 : 1;
> + return rc == -1 ? 1 : 2;
> #endif
> +
> }
>
> +/*****************************************************************
> + * lib_jar(const char* jarName)
> + *
> + * returns a pointer to the jar file name
> + */
> +char* jarFile(const char* path, const char* jarName) {
> + char* jarPath = (char*) malloc(strlen(path) + strlen(jarName) + 1);
> + if (jarPath == NULL) {
> + return NULL;
> + }
> + strcpy(jarPath, path);
> + strcat(jarPath, jarName);
> + return jarPath;
> +}
>
> Modified:
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/jartool.dat
> URL:
> http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/jartool.dat?rev=708057&r1=708056&r2=708057&view=diff
>
> ==============================================================================
> ---
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/jartool.dat
> (original)
> +++
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/jartool.dat
> Sun Oct 26 15:56:01 2008
> @@ -1,3 +1,3 @@
> -ToolJar = ecj_3.2.jar
> -ToolJar = tools.jar
> +JDKToolJar = ecj_3.2.jar
> +JDKToolJar = tools.jar
>
>
> Modified:
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/javac.dat
> URL:
> http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/javac.dat?rev=708057&r1=708056&r2=708057&view=diff
>
> ==============================================================================
> ---
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/javac.dat
> (original)
> +++
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/javac.dat
> Sun Oct 26 15:56:01 2008
> @@ -1,3 +1,3 @@
> -ToolJar = ecj_3.2.jar
> -ToolJar = tools.jar
> +JDKToolJar = ecj_3.2.jar
> +JDKToolJar = tools.jar
>
>
> Modified:
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/keysigner.dat
> URL:
> http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/keysigner.dat?rev=708057&r1=708056&r2=708057&view=diff
>
> ==============================================================================
> ---
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/keysigner.dat
> (original)
> +++
> harmony/enhanced/jdktools/trunk/modules/samsa/src/main/resources/data/keysigner.dat
> Sun Oct 26 15:56:01 2008
> @@ -1,3 +1,3 @@
> -ToolJar = ecj_3.2.jar
> -ToolJar = tools.jar
> +JDKToolJar = ecj_3.2.jar
> +JDKToolJar = tools.jar
>
>
>
>