Opened 10 years ago

Closed 10 years ago

#46479 closed defect (invalid)

libgcc @4.9.2_1: error: implicit declaration of function 'clock_gettime'

Reported by: Andrew_Rogers@… Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: libgcc

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I recently attempted to upgrade my MacPorts and Xcode. However, I ran into issues when MacPorts attempted to update ports that depend on libgcc. I decided to start from scratch and did an uninstall/fresh install of Xcode, command-line tools, and macports but I am still getting the same error (see below) building the port.

It looks like the build is failing due to an issue with libgomp trying to use clock_gettime and etc.. I'm stuck on this and not sure what is going wrong. I would be grateful for any suggestions.

Thanks, -Andy

OSX version: 10.9.5
Xcode version: 6.1.1
MacPorts version: 2.3.3

:info:build call frame
:info:build checking for compiler with PCH support... /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/
gcc-4.9.2/libgomp/config/posix/time.c: In function 'omp_get_wtime':
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c:53:5
: error: implicit declaration of function 'clock_gettime' [-Werror=implicit-function-declaration]
:info:build      clock_gettime (CLOCK_REALTIME, &ts);
:info:build      ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c:53:2
0: error: 'CLOCK_REALTIME' undeclared (first use in this function)
:info:build      clock_gettime (CLOCK_REALTIME, &ts);
:info:build                     ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c:53:2
0: note: each undeclared identifier is reported only once for each function it appears in
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c: In 
function 'omp_get_wtick':
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c:70:5
: error: implicit declaration of function 'clock_getres' [-Werror=implicit-function-declaration]
:info:build      clock_getres (CLOCK_REALTIME, &ts);
:info:build      ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/time.c:70:1
9: error: 'CLOCK_REALTIME' undeclared (first use in this function)
:info:build      clock_getres (CLOCK_REALTIME, &ts);
:info:build                    ^
:info:build cc1: all warnings being treated as errors
:info:build make[5]: *** [time.lo] Error 1
:info:build make[5]: *** Waiting for unfinished jobs....
:info:build yes
:info:build checking for enabled PCH... yes
:info:build checking for thread model used by GCC... posix
:info:build checking for atomic builtins for bool... yes
:info:build libtool: compile:  /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/./gcc/xgcc -B/opt
/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/./gcc/ -B/opt/local/x86_64-apple-darwin13/bin/ -B/op
t/local/x86_64-apple-darwin13/lib/ -isystem /opt/local/x86_64-apple-darwin13/include -isystem /opt/local/x86_64-apple-darwin13/sys-include -DHAVE_CONFIG_H -I. -I/opt/local/var/macpo
rts/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp -I/opt/local/var/macports/build/_opt_local_var_macports_
sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/bsd -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.
org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_
ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp -Wall -pthread -Werror -g -O2 -pipe -Os -MT bar.lo -MD -MP -MF .deps/bar.Tpo -c /opt/local/var/macports/build/_opt_local_var_macports_
sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix/bar.c -o bar.o >/dev/null 2>&1
:info:build checking for atomic builtins for short... yes
:info:build checking for atomic builtins for int... yes
:info:build checking for atomic builtins for long long... libtool: compile:  /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/./gcc/ -B/opt/local/x86_64-apple-darwin13/bin/ -B/opt/local/x86_64-apple-darwin13/lib/ -isystem /opt/local/x86_64-apple-darwin13/include -isystem /opt/local/x86_64-apple-darwin13/sys-include -DHAVE_CONFIG_H -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/bsd -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/config/posix -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp -Wall -pthread -Werror -g -O2 -pipe -Os -MT fortran.lo -MD -MP -MF .deps/fortran.Tpo -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/gcc-4.9.2/libgomp/fortran.c -o fortran.o >/dev/null 2>&1
:info:build yes
:info:build checking for ISO/IEC TR 24733 ... no
:info:build checking for __int128... yes
:info:build checking for __float128... yes
:info:build checking for g++ that supports -ffunction-sections -fdata-sections... mv -f .deps/bar.Tpo .deps/bar.Plo
:info:build yes
:info:build checking for underlying I/O to use... stdio
:info:build checking for C locale to use... darwin or freebsd
:info:build checking for std::allocator base class... new
:info:build configure: "C" header strategy set to c_global
:info:build checking for enabled long long specializations... yes
:info:build checking wchar.h usability... mv -f .deps/fortran.Tpo .deps/fortran.Plo
:info:build make[5]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/x86_64-apple-darwin13/libgomp'
:info:build make[4]: *** [all-recursive] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/x86_64-apple-darwin13/libgomp'
:info:build make[3]: *** [all] Error 2
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libgcc/work/build/x86_64-apple-darwin13/libgomp'
:info:build make[2]: *** [all-stage1-target-libgomp] Error 2
:info:build make[2]: *** Waiting for unfinished jobs....
:info:build yes
:info:build checking wchar.h presence... yes

