pcp
[Top] [All Lists]

Re: pmmgr build failure on 32-bit Fedora release 17 (Beefy Miracle)

To: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Subject: Re: pmmgr build failure on 32-bit Fedora release 17 (Beefy Miracle)
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Wed, 05 Mar 2014 15:51:40 +1100
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <20140228231759.GA18123@xxxxxxxxxx>
References: <53101471.4000200@xxxxxxxxxxxxxxxx> <y0mzjlbwj2e.fsf@xxxxxxxx> <y0m4n3jw52a.fsf@xxxxxxxx> <5311157B.9010004@xxxxxxxxxxxxxxxx> <20140228231759.GA18123@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
On 01/03/14 10:17, Frank Ch. Eigler wrote:
> Hi -
> 
> On Sat, Mar 01, 2014 at 10:02:19AM +1100, Ken McDonell wrote:
>> [...]
>> g++ -O2 -g -march=i386 -mtune=i686 -fPIC -fno-strict-aliasing -D_GNU_SOURCE 
>> -fstack-protector-all -D_FORTIFY_SOURCE=2  -Wall -O2 -g -DPCP_DEBUG 
>> -DPCP_VERSION=\"3.9.1\" -I./src/include -I./src/include/pcp -fPIC 
>> -fno-strict-aliasing -D_GNU_SOURCE -fstack-protector-all -D_FORTIFY_SOURCE=2 
>>  -Wall -O2 -g -DPCP_DEBUG -DPCP_VERSION=\"3.9.1\" -I../src/include 
>> -I../src/include/pcp -fPIC -fno-strict-aliasing -D_GNU_SOURCE 
>> -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -Wall -O2 -g -DPCP_DEBUG 
>> -DPCP_VERSION=\"3.9.1\" -I../../src/include -I../../src/include/pcp -O2 -g 
>> -march=i386 -mtune=i686 -o pmmgr  -Wall -L../../src/libpcp/src 
>> -L../../src/libpcp_pmda/src -rdynamic -pie -Wl,-z,relro -Wl,-z,now   pmmgr.o 
>>    -lpcp  -lpthread
>> pmmgr.o: In function `__exchange_and_add':
>> /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:48:
>>  undefined reference to `__atomic_fetch_add_4'
> 
> Right, this is the gcc <= 4.7 case, where a -latomic did not exist, so
> i686 libstdc++ genuinely couldn't be used with -march=i386.
> 
> But where is the -march=i386 stuff coming from in your tree now?
> That CFLAGS strangely duplicative & wrong.

Yep.

after configure and make in the source tree (no rpm involved), cd src/pmmgr; 
make clean; make ...

g++ -fPIC -fno-strict-aliasing -D_GNU_SOURCE -fstack-protector-all 
-D_FORTIFY_SOURCE=2 -fPIE -Wall -O2 -g -DPCP_DEBUG -DPCP_VERSION=\"3.9.1\" 
-I../../src/include -I../../src/include/pcp   -c pmmgr.cxx -o pmmgr.o
g++ -fPIC -fno-strict-aliasing -D_GNU_SOURCE -fstack-protector-all 
-D_FORTIFY_SOURCE=2 -fPIE -Wall -O2 -g -DPCP_DEBUG -DPCP_VERSION=\"3.9.1\" 
-I../../src/include -I../../src/include/pcp  -o pmmgr  -Wall 
-L../../src/libpcp/src -L../../src/libpcp_pmda/src -rdynamic -pie -Wl,-z,relro 
-Wl,-z,now   pmmgr.o    -lpcp  -lpthread  

No bogus flags I can see here ... so this is something about the why the rpm 
build is being run.

Ahh after a LOT of digging ...

Makepkgs eventually does ...

        cd build/rpm
        make pack_pcp

which does this

        /usr/bin/rpmbuild -ba --define '_topdir /home/kenj/src/pcp' --define 
'_builddir %{_topdir}' --define '_sourcedir %{_topdir}/build/tar' --define 
'_rpmdir /home/kenj/src/pcp/build/rpm' --define '_srcrpmdir 
/home/kenj/src/pcp/build/rpm' --define '_specdir %{_topdir}/build/rpm' --define 
'_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' --clean pcp.spec

and rpmbuild builds a shell script to run that looks like this ...

$ cat /var/tmp/rpm-tmp.C7lEo3
#!/bin/sh

  RPM_SOURCE_DIR="/home/kenj/src/pcp/build/tar"
  RPM_BUILD_DIR="/home/kenj/src/pcp"
  RPM_OPT_FLAGS="-O2 -g -march=i386 -mtune=i686"
  RPM_LD_FLAGS=""
  RPM_ARCH="i386"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="pcp"
  RPM_PACKAGE_VERSION="3.9.1"
  RPM_PACKAGE_RELEASE="1"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/home/kenj/src/pcp/BUILDROOT/pcp-3.9.1-1.i386"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  
  set -x
  umask 022
  cd "/home/kenj/src/pcp"
cd 'pcp-3.9.1'

  CFLAGS="${CFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export FFLAGS ; 
  ./configure --host=i686-redhat-linux-gnu --build=i686-redhat-linux-gnu \
        --program-prefix= \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --sharedstatedir=/var/lib \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info  --with-rcdir=/etc/rc.d/init.d
/usr/bin/gmake default_pcp


So it is rpmbuild in this case that is adding the bogus (?) and additional 
CFLAGS and CXXFLAGS

And here's the proof ...

$ grep 'optflag.*march=i386' /usr/lib/rpm/rpmrc
optflags: i386 -O2 -g -march=i386 -mtune=i686

Now if I create /etc/rpmc as follows (you have to have something here to 
override, hence the benign and gratuitous -g)

$ cat /etc/rpmrc
optflags: i386 -g

by magic rpmbuild works and even more magical Makepkgs works.

So the question is what is the _propper_ way to smack rpmbuild in a case like 
this?


> Even that should be working now, if the platform combination you are
> referring to is fedora-17 (which by the way is orphaned), i686,
> invoking it all via a Makepkgs in a clean directory, with those two
> fche/i686 patches.

It is fedora-17 and i386.

<Prev in Thread] Current Thread [Next in Thread>