现在的位置: 首页 > 综合 > 正文

编译linux下的CVM出现的错误”_libc_wait”的解决

2013年10月21日 ⁄ 综合 ⁄ 共 2160字 ⁄ 字号 评论关闭
来源:http://forum.java.sun.com/thread.jspa?threadID=610934&tstart=120

=========
Q:
Any ideas on how to get past the linking errors one gets when compling cvm?

I'm getting the following error:

../../src/linux/native/java/lang/UNIXProcess_md.c:213:undefined reference to '__libc_wait'

the make command I'm using is as follows:

make CVM_DEBUG=true CVM_JAVABIN=/usr/java/jdk1.3.1_15/bin

I've gone into defs.mk to point CVM_GNU_TOOLS_PATH to /usr/bin

Thanks in advance for any help on this
=========
A:
Either compile and run against glibc < 2.2 or apply the following patch to src/linux/native/java/lang/UNIXProcess_md.c

34,53c34
<
< /* following lines Hacked by Kent Hulick based on
< * ftp://people.redhat.com/drepper/libcwait.c
< * fixes a broken calls to a removed glibc function:*/

< #include <errno.h>
< #include <sys/syscall.h>
< pid_t __libc_wait (int *status)
< {
< int res;
< asm volatile ("pushl %%ebx/n/t"
< "movl %2, %%ebx/n/t"
< "movl %1, %%eax/n/t"
< "int $0x80/n/t"
< "popl %%ebx"
< : "=a" (res)
< : "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
< "S" (0));
< return res;
< }
<
---
> extern pid_t __libc_wait(int *status);

=========
Q:
Hi,

I am facing this same error while building the CDC for PowerPC-Linux.

Below is the log

../../build/linux-powerpc/obj/UNIXProcess_md.o(.text+0x528): In function `sigchld_handler':
../../src/linux/native/java/lang/UNIXProcess_md.c:213: undefined reference to `__libc_wait'
collect2: ld returned 1 exit status
make: *** [../../build/linux-powerpc/bin/cvm] Error 1

Now, I have to apply the below said patch, but for PowerPC .. Is there anybody who can convert this function to powerPC assembly for me? I am absolutely unaware of PowerPC assembly and I don't have th time to sit and start learning it ....

Thanks in advance

Ganesh
=========
A:
This a fix for both PowerPC and i686 CPUs:

diff -r cdcfoundation/src/linux/native/java/lang/UNIXProcess_md.c cdcfoundation-org/src/linux/native/java/lang/UNIXProcess_md.c
34,48c34
< //extern pid_t __libc_wait(int *status);
<
< // Fix for latest glib version which doesn't include __libc_wait
< // Hacked by Yoav Artzi based on code from GNU glib-2.1.2
< //extern pid_t __libc_wait(int *status);
<
< /* Wait for a child to die. When one does, put its status in *STAT_LOC
< and return its process ID. For errors, return (pid_t) -1. */
< #include <sys/wait.h>
< __pid_t
< __libc_wait (__WAIT_STATUS_DEFN stat_loc)
< {
< return __waitpid (WAIT_ANY, (int *) stat_loc, 0);
< }
<
---
> extern pid_t __libc_wait(int *status);

抱歉!评论已关闭.