Bug 1044707

Summary: use of clock_gettime and librt
Product: Red Hat Enterprise Linux 7 Reporter: jcpunk
Component: atAssignee: Tomas Mraz <tmraz>
Status: CLOSED CURRENTRELEASE QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: csieh, jcpunk, jscotka, manuel.wolfshant, misterbonnie, riehecky
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: at-3.1.13-17.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-16 13:44:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
mock config to generate the error none

Description jcpunk 2013-12-18 20:52:38 UTC
Description of problem: atd requires use of 'librt' to define "timer_create" and "timer_settime" however '-lrt' is not inserted into the Makefile


Version-Release number of selected component (if applicable):at-3.1.13-12.el7


How reproducible: 100%


Steps to Reproduce:
1. Install minimal RHEL7 and BuildRequires for at
2. rpmbuild --rebuild at-3.1.13-12.el7.src.rpm

Actual results:
gcc -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic -o atd -pie atd.o daemon.o  -lfl  -lselinux -lpam -lpam_misc 
atd.o: In function `timer_setup':
/builddir/build/BUILD/at-3.1.13/atd.c:842: undefined reference to `timer_create'
atd.o: In function `atd_setalarm':
/builddir/build/BUILD/at-3.1.13/atd.c:858: undefined reference to `timer_settime'
collect2: error: ld returned 1 exit status
make: *** [atd] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.dkfP8L (%build)

Expected results:
able to rebuild

Additional info:
adding -lrt to the gcc line resolves this.  The fedora build logs show this was added in correctly

It appears the use of HAVE_CLOCK_GETTIME in at-3.1.13-usePOSIXtimers.patch is related.

Comment 2 Marcela Mašláňová 2013-12-19 13:04:07 UTC
Strange, I see the -lrt in my build.log on every gcc line. How do you define minimal RHEL-7?

Comment 3 jcpunk 2013-12-19 14:55:22 UTC
I was just using mock and the same package list as fedora.

I just ran a test on my desktop, installed from the DVD.  It is a full desktop and it also fails to link against librt.....

Curious

Comment 4 manuel wolfshant 2014-01-01 16:06:21 UTC
I have exactly the same issue. I suspect the difference comes from the different config detected by configure. Right by the end of the detection steps, in Fedora it says:

checking for is_selinux_enabled in -lselinux... yes
checking for library containing timer_create... -lrt
checking for timer_create... yes

while in mock/RHEL7B1 it gives:

checking for is_selinux_enabled in -lselinux... yes
checking for library containing clock_gettime... none required
checking for clock_gettime... yes

And -ltr is exactly the missing bit which leads to the error.

Comment 5 Marcela Mašláňová 2014-01-06 10:59:44 UTC
I guess you are missing some packages in the buildroot, so the config can't find it. Do you have glibc-headers in the buildroot?

Comment 6 manuel wolfshant 2014-01-06 11:15:07 UTC
Of course it is, the compiler stack ( gcc / glibc-devel ) brings it in. 
I can attach mock's build logs if needed but I suspect this is not needed as , as far as I can see the problems lies in the changes that were introduced to gcc between Nov 2012 when at-3.1.13-12.el7.src.rpm was built and now. I have build the package just fine if I switched to a F18 buildroot instead of F19 or rhel7b1.

I suspect the solution is http://pkgs.fedoraproject.org/cgit/at.git/commit/?id=ecd5f487e831837e1668a8079621b5a04bd68b2f

Comment 7 Marcela Mašláňová 2014-01-06 16:04:45 UTC
This patch is applied in at-3.1.13-12.el7.src.rpm.

There are other possible explanation, what's wrong in build. It could be fixed by removal of the smp_flag or the very old Configure script could be altered. Also it would be better to call autoreconf instead of autoconf, but it failed at different point. Feel free to send a patch. I'm not able to fix it if I can't reproduce it.

Do you have both some non x86 architecture?

Comment 8 jcpunk 2014-01-06 16:24:54 UTC
Created attachment 846183 [details]
mock config to generate the error

I've attached a mock config you can use to replicate the error

Comment 9 Marcela Mašláňová 2014-01-09 15:41:01 UTC
Ok, now I'm trying rebuild on life ppc64 and I have the same issue. :-/ Thanks for reproducer.

Comment 10 Marcela Mašláňová 2014-01-09 16:14:39 UTC
Guys,
I removed smp_flag from specfile and all random errors disappeared. Does it work also for you?

Comment 11 manuel wolfshant 2014-01-09 16:33:45 UTC
As far as I can see there is no explicit reference to smp in the spec included in at-3.1.13-12.el7.src.rpm.
%build
# patch9 touches configure.in
autoconf
# uselles files
rm -f lex.yy.* y.tab.*
%configure --with-atspool=%{_localstatedir}/spool/at/spool \
        --with-jobdir=%{_localstatedir}/spool/at \
        --with-daemon_username=root  \
        --with-daemon_groupname=root \
        --with-selinux \
%if %{with pam}
        --with-pam
%endif

make <=== no %{?_smp_mflags}

%install


 Could you please share the exact spec you want tested ?

Comment 13 Marcela Mašláňová 2014-02-11 15:31:48 UTC
I have version 3.1.13-17.el7. I do not use smp_mflags, which appeared in one of the previous releases. Anyway I'm not able to reproduce the missing library. It happened to me only once on ppc64.
I can't fix it without better reproducer.

Comment 14 jcpunk 2014-02-11 15:33:50 UTC
Does the attached mock config not reproduce the error for you?

Comment 15 manuel wolfshant 2014-02-11 15:41:53 UTC
Maybe this matters: the version of the src.rpm which jcpunk and I are using/testing is at-3.1.13-12.el7.src.rpm. We do not have access to 3.1.13-17.el7.

Rebuilding at-3.1.13-12.el7.src.rpm using mock and the packages from ftp://ftp.redhat.com/redhat/rhel/beta/7/x86_64/os/ fails for me 100% of the time.

Comment 17 Tomas Mraz 2014-09-16 10:09:45 UTC
Now that RHEL-7 was released does it still happen for you with at-3.1.13-17.el7?

Comment 18 Pat Riehecky 2014-09-16 13:41:59 UTC
The bug is resolved (jcpunk is my other bz account)