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

Race detector not working with Alpine based image #84

Closed
dlsniper opened this issue Feb 10, 2016 · 3 comments
Closed

Race detector not working with Alpine based image #84

dlsniper opened this issue Feb 10, 2016 · 3 comments

Comments

@dlsniper
Copy link

Hi,

I'm doing something like this:

docker run --rm \
    -v ${PROJECT_DIR}:${CONTAINER_PROJECT_DIR} \
    -e GODEBUG=netdns=go \
    -e GOPATH=${CONTAINER_PROJECT_GOPATH} \
    -w "${CONTAINER_PROJECT_DIR}" \
    golang:1.5.3-alpine \
    go test -v -race 

But the race detector will crash with this error:

# runtime/cgo
exec: "gcc": executable file not found in $PATH

This doesn't happen with the golang:1.5.3 image.
I've tried the go 1.6 rc2 image and the same outcome.

With these results, I've decided to upgrade the Go image with the missing gcc stuff and so I've created this:

FROM golang:1.5.3-alpine
MAINTAINER Florin Patan "[email protected]"

# SSL certs
RUN apk add --update ca-certificates g++ gcc make musl musl-dev \
    && rm -rf /var/cache/apk/*

Then I've used the newly created image to replace the golang:1.5.3 image and I've ran the above command again.
The outcome was that the binary now compiles again however there's a new error at runtime:

# runtime/race
race_linux_amd64.syso: In function `__sanitizer::InternalAlloc(unsigned long, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<0ul, 140737488355328ull, 0ul, __sanitizer::SizeClassMap<17ul, 64ul, 14ul>, 20ul, __sanitizer::TwoLevelByteMap<32768ull, 4096ull, __sanitizer::NoOpMapUnmapCallback>, __sanitizer::NoOpMapUnmapCallback> >*)':
gotsan.cc:(.text+0x1681): undefined reference to `__libc_malloc'
race_linux_amd64.syso: In function `__sanitizer::ReExec()':
gotsan.cc:(.text+0xd937): undefined reference to `__libc_stack_end'
race_linux_amd64.syso: In function `__sanitizer::InternalFree(void*, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<0ul, 140737488355328ull, 0ul, __sanitizer::SizeClassMap<17ul, 64ul, 14ul>, 20ul, __sanitizer::TwoLevelByteMap<32768ull, 4096ull, __sanitizer::NoOpMapUnmapCallback>, __sanitizer::NoOpMapUnmapCallback> >*)':
gotsan.cc:(.text+0x5ec8): undefined reference to `__libc_free'
collect2: error: ld returned 1 exit status

I believe that the last error is caused by the ThreadSanitizer race detector which is shipped with Go but that's a separate issue imho.

As such, I'm not sure what's the best way to continue. Ideally I'd like to compile the binary and run the tests against the same libraries and using golang:1.5.3 for running the tests and golang:1.5.3-alpine to build the binary doesn't seem as the way to move forward.

Thank you.

@dlsniper
Copy link
Author

Of course I've found the duplicate issue after I've created this one: gliderlabs/docker-alpine#68 sorry for noise.

@jerome-laforge
Copy link

From the alpine dockerfile, you compile go from the source.
For supporting race, the link below gives us how to do. Could you take it in account:
https://getgb.io/faq/#missing-race-support

Thx

@tianon
Copy link
Member

tianon commented Apr 26, 2017

See golang/go#14481 -- Go upstream does not support the race detector on Alpine Linux yet.

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

3 participants