Error: undefined reference to `clock_gettime' during build

I am trying to build LEDE and am receiving the following error:

/home/vagrant/lede/staging_dir/host/lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
getentropy_linux.c:(.text+0x18b): undefined reference to `clock_gettime'
getentropy_linux.c:(.text+0x46f): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[5]: *** [tools/dumpimage] Error 1
make[4]: *** [tools-only] Error 2
make[4]: Leaving directory `/home/vagrant/lede/build_dir/host/u-boot-2014.10'
make[3]: *** [/home/vagrant/lede/build_dir/host/u-boot-2014.10/.built] Error 2
make[3]: Leaving directory `/home/vagrant/lede/tools/mkimage'
make[2]: *** [tools/mkimage/compile] Error 2
make[2]: Leaving directory `/home/vagrant/lede'
make[1]: *** [/home/vagrant/lede/staging_dir/target-mips_24kc_musl-1.1.15/stamp/.tools_install_yynyyyyynyyyyynyynnyyyyyyyyyyyyyyyyyyyynyynynyyyynnny] Error 2
make[1]: Leaving directory `/home/vagrant/lede'
make: *** [world] Error 2

This only started happening after I decided to include the bash package.

In an attempt to fix the problem I included librt, but that didn't work.

Likely either

In any case, you should do a "make dirclean" to rebuild all tools, as so much has been changed today.

Ran direclean and still get the same error. Fixing this is a bit outside of my skill level. What should I do?

Write a bug report in https://bugs.lede-project.org

1 Like

And let's flag this discussion to @NeoRaider whose commit I thought as a possible reason.

Created bug report at: https://bugs.lede-project.org/index.php?do=details&task_id=381

Hi, seems the bug is back or it's my own problem ? Sorry for reviving such old thread.

[ 23%] Linking C executable LIBCURL
/home/machine/lede/source/staging_dir/host/lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime'
getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
make[6]: *** [Utilities/cmcurl/LIBCURL] Error 1
make[6]: Leaving directory `/home/machine/lede/source/build_dir/host/cmake-3.9.3'
make[5]: *** [Utilities/cmcurl/CMakeFiles/LIBCURL.dir/all] Error 2
make[5]: Leaving directory `/home/machine/lede/source/build_dir/host/cmake-3.9.3'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/machine/lede/source/build_dir/host/cmake-3.9.3'
make[3]: *** [/home/machine/lede/source/build_dir/host/cmake-3.9.3/.built] Error 2
make[3]: Leaving directory `/home/machine/lede/source/tools/cmake'
make[2]: *** [tools/cmake/compile] Error 2
make[2]: Leaving directory `/home/machine/lede/source'
make[1]: *** [/home/machine/lede/source/staging_dir/target-mips_24kc_musl/stamp/.tools_compile_yynyyyyyynyyyyynyynnyyyyyyyyyyyyyyyyyyyynyynynyyyynny] Error 2
make[1]: Leaving directory `/home/machine/lede/source'
make: *** [world] Error 2

Seems all is broken since cmake 3.9.3 ?

https://git.lede-project.org/?p=source.git;a=commitdiff;h=839129b86453f0b0b2b47dac5502ecc3dae7ffb3

When reverting this commit, now builds continue.

I dont get that error at all.
What OS and GCC version are you using?