Attachments (1)

main.log.bz2 (88.9 KB) - added by Andrew_Rogers@… 10 years ago.

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by Andrew_Rogers@…

Attachment: main.log.bz2 added

comment:1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: mww@… removed
Description: modified (diff)
Owner: changed from macports-tickets@… to mww@…
Summary: libgcc @4.9.2_1 Error: Processing of port libgcc failed - libgomplibgcc @4.9.2_1: error: implicit declaration of function 'clock_gettime'

I notice you are using trace mode. Does the problem persist if you do not use trace mode?

comment:2 in reply to:  1 Changed 10 years ago by Andrew_Rogers@…

Replying to ryandesign@…:

I notice you are using trace mode. Does the problem persist if you do not use trace mode?

Yes, without trace mode I get the same error.

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Hmm. I haven't seen this problem. Could you show your version of clang, by running:

clang -v

comment:4 in reply to:  3 Changed 10 years ago by Andrew_Rogers@…

Replying to ryandesign@…:

Hmm. I haven't seen this problem. Could you show your version of clang, by running:

clang -v
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

comment:5 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

Ok, that's fine.

I see in your log:

:info:build checking for clock_gettime... no
:info:build checking for strtoull... yes
:info:build checking for clock_gettime in -lrt... yes

My understanding is that clock_gettime is not available on OS X, so it's strange that it was found on your system, in a library called librt, which also does not exist on OS X.

My guess is that you have installed a copy of librt.a or librt.so or librt.dylib either in /usr/lib or in /usr/local/lib, and that removing that library, and cleaning libgcc and trying again, would fix the problem.

comment:6 in reply to:  5 ; Changed 10 years ago by seanfarley (Sean Farley)

Replying to ryandesign@…:

Ok, that's fine.

I see in your log:

:info:build checking for clock_gettime... no
:info:build checking for strtoull... yes
:info:build checking for clock_gettime in -lrt... yes

My understanding is that clock_gettime is not available on OS X, so it's strange that it was found on your system, in a library called librt, which also does not exist on OS X.

My guess is that you have installed a copy of librt.a or librt.so or librt.dylib either in /usr/lib or in /usr/local/lib, and that removing that library, and cleaning libgcc and trying again, would fix the problem.

Isn't that what trace mode is supposed to prevent?

comment:7 in reply to:  6 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to sean@…:

Isn't that what trace mode is supposed to prevent?

I would have thought so.

comment:8 in reply to:  5 Changed 10 years ago by Andrew_Rogers@…

Replying to ryandesign@…:

Ok, that's fine.

I see in your log:

:info:build checking for clock_gettime... no
:info:build checking for strtoull... yes
:info:build checking for clock_gettime in -lrt... yes

My understanding is that clock_gettime is not available on OS X, so it's strange that it was found on your system, in a library called librt, which also does not exist on OS X.

My guess is that you have installed a copy of librt.a or librt.so or librt.dylib either in /usr/lib or in /usr/local/lib, and that removing that library, and cleaning libgcc and trying again, would fix the problem.

You are correct! :) I had both librt.so and lbrt.dylib in /usr/lib. I forgot, but I was using them to get another project to build but I guess I did not realize the consequences it would have.

Thanks for all the help.

comment:9 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed

Great, glad that worked.

To Sean's point that trace mode should have prevented it: I imaging trace mode allows access to everything in /usr/lib, on the assumption that anything there was provided by Apple and is ok to use. Installing non-Apple software in prefix /usr is therefore a bad idea.

Note: See TracTickets for help on using tickets.