[DSE-Dev] how to solve the compile error of libselinux for embedded decice

excaliur app excaliburcfan at gmail.com
Fri Apr 27 03:23:13 UTC 2012


Hi,
I want to integrate the selinux to my target system(a ARM11 board with
linux system) these days. I read the document in the website of
SEEdit(the website is
http://seedit.svn.sourceforge.net/svnroot/seedit/trunk/README.cross ).
The follow is my steps:
1.  I want use the arm-linux-gcc-3.4.1 to compile the libsepol,
libselinux and busybox.
2.  Compile the libsepol-2.1.4 successfully. Use the command:
	#make CC= /arm/3.4.1/bin/arm-linux-gcc-3.4.1
I put the / libsepol-2.1.4/src/libsepol.so and / libsepol-2.1.4/src/
libsepol.so.1 into /arm/3.4.1/lib.
3.  Compile the libselinux-2.1.9 by the command:
	#make ARCH=arm CC=/arm/3.4.1/bin/arm-linux-gcc-3.4.1
CFLAGS=-D__thread= EMBEDDED=y
But get the error below:
……
/arm/3.4.1/bin/arm-linux-gcc-3.4.1 -D__thread= -I../include
-I/usr/include  -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DDISABLE_AVC
-DDISABLE_BOOL -DDISABLE_SETRANS  -shared -o libselinux.so.1
callbacks.lo canonicalize_context.lo check_context.lo compute_av.lo
compute_create.lo compute_member.lo compute_relabel.lo compute_user.lo
context.lo deny_unknown.lo disable.lo enabled.lo fgetfilecon.lo
freeconary.lo freecon.lo fsetfilecon.lo get_context_list.lo
get_default_type.lo getenforce.lo getfilecon.lo get_initial_context.lo
getpeercon.lo init.lo is_customizable_type.lo label.lo label_db.lo
label_file.lo label_media.lo label_x.lo lgetfilecon.lo load_policy.lo
lsetfilecon.lo matchmediacon.lo matchpathcon.lo policyvers.lo
procattr.lo query_user_context.lo selinux_check_securetty_context.lo
selinux_config.lo sestatus.lo setenforce.lo setfilecon.lo
setrans_client.lo seusers.lo -ldl -L/usr/lib
-Wl,-soname,libselinux.so.1,-z,defs,-z,relro
/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
skipping incompatible /usr/lib/libdl.so when searching for -ldl
/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
skipping incompatible /usr/lib/libdl.a when searching for -ldl
/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
skipping incompatible /usr/lib/libc.so when searching for -lc
/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
skipping incompatible /usr/lib/libc.a when searching for -lc
/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
skipping incompatible /usr/lib/libc_nonshared.a when searching for
libc_nonshared.a
sestatus.lo(.text+0x68): In function `selinux_status_updated':
: undefined reference to `avc_netlink_check_nb'
sestatus.lo(.text+0x18c): In function `$a':
: undefined reference to `__sync_synchronize'
sestatus.lo(.text+0x214): In function `selinux_status_getenforce':
: undefined reference to `avc_netlink_check_nb'
sestatus.lo(.text+0x344): In function `selinux_status_policyload':
: undefined reference to `avc_netlink_check_nb'
sestatus.lo(.text+0x72c): In function `selinux_status_open':
: undefined reference to `avc_netlink_open'
sestatus.lo(.text+0x7ac): In function `selinux_status_open':
: undefined reference to `avc_netlink_acquire_fd'
sestatus.lo(.text+0x8ac): In function `selinux_status_close':
: undefined reference to `avc_netlink_release_fd'
sestatus.lo(.text+0x8b0): In function `selinux_status_close':
: undefined reference to `avc_netlink_close'
collect2: ld returned 1 exit status
make[1]: *** [libselinux.so.1] Error 1
make[1]: Leaving directory `/home/coon/new/libselinux-2.1.9/src'
make: *** [all] Error 2
      So i checked the source code in
/home/coon/new/libselinux-2.1.9/src, the functions appeared in the
error massage had been written in the file avc_internal.c, but i
didn’t found the declare of these functions in the file avc_internal.h
which be included by the file sestatus.c(the file that generate the
error).
      I tried to delete the call of these functions, and got no
errors. But I doubted that this way was wrong. Plese tell me how can i
solve this error correctly.



More information about the SELinux-devel mailing list