On 09/22/2011 11:48 AM, Pauli, David, MU wrote:

Hey,

I commented 2 lines in cap_flag.c:

From (line 24)

# [...]

#if (raised && good_cap_t(cap_d) && value >= 0 && value < __CAP_BITS

# && set >= 0 && set < NUMBER_OF_CAP_SETS) {

# [...]

To

# [...]

#if (raised && good_cap_t(cap_d) && value >= 0 //&& value < __CAP_BITS

# && set >= 0 && set < NUMBER_OF_CAP_SETS) {

# [...]

And (line 48)

# [...]

#if (good_cap_t(cap_d) && no_values > 0 && no_values <= __CAP_BITS

# && (set >= 0) && (set < NUMBER_OF_CAP_SETS)

# [...]

To

# [...]

#if (good_cap_t(cap_d) && no_values > 0 //&& no_values <= __CAP_BITS

# && (set >= 0) && (set < NUMBER_OF_CAP_SETS)

# [...]

Now the error with __CAP_BITS disappeared, but another error cames up:

# $ ./ltib -m scbuild -p libcap.spec

#

# Processing: libcap

# ====================

# Build path taken because: build key set, no prebuilt rpm,

#

# rpmbuild --dbpath /usr/LTIB/ltib-mpc8313erdb-20081222/rootfs//var/lib/rpm --target ppc --define '_unpackaged_files_terminate_build 0' --define '_target_cpu ppc' --define '__strip strip' --define '_topdir /usr/LTIB/ltib-mpc8313erdb-20081222/rpm' --define '_prefix /usr' --define '_tmppath /usr/LTIB/ltib-mpc8313erdb-20081222/tmp' --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bc --short-circuit /usr/LTIB/ltib-mpc8313erdb-20081222/dist/lfs-5.1/libcap/libcap.spec

# Building target platforms: ppc

# Building for target ppc

# Executing(%build): /bin/sh -e /usr/LTIB/ltib-mpc8313erdb-20081222/tmp/rpm-tmp.3677

# + umask 022

# + cd /usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD

# + cd libcap-2.22

# + make

# make -C libcap all

# make[1]: Entering directory `/usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap'

# => making cap_names.list.h from /usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap/../libcap/include/linux/capability.h

# perl -e 'while ($l=<>) { if ($l =~ /^\#define[ \t](CAP[_A-Z]+)[ \t]+([0-9]+)\s+$/) { $tok=$1; $val=$2; $tok =~ tr/A-Z/a-z/; print "{\"$tok\",$val},\n"; } }' /usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap/../libcap/include/linux/capability.h | fgrep -v 0x > cap_names.list.h

# gcc -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -I/usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap/../libcap/include -I/usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap/../libcap/include _makenames.c -o _makenames

#./_makenames > cap_names.h

# /bin/sh: ./_makenames: cannot execute binary file

# make[1]: *** [cap_names.h] Error 126

# make[1]: Leaving directory `/usr/LTIB/ltib-mpc8313erdb-20081222/rpm/BUILD/libcap-2.22/libcap'

# make: *** [all] Error 2

# error: Bad exit status from /usr/LTIB/ltib-mpc8313erdb-20081222/tmp/rpm-tmp.3677 (%build)

#

#

# RPM build errors:

# Bad exit status from /usr/LTIB/ltib-mpc8313erdb-20081222/tmp/rpm-tmp.3677 (%build)

# Build time for libcap: 0 seconds

#

# Failed building libcap

#

#

# f_scbuild() returned an error, exiting

# traceback:

#  main:501

#

# Exiting on error or interrupt

What is wrong now =(

So long, David


The problem is that _makenames is being built with "gcc", but when executing the .spec file (and resultant make), the toolchain has been "spoofed" where /opt/ltib/usr/spoof is in the path; look in /opt/ltib/usr/spoof and you'll see the tools that are spoofed such that they point to the cross-toolchain instead of the native toolchain.

If you "file rpm/BUILD/libca-2.2/libcap/_makenames", you'll see its a cross-compiled executabe, not compiled to run on the host. Since _makenames is a utility used int he build process, you want it compiled with the host compiler....

If you modify the libcap.spec file to use "make HOSTCC="$BUILDCC ..." and modify rpm/BUILD/libcap-2.2/libcap/Makefile to compile/link _makenames using $(HOSTCC) instead of $(CC), then I think it will get past this problem (since that will build it with the host compiler, not the cross compiler). Don't be surprised if this isn't the only place your libcap-2.2 build breaks due to not being "cross-compilation friendly"...


--
Peter Barada
[email protected]

_______________________________________________
LTIB home page: http://ltib.org

Ltib mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/ltib

Reply via email to