[Simh] BUGREPORT: clock_getres()

Lyle Bickley lbickley at bickleywest.com
Sun Apr 27 17:55:10 EDT 2008


On Saturday 26 April 2008 13:52, Alexander Voropay wrote:
> Hi!
>
>  On some systems (i.e. RedHat AS 4.4) clock_getres() function resides
> in the librt library.
>
>  The man clock_getres states:
>
> =========
> NOTE
>       Most systems require the program be linked with the librt  library 
> to use these functions.
>
> AVAILABILITY
>       On  POSIX  systems  on which these functions are available, the
> symbol _POSIX_TIMERS is defined in <unistd.h> to a value greater than 0. 
> The symbols  _POSIX_MONOTONIC_CLOCK, _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME
> indicate     that      CLOCK_MONOTONIC,      CLOCK_PROCESS_CPUTIME_ID,
> CLOCK_THREAD_CPUTIME_ID are available.  (See also .BR sysconf (3).)
> ============
>
> Could you please add "-l rt" in the makefile if _POSIX_TIMERS is defined ?
>
>  I personally did q'n'dirty patch to compile SIMH on the RHAS 4.4
> -D_GNU_SOURCE -lrt
>
>
> Also, BIN directory does not exist and make does not creares it
> automatically.

I also commented on this bug recently, see:
---------------------------------------------------------------------------
> Attempting to compile SIMH for any system with release 37-2 or
> 37-3 on openSUSE or Kubuntu Linux produced the following error:
> ---------------------------------------------------------
> /home/lpb/simh/sim_timer.c:302: undefined reference to
> `clock_getres' collect2: ld returned 1 exit status
> make: *** [BIN/pdp1] Error 1
> ---------------------------------------------------------

Here's a solution - it permits different CC options for 'macos',
'linux', and others:
==================================================================
diff makefile.orig makefile
12a13
> CC = gcc -std=c99 -O2 -U__STRICT_ANSI__ -g -lm $(OS_CCDEFS) -I .
15,16c16,18
< else
< CC = gcc -std=c99 -O2 -U__STRICT_ANSI__ -g -lm $(OS_CCDEFS) -I .
---
> endif
> ifeq ($(OSTYPE),linux)
> CC = gcc -std=c99 -O2 -U__STRICT_ANSI__ -g -lm -lrt 
$(OS_CCDEFS) -I .
===================================================================

I like Alexander's patch suggestion, too - maybe a bit more than mine ;-)

At any rate a couple of questions (I'm new on the list):

1) Is this the correct forum to suggest bugs and fixes?
2) Is there a "bugzilla" or similar means to log and track bugs, fixes, etc?

Cheers,
Lyle

-- 
Lyle Bickley
Bickley Consulting West Inc.
Mountain View, CA
http://bickleywest.com

"Black holes are where God is dividing by zero"



More information about the Simh mailing list