Unit Tests: get ct compiling on CentOS-5 #207

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

danielbeardsley commented Oct 2, 2013

Fix some bugs that were preventing compilation (at least on CentOD 5).

Add -lrt to load the rt libary to prevent this error:

ct.c:(.text+0x12): undefined reference to `clock_gettime'

Include time.h to prevent this error:

ct/ct.c:47: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)

Perform a cast to prevent this error: (on a 64bit arch)

ct/ct.c:420: warning: format ‘%10lld’ expects type ‘long long int’, but argument 3 has type ‘int64

Don't use an expression in a const definition to prevent this error:

ct/ct.c:28: error: initializer element is not constant

See pull kr/ct#7

danielbeardsley added some commits Oct 2, 2013

Unit Tests: get ct compiling on CentOS-5
Fix some bugs that were preventing compilation (at least on CentOD 5).

Add `-lrt` to load the rt libary to prevent this error:
> ct.c:(.text+0x12): undefined reference to `clock_gettime'

Include `time.h` to prevent this error:
> ct/ct.c:47: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)

Perform a cast to prevent this error: (on a 64bit arch)
> ct/ct.c:420: warning: format ‘%10lld’ expects type ‘long long int’, but argument 3 has type ‘int64

Don't use an expression in a const definition to prevent this error:
> ct/ct.c:28: error: initializer element is not constant

See pull kr/ct#7
Unit Tests: one more CentOS compatability fix
Apparently C has macros for 64bit printf formats across different system
architectures.

See this SO answer: http://stackoverflow.com/a/9225648/13216
Contributor

danielbeardsley commented Oct 28, 2013

Most of this (minus the -lrt) has been merged into master of the ct library. So updating beanstalks copy would suffice (though a submodule might make more sense).

Owner

kr commented Oct 28, 2013

Yeah, this can be handled by copying in the latest ct source code.
Search https://github.com/kr/beanstalkd/commits/master for "update ct"
for past examples.

Contributor

tdg5 commented Nov 12, 2013

I've submitted a PR updating beanstalk to the latest ct which might be a preferable alternative to this PR: #214

This PR is not without it's merits, however, as my PR doesn't include the addition of -lrt. I also needed to link in rt to run the tests, but I wasn't sure if it was just an Ubuntu thing. +1 for -lrt.

Owner

kr commented Apr 3, 2016

Updating ct just happened in 8a5665a.

Adding librt went in 1541622.

Sorry for not getting to this PR sooner.

@kr kr closed this Apr 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment