Re: [go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Peter Waller
On 11 July 2016 at 15:30, Ian Lance Taylor  wrote:
>
> If you just want to focus on Go, don't build the race detector.  It
> looks like you are running the command `go install -v -race .`.  Don't
> do that.


This tickles me :). The whole point of course was that I want the race
detector. Sadly my time budget for this is already long blown, I'll have to
run the race detector on glibc builds only.

Thanks for looking into it.

All the best,

- Peter

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Ian Lance Taylor
On Mon, Jul 11, 2016 at 6:57 AM, Peter Waller  wrote:
> Thanks Ian. No luck though, that doesn't seem to be it.
>
> I have rebuilt the race detector .syso as mentioned in the README.
>
> I get the same error as before (below, again) while building the
> runtime/race package, during `./race.bash`. (After replacing
> go/src/runtime/race/race_linux_amd64.syso with the freshly built one from
> compiler-rt).
>
> I had to work around this other minor error by removing -Werror:
>
> In file included from ./gotsan.cc:10756:0:
> /usr/include/sys/signal.h:1:2: error: #warning redirecting incorrect
> #include  to  [-Werror=cpp]
>  #warning redirecting incorrect #include  to 
>   ^
> cc1plus: error: unrecognized command line option
> '-Wno-unknown-warning-option' [-Werror]
> cc1plus: error: unrecognized command line option
> '-Wno-unused-const-variable' [-Werror]
>
> I'm using this:
>
> # gcc --version
> gcc (Alpine 5.3.0) 5.3.0
>
> Here's the build failure during ./race.bash:
>
> # 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+0x1591): undefined reference to `__libc_malloc'
> race_linux_amd64.syso: In function `__sanitizer::GetArgv()':
> gotsan.cc:(.text+0x4503): undefined reference to `__libc_stack_end'
> race_linux_amd64.syso: In function `__sanitizer::ReExec()':
> gotsan.cc:(.text+0x8f07): 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+0x5eb8): undefined reference to `__libc_free'
> collect2: error: ld returned 1 exit status

Hmmm, you're right, it does look like the sanitizer source code is
closely tied to glibc.  In sanitizer_common/sanitizer_allocator.cc I
see direct references to __libc_malloc.

In any case the step toward supporting the race detector with musl is
going to start with porting the compiler-rt library to musl.

If you just want to focus on Go, don't build the race detector.  It
looks like you are running the command `go install -v -race .`.  Don't
do that.  To pass the tests you may need to modify the method
tester.raceDetectorSupported in cmd/dist/test.go.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Peter Waller
Hi All,

I'm guessing the answer to this one is "use glibc", but I can't find any
existing commentary on this in within the go ecosystem and thought it was
worth a quick shot in case there is a fix. I'm aware that tsan and glibc
are fairly well intermingled, so probably requires a lot of work possibly
on both musl and go's part.

Just in case there is a quick fix though, here's a minimal reproduce using
docker. I'd be interested in seeing this one work some day.

Regards,

- Peter

Dockerfile gist link


$ docker build -t race-build-failure
https://gist.github.com/7b8c73a84b4c5bef5ce107fe009eb8d8.git
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM golang:1.7rc1-alpine

Step 5 : RUN go install -v -race .
 ---> Running in ac6e3198f37a
runtime/internal/sys
runtime/internal/atomic
runtime
runtime/cgo
runtime/race
# 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+0x16c1): undefined reference to `__libc_malloc'
race_linux_amd64.syso: In function `__sanitizer::GetArgv()':
gotsan.cc:(.text+0x41c3): undefined reference to `__libc_stack_end'
race_linux_amd64.syso: In function `__sanitizer::ReExec()':
gotsan.cc:(.text+0xe517): 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+0x6f28): undefined reference to `__libc_free'
collect2: error: ld returned 1 exit status
The command '/bin/sh -c go install -v -race .' returned a non-zero code: 2

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.