Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with CLOCK_REALTIME #234

Open
Raksha2606 opened this issue Jan 4, 2024 · 2 comments
Open

Error with CLOCK_REALTIME #234

Raksha2606 opened this issue Jan 4, 2024 · 2 comments

Comments

@Raksha2606
Copy link

Raksha2606 commented Jan 4, 2024

Trying to compile in linux 3.10.0-1160.el7.x86_64 with -std=gnu99.
But getting below error related to time.h
./src/postgres/include/portability/instr_time.h:118:2: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration]
clock_gettime(PG_INSTR_CLOCK, &tmp);
^
./src/postgres/include/portability/instr_time.h:108:24: error: ‘CLOCK_REALTIME’ undeclared (first use in this function)
#define PG_INSTR_CLOCK CLOCK_REALTIME
^
./src/postgres/include/portability/instr_time.h:118:16: note: in expansion of macro ‘PG_INSTR_CLOCK’
clock_gettime(PG_INSTR_CLOCK, &tmp);
^
./src/postgres/include/portability/instr_time.h:108:24: note: each undeclared identifier is reported only once for each function it appears in
#define PG_INSTR_CLOCK CLOCK_REALTIME
^
./src/postgres/include/portability/instr_time.h:118:16: note: in expansion of macro ‘PG_INSTR_CLOCK’
clock_gettime(PG_INSTR_CLOCK, &tmp);

Tried all possible solutions mentioned online like:
adding
#define _GNU_SOURCE
#define _POSIX_C_SOURCE = 199309L / #define _POSIX_C_SOURCE >= 199309L
Also tried adding <unistd.h> before time.h
But nothing worked.

Any help would be appreciated.

@lfittl
Copy link
Member

lfittl commented Jan 4, 2024

Thanks for the report!

Could you confirm which commands you're running exactly? (make in the project root?)

Additionally, which distribution are you using? (looks like RHEL7 or CentOS7?)

@Raksha2606
Copy link
Author

Thanks for the report!

Could you confirm which commands you're running exactly? (make in the project root?)

Additionally, which distribution are you using? (looks like RHEL7 or CentOS7?)

Hi,
Yes distribution is CentOS version 7 ,
and the only change I have made before running make in project root is adding -std=gnu99 because of some c99 for loop related error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants