Clock_gettime Ld Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have
Undefined Reference To `clock_gettime' Ubuntu
Meta Discuss the workings and policies of this site About Us undefined reference to clock_gettime cmake Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with centos undefined reference to `clock_gettime' us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Undefined Reference To Clock_gettime' Makefile
like you, helping each other. Join them; it only takes a minute: Sign up Getting undefined reference to 'clock_gettime' error, for curl program up vote 1 down vote favorite 1 Gretings, I have cross compile, OpenSSl , libssh2 and finally cURL, Don't know why it has generated only static library. Anyway I tried to run sample ftpget.c
Clock_gettime Linux Example
program by linking all the three libraries but I am getting the following error : .../libcurl.a(timeval.o): In function 'curlx_tvnow': timeval.c:(.text+0xfc): undefined reference to 'clock_gettime' collect2: ld return 1 exit status make: *** [all] Error 1 Please help me resolve this error, Is there need to cross-compile any other library also ? Thanks, Yuvi c curl libcurl cross-compiling share|improve this question edited Mar 2 '12 at 10:42 Oliver Charlesworth 184k20363515 asked Mar 2 '12 at 10:36 Yuvi 81121535 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted Try linking with librt (-lrt). share|improve this answer answered Mar 2 '12 at 10:42 Oliver Charlesworth 184k20363515 so I need to cross compile it ? could you plz provide link to download source.. –Yuvi Mar 2 '12 at 10:53 @Yuvi: Cross-compile? I'm assuming that you're running on Linux; librt should always be available (I hope!). –Oliver Charlesworth Mar 2 '12 at 11:00 It was inside the toolchain already.. tha
here for a quick overview of the site Help Center Detailed answers to any questions you might cmake lrt have Meta Discuss the workings and policies of this site About
Cmake Librt
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting clock_gettime clock_realtime ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 http://stackoverflow.com/questions/9531839/getting-undefined-reference-to-clock-gettime-error-for-curl-program million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined reference to clock_gettime, gcc 4.6 & cmake up vote 7 down vote favorite 2 I'm having a link error under cmake that I don't have when compiling on a system with an older version of gcc. The http://stackoverflow.com/questions/9511422/undefined-reference-to-clock-gettime-gcc-4-6-cmake specific error is "undefined reference to clock_gettime" but -lrt is appearing on the command line. My gcc version: gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cmake version 2.8.5 I am including the required "-lrt" through target_link_libraries in my CMakeLists.txt file. I can see it appear in the compiler line with make VERBOSE=1 I've read that gcc 4.6 is picky about the position of link libraries on the command line. How can I fix this for CMake? EDIT: Link line Linking CXX executable ../bin/obbsd cd /home/matt/Desktop/Matt/OBBS/Build/server && /usr/bin/cmake -E cmake_link_script \ CMakeFiles/obbsd.dir/link.txt --verbose=1 /usr/bin/c++ -g CMakeFiles/obbsd.dir/Block.cpp.o \ CMakeFiles/obbsd.dir/BlockFileCache.cpp.o \ CMakeFiles/obbsd.dir/BlockFileStore.cpp.o \ CMakeFiles/obbsd.dir/BlockMemoryCache.cpp.o \ CMakeFiles/obbsd.dir/BlockStore.cpp.o CMakeFiles/obbsd.dir/Config.cpp.o \ CMakeFiles/obbsd.dir/DeleteBlockSession.cpp.o \ CMakeFiles/obbsd.dir/mConfigFile.cpp.o \ CMakeFiles/obbsd.dir/mNetworkPacketReader.cpp.o \ CMakeFiles/obbsd.dir/mNetworkPacketWriter.cpp.o \ CMakeFiles/obbsd.dir/obbsd.cpp.o \ CMakeFiles/obbsd.dir/ReadBlockSession.cpp.o CMakeFiles/obbsd.dir/Server.cpp.o \ CMakeFiles/obbsd.dir/Session.cpp.o CMakeFiles/obbsd.dir/Utility.cpp.o \ CMakeFiles/obbsd.dir/WriteBlockSession.cpp.o -o ../bin/obbsd -rdynamic \ -lpthread -lrt ../lib/libLibUtil.a ../lib/libLibUtil.a(mTimer.cpp.o): In function `mTimer::GetTick()': /home/matt/Desktop/Matt/OBBS/LibUtil/src/mTimer.cpp:108: u
j2902 Member Registered: 2009-12-21 Posts: 20 [Solved] undefined reference to `clock_gettime' I'm trying https://bbs.archlinux.org/viewtopic.php?id=88108 to compile a program that worked fine on Ubuntu and windows.Here is my makefileCXXFLAGS=-Wall `sdl-config --cflags` `freetype-config --cflags` LDFLAGS=-L -lrt -lGL -lGLU -lSDL -lSDL_mixer -lILU -lILUT `freetype-config --libs` CLFAGS=$(CXXFLAGS) CXX=g++ CC=g++ SOURCES=src/Camera.cpp src/Color.cpp src/Data.cpp src/Engine.cpp \ src/FontRenderer.cpp src/Renderable.cpp src/Point.cpp src/PrimitiveNode.cpp \ src/Scene.cpp src/SoundEngine.cpp undefined reference src/Texture.cpp src/TexturedNode.cpp \ src/Timer.cpp src/Utils.cpp \ \ src/Particles/Particle.cpp src/Particles/ParticleEmitter.cpp \ src/Particles/ParticleEngine.cpp \ \ src/external/GLFT_Font.cpp \ \ main.cpp TARGET= klas OBJECTS=$(SOURCES:.cpp=.o) all: $(TARGET) $(TARGET): $(OBJECTS) $(CXX) $(LDFLAGS) -o $(TARGET) $(OBJECTS) clean: rm -rf $(OBJECTS) $(TARGET)Here is the output from make$ make g++ -Wall `sdl-config --cflags` undefined reference to `freetype-config --cflags` -c -o src/Camera.o src/Camera.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Color.o src/Color.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Data.o src/Data.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Engine.o src/Engine.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/FontRenderer.o src/FontRenderer.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Renderable.o src/Renderable.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Point.o src/Point.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/PrimitiveNode.o src/PrimitiveNode.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Scene.o src/Scene.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/SoundEngine.o src/SoundEngine.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Texture.o src/Texture.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/TexturedNode.o src/TexturedNode.cpp g++ -Wall `sdl-config --cflags` `freetype-config --cflags` -c -o src/Timer.o src/Timer.cpp g++ -