On 03/27/2012 07:48 PM, Nerijus Baliunas wrote:
> Hello,
>
> I try to build it with:
> rpmbuild --define "build_postfix 1" --define "build_user smmsp" -tb
> milter-greylist-4.2.7.tgz
> but it fails:
>
> gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -Wall -DUSE_POSTFIX -D_BSD_SOURCE -I. -I.
> -c -o macro.o macro.c
> bison -y -p`echo conf_yacc.c|sed 's/^\([^_]\{1,\}_\).*$/\1/'` conf_yacc.y
> flex -oconf_lex.c conf_lex.l
> bison -y -p`echo dump_yacc.c|sed 's/^\([^_]\{1,\}_\).*$/\1/'` dump_yacc.y
> mv y.tab.c dump_yacc.c
> flex -odump_lex.c dump_lex.l
> gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -Wall -DUSE_POSTFIX -D_BSD_SOURCE -I. -I.
> -c -o conf.o conf.c
> mv y.tab.c conf_yacc.c
> mv: nepavyksta patikrinti \ufffdy.tab.c\ufffd: No such file or directory
>
> I think it uses make -j2, and 2nd bison overwrites the 1st bison's
> output (y.tab.c).
> It builds if I remove %{?_smp_mflags} from the spec file:
>
> --- milter-greylist.spec.orig 2012-03-28 03:30:25.000000000 +0300
> +++ milter-greylist.spec 2012-03-28 03:41:28.000000000 +0300
> @@ -109,7 +109,7 @@
> --with-libGeoIP \
> %endif
>
> -%{__make} %{?_smp_mflags}
> +%{__make}
>
>
> %install
>
> Does anyone know how to deal with such situations "oficially"? Or is it
> OK to just remove %{?_smp_mflags}?
>
> Regards,
> Nerijus
I've just run into something similar. I'm trying to build an RPM for
RHEL6 x86_64. I ran:
rpmbuild --define "build_sendmail 1" -tb \
../SOURCES/milter-greylist-4.3.9.tgz
I also get:
flex -oconf_lex.c conf_lex.l
bison -y -p`echo dump_yacc.c|sed 's/^\([^_]\{1,\}_\).*$/\1/'` dump_yacc.y
milter-greylist.c:2493: warning: 'last' may be used uninitialized in
this function
mv y.tab.c dump_yacc.c
flex -odump_lex.c dump_lex.l
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall
-DHAVE_DATA_CALLBACK -DCONFFILE=\"/etc/mail/greylist.conf\"
-DDUMPFILE=\"/var/milter-greylist/greylist.db\" -D_BSD_SOURCE -I. -I.
-c -o conf.o conf.c
mv y.tab.c conf_yacc.c
mv: cannot stat `y.tab.c': No such file or directory
make: *** [conf_yacc.c] Error 1
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.nRIRgr (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.nRIRgr (%build)
I took your advice and:
[tcameron@spamcatcher SPECS]$ diff -u milter-greylist.spec
milter-greylist.spec.orig
--- milter-greylist.spec 2012-05-05 22:59:08.896982213 -0500
+++ milter-greylist.spec.orig 2012-05-05 22:58:59.554233864 -0500
@@ -109,7 +109,7 @@
--with-libGeoIP \
%endif
-%{__make}
+%{__make} %{?_smp_mflags}
But now when I try to build it, I get:
test -f
/home/tcameron/rpmbuild/BUILDROOT/milter-greylist-4.3.9-1.x86_64/etc/mail/greylist.conf
-o \
-f
/home/tcameron/rpmbuild/BUILDROOT/milter-greylist-4.3.9-1.x86_64/etc/mail/greylist.except
|| \
/usr/bin/install -c -m 644 ./greylist.conf
/home/tcameron/rpmbuild/BUILDROOT/milter-greylist-4.3.9-1.x86_64/etc/mail/greylist.conf
/usr/bin/install -c -d -m 755 -o root
/home/tcameron/rpmbuild/BUILDROOT/milter-greylist-4.3.9-1.x86_64`dirname
/var/milter-greylist/greylist.db`
/usr/bin/install: cannot change owner and permissions of
`/home/tcameron/rpmbuild/BUILDROOT/milter-greylist-4.3.9-1.x86_64/var/milter-greylist':
Operation not permitted
make: *** [install-db] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.KtSEYc (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.KtSEYc (%install)
The same will happen if I set the user to smmsp. Now, best practice is
to build RPMs as a non-root user. Any clues for building an RPM for this
thing as a non-root user? I worked around it by changing the build user
and installation user as my Linux username, but that is less than
optimal, you know?
Thoughts?
Thomas