Did you find a way to get this to work?

On Saturday, October 24, 2015 at 9:09:51 PM UTC-4, Hiroaki Nakamura wrote:
>
> Hi.
>
> I tried to create an Varnish VMOD equivalent to 
> https://github.com/varnish/libvmod-example/tree/4.1 in go,
> but I got "undefined reference" link errors.
>
> ```
> gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -o 
> $WORK/command-line-arguments/_obj/_cgo_.o 
> $WORK/command-line-arguments/_obj/_cgo_main.o 
> $WORK/command-line-arguments/_obj/_cgo_export.o 
> $WORK/command-line-arguments/_obj/libvmod_example.cgo2.o 
> $WORK/command-line-arguments/_obj/vcc_if.cgo2.o -g -O2 -lvarnishapi
> # command-line-arguments
> /tmp/go-build219936183/command-line-arguments/_obj/libvmod_example.cgo2.o: 
> In function `_cgo_d098f44947dd_Cfunc_WS_Reserve':
> ./libvmod_example.go:64: undefined reference to `WS_Reserve'
> /tmp/go-build219936183/command-line-arguments/_obj/libvmod_example.cgo2.o: 
> In function `_cgo_d098f44947dd_Cfunc_WS_Release':
> ./libvmod_example.go:50: undefined reference to `WS_Release'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libvarnishapi.so: 
> undefined reference to `pow'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libvarnishapi.so: 
> undefined reference to `round'
> collect2: error: ld returned 1 exit status
> make: *** [libvmod_example.so] Error 2
> ```
>
> My Dockerfiles for building this VMOD are at
>
> https://github.com/hnakamur/docker-varnish-vmods-development/tree/try_to_create_vmod_in_go
>
> I confirmed two functions WS_Reserve and WS_Release are not linked in 
> libvarnishapi.so
> (which is specified with -lvarnishapi above).
> I confirmed it with the following command which printed one line but 
> cache_ws.c is just mentioned in a comment.
>
> ```
> $ docker exec -it dockervarnishvmodsdevelopment_varnish_1 bash -l -c "cd 
> /root/rpmbuild/SOURCES/Varnish-Cache-varnish-4.1.0/lib && grep -R cache_ws 
> ."
> ./libvmod_std/vmod_std_querysort.c:     /* We trust cache_ws.c to align 
> sensibly */
> ```
>
> Actually they are linked in varnishd executable.
>
> https://github.com/varnish/Varnish-Cache/blob/varnish-4.1.0/bin/varnishd/Makefile.am#L52
>
> Is there a way to work around these undefined references and build a VMOD 
> shared library successfully?
>
> Thanks,
> Hiroaki
>

-- 
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.

Reply via email to