[uClibc] Getting SEGSEGV error with shared library.

Sadiq Shaikh sadiq.shaikh at analog.com
Tue Aug 10 01:21:53 UTC 2004


HI All,


Application using uClibc-0.9.26 shared library giving SIGSEGV fault.

1) When executed application with newly downloaded uClibc-0.9.26, we get
segmentation fault.
2) Is it uClibc-0.9.26 build problem ?
3) How to make application with shared library(uClibc-0.9.26) work ?
4) Is anything missed in uClibc build procedure and installation ?

problem Summary:---
We have a mips-board on which we have a working 2.4.18 kernel running
along with Network 

Applications. In this build the uClibc version is 0.9.8 and all libraires
are statically 

linked. We are coss-compiling the image and uploading the build to the
board.

Now, we are trying to build the latest uClibc 0.9.26 version and use
shared library on the 

mips-board.

------------8<--------------8<---------8<------------
Here is the procedure we have followed.

Downloaded the 0.9.26 code.
configured the uClibc code with 

Following installation options
	SHARED_LIB_LOADER_PREFIX="/lib"
	RUNTIME_PREFIX="mips-linux-uclibc"
	DEVEL_PREFIX="mips-linux-uclibc/usr"

Following General Library Settings
	DOPIC=y
	HAVE_SHARED=y
	BUILD_UCLIBC_LDSO=y
	LDSO_LDD_SUPPORT=y
	UCLIBC_HAS_THREADS=y
	UCLIBC_HAS_LFS=y
	MALLOC=y
	UCLIBC_DYNAMIC_ATEXIT=y
	HAS_SHADOW=y
	UNIX98PTY_ONLY=y
	ASSUME_DEVPTS=y

Follwing Target Architecture Features and Options
	HAVE_ELF=y
	TARGET_ARCH="mips"
	ARCH_CFLAGS="-mno-split-addresses"
	CONFIG_MIPS_ISA_1=y

The cross compilation is done and we uploaded the build. 
In /lib directory we placed all library file i.e *.so files.

----------8<--------------8<---------------8<-------------

We created a small library called libprint.so which prints a string using
printf.
libprint.c:
	#include <stdio.h>
	int myprint()
	{
		printf("HAIIII\r\n");
		return 0;
	}


Then we wrote a program (demo.c) which invoke the libprint.so library
function.
demo.c:
	int main()
	{
		myprint();
		return 0;
	}
We compiled the demo.c using shared linking to libprint.so.
----------8<--------------8<---------------8<--------------
ldcondfig -p output follwing message

# ldconfig -p
22 libs found in cache `/etc/ld.so.cache' (version 1.7.0)
        libutil.so.0 (unknown) => /lib/libutil.so.0
        libutil.so.0 (unknown) => /lib/libutil.so.0
        libresolv.so.0 (unknown) => /lib/libresolv.so.0
        libresolv.so.0 (unknown) => /lib/libresolv.so.0
        libpthread.so.0 (unknown) => /lib/libpthread.so.0
        libpthread.so.0 (unknown) => /lib/libpthread.so.0
        libprint.so.0 (ELF) => /lib/libprint.so.0
        libprint.so.0 (ELF) => /lib/libprint.so.0
        libnsl.so.0 (unknown) => /lib/libnsl.so.0
        libnsl.so.0 (unknown) => /lib/libnsl.so.0
        libm.so.0 (unknown) => /lib/libm.so.0
        libm.so.0 (unknown) => /lib/libm.so.0
        libdl.so.0 (unknown) => /lib/libdl.so.0
        libdl.so.0 (unknown) => /lib/libdl.so.0
        libcrypt.so.0 (unknown) => /lib/libcrypt.so.0
        libcrypt.so.0 (unknown) => /lib/libcrypt.so.0
        libc.so.0 (unknown) => /lib/libc.so.0
        libc.so.0 (unknown) => /lib/libc.so.0
        ld.so.1 (ELF) => /lib/ld.so.1
        ld.so.1 (ELF) => /lib/ld.so.1
        ld-uClibc.so.0 (ELF) => /lib/ld-uClibc.so.0
        ld-uClibc.so.0 (ELF) => /lib/ld-uClibc.so.0
------------8<--------------8<--------------8<----------------

ldd output at prompt is 

#ldd demo
        libc.so.0 => /lib/libc.so.0 (0x00000000)
        libprint.so.0 => /lib/libprint.so.0 (0x00000000)
        /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)

---------------8<--------------8<-----------8<-----------------
readelf output at prompt is 

# readelf demo
Type:           EXEC (Executable file)
Machine:        MIPS R3000 big-endian
Class:          ELF32
Data:           2's complement, big endian
Version:        1 (current)
OS/ABI:         UNIX - System V
ABI Version:    0
Interpreter:    /lib/ld.so.1
Dependancies:
        libc.so.0
        libprint.so.0
----------8<--------------8<---------------8<------------------


Now when we try to execute the binary demo it gives SIGSEGV error.

Devlopment Environment:
	Platform: MIPS
	Linux version: 2.4.18
	Cross-compiler: mips-linux-gcc etc..
-------------8<--------------8<-------------8<------------------

Thanks in Advanced!!!!
-sadiq.	




More information about the uClibc mailing list