OSSP CVS Repository

ossp - Ticket #111
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 111: unable to build ossp js with file object

[root@hyperion js-1.6.20060724]# ./configure --prefix=/var/tmp/js-tmp
Configuring OSSP js (Mozilla JavaScript Engine), version 1.6.20060724
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether compiler option(s) -DNDEBUG work... yes
checking whether compiler option(s) -pipe work... yes
checking for compilation debug mode... disabled
checking for va_copy() function... yes
checking for gethostname in -lnsl... yes
checking for accept in -lsocket... no
checking for floor in -lm... yes
checking whether to build the run-time engine with JavaScript features only... (cached) no
checking whether to build command line interface with line editing support... (cached) no
checking whether to build Perl-to-JS and JS-to-Perl bindings... (cached) no
checking for perl... /usr/bin/perl
checking whether to build with the File object... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
configure: creating ./config.status
config.status: creating Makefile
config.status: creating js.pc
config.status: creating js-config.sh
config.status: creating src/perlconnect/Makefile.PL
config.status: creating config.h
[root@hyperion js-1.6.20060724]# make
gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -o jscpucfg.o -c src/jscpucfg.c
mkdir .libs
gcc -o jscpucfg jscpucfg.o  -lm -lnsl
rm -f src/jsautocfg.h src/jsautocfg.h
./libtool --mode=execute ./jscpucfg >src/jsautocfg.h
mkdir src/.libs
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsapi.c  -fPIC -DPIC -o src/.libs/jsapi.o
src/jsapi.c: In function `JS_EvaluateScript':
src/jsapi.c:4071: warning: passing arg 3 of `js_InflateString' from incompatible pointer type
src/jsapi.c: In function `JS_EvaluateScriptForPrincipals':
src/jsapi.c:4090: warning: passing arg 3 of `js_InflateString' from incompatible pointer type
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsapi.c -o src/jsapi.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsarena.c  -fPIC -DPIC -o src/.libs/jsarena.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsarena.c -o src/jsarena.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsarray.c  -fPIC -DPIC -o src/.libs/jsarray.o
src/jsarray.c: In function `array_sort':
src/jsarray.c:931: warning: comparison is always false due to limited range of data type
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsarray.c -o src/jsarray.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsatom.c  -fPIC -DPIC -o src/.libs/jsatom.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsatom.c -o src/jsatom.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsbool.c  -fPIC -DPIC -o src/.libs/jsbool.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsbool.c -o src/jsbool.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jscntxt.c  -fPIC -DPIC -o src/.libs/jscntxt.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jscntxt.c -o src/jscntxt.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdate.c  -fPIC -DPIC -o src/.libs/jsdate.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdate.c -o src/jsdate.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdbgapi.c  -fPIC -DPIC -o src/.libs/jsdbgapi.o
src/jsdbgapi.c: In function `JS_EvaluateInStackFrame':
src/jsdbgapi.c:943: warning: passing arg 3 of `js_InflateString' from incompatible pointer type
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdbgapi.c -o src/jsdbgapi.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdhash.c  -fPIC -DPIC -o src/.libs/jsdhash.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdhash.c -o src/jsdhash.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdtoa.c  -fPIC -DPIC -o src/.libs/jsdtoa.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsdtoa.c -o src/jsdtoa.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsemit.c  -fPIC -DPIC -o src/.libs/jsemit.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsemit.c -o src/jsemit.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsexn.c  -fPIC -DPIC -o src/.libs/jsexn.o
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsexn.c -o src/jsexn.o >/dev/null 2>&1
 gcc -DOSSP -DXP_UNIX -DEXPORT_JS_API -DJS_HAS_FILE_OBJECT -DHAVE_CONFIG_H -Isrc -O2 -DNDEBUG -pipe -c src/jsfile.c  -fPIC -DPIC -o src/.libs/jsfile.o
src/jsfile.c: In function `file_getProperty':
src/jsfile.c:2678: error: structure has no member named `st_birthtime'
make: *** [src/jsfile.lo] Error 1
[Append remarks]

Remarks:

Ticket #110 is a dup of this !

[root@hyperion js-1.6.20060724]# uname -a
Linux hyperion.lnwm 2.6.9-22.0.2.ELsmp #1 SMP Tue Jan 17 06:12:06 CST 2006 x86_64 x86_64 x86_64 GNU/Linux

[root@hyperion js-1.6.20060724]# cat /etc/redhat-release
CentOS release 4.3 (Final)

relevant installed packages:
binutils-2.15.92.0.2-18
cpp-3.4.5-2
gcc-3.4.5-2
gcc-c++-3.4.5-2
glibc-2.3.4-2.19
glibc-common-2.3.4-2.19
glibc-devel-2.3.4-2.19
glibc-headers-2.3.4-2.19
glibc-kernheaders-2.4-9.1.98.EL
libgcc-3.4.5-2
libstdc++-3.4.5-2
libstdc++-devel-3.4.5-2


Further inspection yields:

code around line 2678 looks like :
----------------
#ifdef OSSP
        if (file->isOpen
            ? fstat(fileno(file->handle), &info) != 0
            : stat(file->path, &info) != 0) {
            JS_ReportErrorNumber(cx, JSFile_GetErrorMessage, NULL,
                                 JSFILEMSG_CANNOT_ACCESS_FILE_STATUS, file->path);
            goto out;
        }

        t = (time_t)(info.st_birthtime);
        tm = localtime(&t);
        *vp = OBJECT_TO_JSVAL(js_NewDateObject(cx, tm->tm_year + 1900,
                                    tm->tm_mon + 1,
                                    tm->tm_mday,
                                    tm->tm_hour,
                                    tm->tm_min,
                                    tm->tm_sec));
#else
----------------

"struct stat" is defined in /usr/include/bits/stat.h without a st_birthtime member.

also http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/src/md/unix/unix.c#2565 contains:

2565 static int _MD_convert_stat_to_fileinfo(
2566     const struct stat *sb,
2567     PRFileInfo *info)
2568 {
2569     if (S_IFREG & sb->st_mode)
2570         info->type = PR_FILE_FILE;
2571     else if (S_IFDIR & sb->st_mode)
2572         info->type = PR_FILE_DIRECTORY;
2573     else
2574         info->type = PR_FILE_OTHER;
2575 
2576 #if defined(_PR_HAVE_LARGE_OFF_T)
2577     if (0x7fffffffL < sb->st_size)
2578     {
2579         PR_SetError(PR_FILE_TOO_BIG_ERROR, 0);
2580         return -1;
2581     }
2582 #endif /* defined(_PR_HAVE_LARGE_OFF_T) */
2583     info->size = sb->st_size;
2584 
2585     _MD_set_fileinfo_times(sb, info);
2586     return 0;
2587 }  /* _MD_convert_stat_to_fileinfo */


and http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/src/md/unix/unix.c#2381 contains:

2381 static void _MD_set_fileinfo_times(
2382     const struct stat *sb,
2383     PRFileInfo *info)
2384 {
2385     PRInt64 us, s2us;
2386 
2387     LL_I2L(s2us, PR_USEC_PER_SEC);
2388     LL_I2L(info->modifyTime, sb->st_mtim.tv_sec);
2389     LL_MUL(info->modifyTime, info->modifyTime, s2us);
2390     LL_I2L(us, sb->st_mtim.tv_nsec / 1000);
2391     LL_ADD(info->modifyTime, info->modifyTime, us);
2392     LL_I2L(info->creationTime, sb->st_ctim.tv_sec);
2393     LL_MUL(info->creationTime, info->creationTime, s2us);
2394     LL_I2L(us, sb->st_ctim.tv_nsec / 1000);
2395     LL_ADD(info->creationTime, info->creationTime, us);
2396 }

which means that the code fragment should look like:
----------------
#ifdef OSSP
        if (file->isOpen
            ? fstat(fileno(file->handle), &info) != 0
            : stat(file->path, &info) != 0) {
            JS_ReportErrorNumber(cx, JSFile_GetErrorMessage, NULL,
                                 JSFILEMSG_CANNOT_ACCESS_FILE_STATUS, file->path);
            goto out;
        }

        t = (time_t)(info.st_ctime);
        tm = localtime(&t);
        *vp = OBJECT_TO_JSVAL(js_NewDateObject(cx, tm->tm_year + 1900,
                                    tm->tm_mon + 1,
                                    tm->tm_mday,
                                    tm->tm_hour,
                                    tm->tm_min,
                                    tm->tm_sec));
#else
----------------


i also googled up a configure.ac alternative like:
AC_CHECK_MEMBERS([struct stat.st_birthtime])

a sidenote:

shouldn't .libjs.so.0.0.0 be named .libs/libjs.so.1.6.0 ?
--
i can be reached via: alfred.reibenschuh@it-austria.com

[Append remarks]

Properties:

Type: code           Version: 1.6.20060724 
Status: fixed          Created: 2006-Jul-25 11:21
Severity:          Last Change: 2006-Jul-29 11:15
Priority:          Subsystem:  
Assigned To: rse           Derived From:  
Creator: anonymous 

Related Check-ins:

2006-Jul-29 11:15 Check-in [5537]: use ctime (By rse)
2006-Jul-29 11:14 Check-in [5536]: Changed GNU libtool shared library versioning from 0:0 to 1:6 (By rse)
2006-Jul-29 11:08 Check-in [5535]: Increase portability by gracefully downgrading the stat(2) use of st_birthtime to st_birthtimensec or even st_mtime. (By rse)

CVSTrac 2.0.1