Skip to content

go 1.19.1 - race detector tests - undefined reference to clock_gettime #55974

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

Closed
chargr opened this issue Sep 30, 2022 · 1 comment
Closed

go 1.19.1 - race detector tests - undefined reference to clock_gettime #55974

chargr opened this issue Sep 30, 2022 · 1 comment

Comments

@chargr
Copy link

chargr commented Sep 30, 2022

What version of Go are you using (go version)?

1.19.1

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

CentOS 6

What did you do?

When building on CentOS 6/glibc-2.12 there seems to be a missing "-lrt" when linking these tests.
The same steps and tools work on CentOS 7.

#!/bin/sh
set -e

UTILS_GCC=/home/utils/gcc-12.2.0
UTILS_BINUTILS=/home/utils/binutils-2.37
UTILS_GIT=/home/utils/git-2.35.1
UTILS_GO=/home/utils/go-1.17.2

nproc=$( cat /proc/cpuinfo | grep processor | wc -l )

test -n "$PREFIX"

export PATH=${UTILS_GCC}/bin:$PATH
export PATH=${UTILS_BINUTILS}/bin:$PATH
export PATH=${UTILS_GIT}/bin:$PATH

export GOROOT_BOOTSTRAP=${UTILS_GO}
export GOROOT_FINAL=$PREFIX

if [ -z $USER ]
then
  export USER=$( whoami )
fi

cd src
./all.bash
cd -

What did you expect to see?

##### Testing race detector
ok      runtime/race    4.128s
ok      flag    0.036s
ok      net     0.130s
ok      os      0.134s
ok      os/exec 0.095s
ok      encoding/gob    0.063s
ok      flag    0.036s
ok      os/exec 0.088s

What did you see instead?

##### Testing race detector
# runtime/race.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-1368899331/000002.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    runtime/race [build failed]
FAIL
2022/09/30 17:01:27 Failed: exit status 2
# os.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-3372813736/000002.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

# flag.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-3452973005/000020.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    flag [build failed]
# encoding/gob.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-1645444054/000020.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

# net.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-3320890071/000020.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    net [build failed]
FAIL    os [build failed]
# os/exec.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-161142025/000024.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    os/exec [build failed]
FAIL    encoding/gob [build failed]
FAIL
2022/09/30 17:01:33 Failed: exit status 2
# flag.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-901642791/000020.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    flag [build failed]
# os/exec.test
/build/tmp/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/utils/binutils-2.37/bin/ld: /tmp/go-link-2461358603/000024.o: in function `__sanitizer::MonotonicNanoTime()':
gotsan.cpp:(.text+0x1586d): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

FAIL    os/exec [build failed]
FAIL
2022/09/30 17:01:33 Failed: exit status 2
go tool dist: FAILED
@cherrymui
Copy link
Member

As documented in https://go.dev/doc/go1.19#runtime/race

On Linux, the race detector now requires at least glibc version 2.17 and GNU binutils 2.26.

Closing as working as intended. Thanks.

@cherrymui cherrymui closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2022
@golang golang locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants