[BusyBox 0001239]: BusyBox-1.{3, 4} does not compile with SElinux enabled.

bugs at busybox.net bugs at busybox.net
Sun Mar 4 23:35:11 UTC 2007

A NOTE has been added to this issue. 
Reported By:                Xake
Assigned To:                BusyBox
Project:                    BusyBox
Issue ID:                   1239
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Date Submitted:             02-27-2007 01:38 PST
Last Modified:              03-04-2007 15:35 PST
Summary:                    BusyBox-1.{3,4} does not compile with SElinux
This bug was first encountered with gentoo (see link
http://bugs.gentoo.org/show_bug.cgi?id=160879 for more info).

make defconfig && make works right.
But enabling SELinux support and it fails with the following error (seems
like it does not link agains selinux as it should):
  LINK    busybox_unstripped
coreutils/lib.a(id.o): In function `id_main':
id.c:(.text.id_main+0x135): undefined reference to `is_selinux_enabled'
id.c:(.text.id_main+0x145): undefined reference to `getcon'
id.c:(.text.id_main+0x17a): undefined reference to `freecon'
coreutils/lib.a(ls.o): In function `my_stat':
ls.c:(.text.my_stat+0x35): undefined reference to `is_selinux_enabled'
ls.c:(.text.my_stat+0x44): undefined reference to `getfilecon'
ls.c:(.text.my_stat+0x58): undefined reference to `is_selinux_enabled'
ls.c:(.text.my_stat+0x67): undefined reference to `lgetfilecon'
coreutils/lib.a(ls.o): In function `showfiles':
ls.c:(.text.showfiles+0x46b): undefined reference to `freecon'
init/lib.a(init.o): In function `init_main':
init.c:(.text.init_main+0x412): undefined reference to
loginutils/lib.a(login.o): In function `login_main':
login.c:(.text.login_main+0x5b6): undefined reference to
login.c:(.text.login_main+0x5d4): undefined reference to
login.c:(.text.login_main+0x600): undefined reference to `getfilecon'
login.c:(.text.login_main+0x629): undefined reference to
login.c:(.text.login_main+0x649): undefined reference to `setfilecon'
procps/lib.a(ps.o): In function `ps_main':
ps.c:(.text.ps_main+0x9e): undefined reference to `is_selinux_enabled'
ps.c:(.text.ps_main+0xd4): undefined reference to `is_selinux_enabled'
ps.c:(.text.ps_main+0xe5): undefined reference to `getpidcon'
ps.c:(.text.ps_main+0x11b): undefined reference to `freecon'
libbb/lib.a(run_shell.o): In function `set_current_security_context':
run_shell.c:(.text.set_current_security_context+0x2c): undefined reference
to `freecon'
libbb/lib.a(run_shell.o): In function `run_shell':
run_shell.c:(.text.run_shell+0xce): undefined reference to `setexeccon'
run_shell.c:(.text.run_shell+0xde): undefined reference to `freecon'
libbb/lib.a(run_shell.o): In function `renew_current_security_context':
run_shell.c:(.text.renew_current_security_context+0x27): undefined
reference to `freecon'
run_shell.c:(.text.renew_current_security_context+0x34): undefined
reference to `getcon'
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1

However doing:
LDFLAGS="-lselinux" make
finishes fine

 vda - 02-27-07 10:20  
Very strange. It should link against selinux libs by adding these flags:

ifeq ($(CONFIG_SELINUX),y)
LDFLAGS += -lselinux -lsepol

Unfortunately I have no selinux libs on my system to test it.

Try adding this line:

 CFLAGS          := $(CFLAGS)
 AFLAGS          := $(AFLAGS)
+LDFLAGS         := $(LDFLAGS)

does this work? 

 jpo - 03-04-07 15:35  
I'm seeing exactly the same problems in Fedora Core 6 system (busybox 1.3.2
and 1.4.1).


   ifeq ($(CONFIG_SELINUX),y)
   LDFLAGS += -lselinux

to the file Makefile.flags fixes the problem in busybox 1.4.1 but not in
busybox 1.3.2. Busybox 1.3.2 still fails but now with a different error:

      LD      applets/built-in.o
    ld: cannot find -lselinux 
    make[1]: *** [applets/built-in.o] Error 1
    make: *** [applets] Error 2 

Issue History 
Date Modified   Username       Field                    Change               
02-27-07 01:38  Xake           New Issue                                    
02-27-07 01:38  Xake           Status                   new => assigned     
02-27-07 01:38  Xake           Assigned To               => BusyBox         
02-27-07 10:20  vda            Note Added: 0002190                          
03-04-07 15:35  jpo            Note Added: 0002202                          

More information about the busybox-cvs mailing list