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

"undefined reference to `clock_gettime'" build error #296

Closed
lastchiliarch opened this issue Nov 28, 2018 · 1 comment
Closed

"undefined reference to `clock_gettime'" build error #296

lastchiliarch opened this issue Nov 28, 2018 · 1 comment

Comments

@lastchiliarch
Copy link

build command:

go build -o torrentdetect -x main.go

gcc:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

os env:
CentOS release 6.3
Linux version 2.6.32_1-12-0-0 (scmpf@dbl-sat-dev01.dbl01.baidu.com) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Mon Aug 12 17:59:52 CST 2013

error info:
cc1plus: warning: unrecognized command line option "-Wno-unused-const-variable"
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -DPOSIX -DUTP_DEBUG_LOGGING=0 -I $WORK/github.com/anacrolix/go-libutp/_obj/ -g -O2 -Wall -O3 -fPIC -Wno-sign-compare -Wno-unused-const-variable -o $WORK/github.com/anacrolix/go-libutp/_obj/utp_utils.cpp.o -c utp_utils.cpp
cd $WORK/github.com/anacrolix/go-libutp/_obj
gcc -I /home/scmbuild/workspaces_cluster.debug/baidu.netdisk.nd-torrent-detect.20181128.170747/baidu/netdisk/nd-torrent-detect/src/github.com/anacrolix/go-libutp -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -DPOSIX -DUTP_DEBUG_LOGGING=0 -I ./ -g -O2 -Wall -O3 -o ./_cgo_main.o -c _cgo_main.c
cd /home/scmbuild/workspaces_cluster.debug/baidu.netdisk.nd-torrent-detect.20181128.170747/baidu/netdisk/nd-torrent-detect/src/github.com/anacrolix/go-libutp
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -o $WORK/github.com/anacrolix/go-libutp/_obj/cgo.o $WORK/github.com/anacrolix/go-libutp/_obj/_cgo_main.o $WORK/github.com/anacrolix/go-libutp/_obj/_cgo_export.o $WORK/github.com/anacrolix/go-libutp/_obj/callbacks.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/conn.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/libapi.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/sockaddr.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/socket.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/utp.cgo2.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_api.cpp.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_callbacks.cpp.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_hash.cpp.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_internal.cpp.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_packedsockaddr.cpp.o $WORK/github.com/anacrolix/go-libutp/_obj/utp_utils.cpp.o -g -O2

github.com/anacrolix/go-libutp

/tmp/go-build713244274/github.com/anacrolix/go-libutp/_obj/utp_utils.cpp.o: In function __GetMicroseconds': src/github.com/anacrolix/go-libutp/utp_utils.cpp:164: undefined reference to clock_gettime'
src/github.com/anacrolix/go-libutp/utp_utils.cpp:174: undefined reference to clock_gettime' src/github.com/anacrolix/go-libutp/utp_utils.cpp:164: undefined reference to clock_gettime'
src/github.com/anacrolix/go-libutp/utp_utils.cpp:174: undefined reference to `clock_gettime'

@lastchiliarch
Copy link
Author

I just solve it, change to use gcc4.8.2 to compile.

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

1 participant