On Wednesday 03 February 2010, 17:07:26 sf...@users.sourceforge.net wrote:
> Hi,
>
> "Hans-Peter Jansen":
> > trying to build aufs2-util in an openSUSE 11.1/i586 build environment
> > leads to:
> >
> > make -C libau all
> > make[1]: Entering directory
> > `/usr/src/packages/BUILD/aufs2-standalone.tree-27-20100111/aufs2-util-s
> >tandalone.tree-27-20100111/libau' gcc -I/usr/src/linux/include
> > -I/usr/src/packages/BUILD/aufs2-standalone.tree-27-20100111/aufs2-util-
> >standalone.tree-27-20100111/../include
> > -I/usr/src/packages/BUILD/aufs2-standalone.tree-27-20100111/aufs2-util-
> >standalone.tree-27-20100111/libau   -c -o libau.o libau.c
>
> That is weird.
> As you can see aufs2-util.git/libau/Makefile, there are some flags.
>
> ----------------------------------------------------------------------
> rdu64.o: CFLAGS += -DRdu64
>
> ${LibSoObj}: CFLAGS += -fPIC -DNDEBUG -D_REENTRANT -I.
> ----------------------------------------------------------------------

Hmm, I wonder, why they're not picked up. Here's how I build it:

make ARCH=%_target_cpu KDIR=$PWD/source CC=gcc \
     CFLAGS="-I/usr/src/linux/include -I$PWD/source/include -I$PWD/libau 
${RPM_OPT_FLAGS}"

> They are not shown in your build log.
> Did you modify the flags or compile rule (pattern in make)?
>
> > Also, the docs state, that libau should be installed explicitely, with
> > make install_ulib, but the Makefile disagrees. I'm using extensive sed
> > trickery to get rid of it, but I think it's worth to eliminate these
> > issues.
> >
> > From my aufs2.spec:
> > # disable building libau (fails in link stage with multiple definitions
> > of `readdir') # don't try to set ownership on install (may fail with
> > 'osc build')
>
> Currently I guess the cause of your failure is CFLAGS, but it may be
> worth to keep libau from "make all." Why did I put it in "all"? Because
> I'd recommend users to use it. :-)

I'm willing to reenable it again, if we're able to resolve the build glitch.

> I don't know why you stop setting owner and group.

Because, I build in a build environment as a pseudo root user, and that 
env is missing debian's fake root functionality.. Generally, it's not 
needed, as rpmbuild takes care of that (e.g. you need to tell rpmbuild 
to use different user/group for certain files..). That's what the 
%defattr(-,root,root) 
in rpm specfiles is about..

BTW, I had a hard time generating a kernel module build of aufs2, until I 
finally noticed, that you redirect M to M=${CURDIR}/fs/aufs. 

The whole story is further complicated by the fact, that you usually build 
kernel modules for a bunch of different kernel flavors. I've kept the %prep 
section in order to give you a chance getting an idea what happens in %build 
and %install. 

%prep
%setup -q -n %{name}-standalone.tree-27-%{version} -a 1
%patch1
%patch2 -p1
%patch3
# disable building libau (fails in link stage with multiple definitions of 
`readdir')
# don't try to set ownership on install (may fail with 'osc build')
sed -i '/^all:/,/^$/{
/^      /d
}
s/ install_ulib$//
s/install -o root -g root -p/install -p/
' %{name}-util-standalone.tree-27-%{version}/Makefile
# move everything into source/
set -- *
mkdir source
mv "$@" source/
# utils back to .
mv source/%{name}-util-standalone.tree-27-%{version}/* .
rmdir source/%{name}-util-standalone.tree-27-%{version}
mv README README.utils
# doc into .
pushd source
mv README ChangeLog design Documentation ..
cp fs/aufs/Kconfig config.mk ..
popd
mkdir obj

%build
export EXTRA_CFLAGS="${RPM_OPT_FLAGS//-fstack-protector/}"
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r source obj/$flavor
    pushd obj/$flavor
    make KDIR=/usr/src/linux-obj/%_target_cpu/$flavor M=obj/$flavor
    popd
done
make ARCH=%_target_cpu KDIR=$PWD/source CC=gcc \
     CFLAGS="-I/usr/src/linux/include -I$PWD/source/include -I$PWD/libau 
${RPM_OPT_FLAGS}"

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR="updates"
for flavor in %flavors_to_build; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install 
M=$PWD/obj/$flavor/fs/aufs V=1
done
make install DESTDIR=$RPM_BUILD_ROOT


Note, how M differ in %build and %install.

While this sounds complicated, there's a major upside on all this, the 
result is going to be available for the public here:

http://download.opensuse.org/repositories/home:/frispete:/aufs2/

Now testing...

Pete

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

Reply via email to