On Mon, Feb 28, 2022 at 11:11 AM 'Olaf Flebbe' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> I need to call  automagically generated C code (matlab models)  with cgo on 
> the musl platform.
>
> Issue at hand is the code needs quite a bit stack space to run sucessfully.
>
> It is well known that the default Stack size for threads is quite low for the 
> Musl pplatform (i.e. the alpine distribution) and there are several options 
> outlined at 
> https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-stack-size
>
> I missed to find a call to pthread_attr_setstacksize for musl in the standard 
> lib, so this isn't an option for current goland.
>
> Adding the mentioned linker flag isn't an option as well since golang is 
> using a different linker which seems not to support this flag.
>
> As a workaround  this nice little project is helpful for executables 
> https://github.com/yaegashi/muslstack
>
> However to use it with go test is quite tedious: Compile all packages with
> go test -c  ./package
> muslstack -s something ./package.test
> ./package.test
>
> I am asking myself if there is any chance a change to the linker accepted to 
> set this flag even with go build or go test or alternatively a way to 
> influence the default stack size of CGO code (seems like Solaris has 
> something like that already in place)
>
> This might be an issue for other platforms as well, since I remember tripping 
> over a similar issue on AIX before, unrelated to golang, way back in the past.

The web page you mention suggests a workaround, which in Go you would invoke as

    go build -extldflags=-Wl,-z,stack-size=N

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV0TP%3DH3Qw7Xv38GzKKGf4KGtDSv0Yd04%2B3uG-n79ckZA%40mail.gmail.com.

Reply via email to