go-libucl icon indicating copy to clipboard operation
go-libucl copied to clipboard

Trouble building test with go-libucl

Open aka-mj opened this issue 9 years ago • 0 comments

I installed go-libucl and wrote a small test to start experimenting. When I build the test I get an error about Go not being able to find libucl.so.3. libucl is installed and I can compile and run a test using libucl, which made me think the issue was with go-libucl. Below is my code and the build output.

package main

import (
    "fmt"
    ucl "github.com/mitchellh/go-libucl"
)

func main() {
    type Basic struct {
        Bool bool
        Str  string
        Num  int
    }

    obj, err := ucl.ParseString("bool = true; str = bar; num = 7")
    defer obj.Close()

    var result Basic
    if err = obj.Decode(&result); err != nil {
        fmt.Println("Error decoding line")
        return
    }

    fmt.Println("Bool :", result.Bool)
    fmt.Println("Str  :", result.Str)
    fmt.Println("Num  :", result.Num)
}
go run -v -x ssengine.go            

WORK=/tmp/go-build303126320
github.com/mitchellh/go-libucl
mkdir -p $WORK/github.com/mitchellh/go-libucl/_obj/
mkdir -p $WORK/github.com/mitchellh/
cd /home/mjohn/workspaces/goprojects/src/github.com/mitchellh/go-libucl
CGO_LDFLAGS="-g" "-O2" "-Lvendor/libucl" "-lucl" "-L/usr/local/lib" /home/mjohn/software/go/pkg/tool/linux_386/cgo -objdir $WORK/github.com/mitchellh/go-libucl/_obj/ -importpath github.com/mitchellh/go-libucl -- -I $WORK/github.com/mitchellh/go-libucl/_obj/ -Ivendor/libucl/include -Wno-int-to-void-pointer-cast libucl.go object.go parser.go
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -print-libgcc-file-name
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -I $WORK/github.com/mitchellh/go-libucl/_obj/ -g -O2 -Ivendor/libucl/include -Wno-int-to-void-pointer-cast -o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_main.o -c $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_main.c
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -I $WORK/github.com/mitchellh/go-libucl/_obj/ -g -O2 -Ivendor/libucl/include -Wno-int-to-void-pointer-cast -o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_export.o -c $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_export.c
# github.com/mitchellh/go-libucl
In file included from ../goprojects/src/github.com/mitchellh/go-libucl/parser.go:9:0,
                 from $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_export.c:2:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h: In function ‘_go_macro_handler_func’:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h:27:5: warning: return from incompatible pointer type [enabled by default]
     return &_go_macro_handler;
     ^
/tmp/go-build303126320/github.com/mitchellh/go-libucl/_obj/_cgo_export.c: At top level:
cc1: warning: unrecognized command line option "-Wno-int-to-void-pointer-cast" [enabled by default]
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -I $WORK/github.com/mitchellh/go-libucl/_obj/ -g -O2 -Ivendor/libucl/include -Wno-int-to-void-pointer-cast -o $WORK/github.com/mitchellh/go-libucl/_obj/libucl.cgo2.o -c $WORK/github.com/mitchellh/go-libucl/_obj/libucl.cgo2.c
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -I $WORK/github.com/mitchellh/go-libucl/_obj/ -g -O2 -Ivendor/libucl/include -Wno-int-to-void-pointer-cast -o $WORK/github.com/mitchellh/go-libucl/_obj/object.cgo2.o -c $WORK/github.com/mitchellh/go-libucl/_obj/object.cgo2.c
# github.com/mitchellh/go-libucl
In file included from ../goprojects/src/github.com/mitchellh/go-libucl/object.go:5:0:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h: In function ‘_go_macro_handler_func’:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h:27:5: warning: return from incompatible pointer type [enabled by default]
     return &_go_macro_handler;
     ^
../goprojects/src/github.com/mitchellh/go-libucl/object.go: At top level:
cc1: warning: unrecognized command line option "-Wno-int-to-void-pointer-cast" [enabled by default]
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -I $WORK/github.com/mitchellh/go-libucl/_obj/ -g -O2 -Ivendor/libucl/include -Wno-int-to-void-pointer-cast -o $WORK/github.com/mitchellh/go-libucl/_obj/parser.cgo2.o -c $WORK/github.com/mitchellh/go-libucl/_obj/parser.cgo2.c
# github.com/mitchellh/go-libucl
In file included from ../goprojects/src/github.com/mitchellh/go-libucl/parser.go:9:0:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h: In function ‘_go_macro_handler_func’:
../goprojects/src/github.com/mitchellh/go-libucl/go-libucl.h:27:5: warning: return from incompatible pointer type [enabled by default]
     return &_go_macro_handler;
     ^
../goprojects/src/github.com/mitchellh/go-libucl/parser.go: At top level:
cc1: warning: unrecognized command line option "-Wno-int-to-void-pointer-cast" [enabled by default]
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_.o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_main.o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_export.o $WORK/github.com/mitchellh/go-libucl/_obj/libucl.cgo2.o $WORK/github.com/mitchellh/go-libucl/_obj/object.cgo2.o $WORK/github.com/mitchellh/go-libucl/_obj/parser.cgo2.o -g -O2 -Lvendor/libucl -lucl -L/usr/local/lib
/home/mjohn/software/go/pkg/tool/linux_386/cgo -objdir $WORK/github.com/mitchellh/go-libucl/_obj/ -dynpackage libucl -dynimport $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_.o -dynout $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_import.go
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -o $WORK/github.com/mitchellh/go-libucl/_obj/_all.o $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_export.o $WORK/github.com/mitchellh/go-libucl/_obj/libucl.cgo2.o $WORK/github.com/mitchellh/go-libucl/_obj/object.cgo2.o $WORK/github.com/mitchellh/go-libucl/_obj/parser.cgo2.o -g -O2 -Lvendor/libucl -L/usr/local/lib -Wl,-r -nostdlib /usr/lib/gcc/i686-linux-gnu/4.8/libgcc.a -Wl,--build-id=none
/home/mjohn/software/go/pkg/tool/linux_386/compile -o $WORK/github.com/mitchellh/go-libucl.a -trimpath $WORK -p github.com/mitchellh/go-libucl -buildid 5ac1cbfe92bc789090340a6a16bd1f9cfdfa399b -D _/home/mjohn/workspaces/goprojects/src/github.com/mitchellh/go-libucl -I $WORK -pack ./decoder.go $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_gotypes.go $WORK/github.com/mitchellh/go-libucl/_obj/libucl.cgo1.go $WORK/github.com/mitchellh/go-libucl/_obj/object.cgo1.go $WORK/github.com/mitchellh/go-libucl/_obj/parser.cgo1.go $WORK/github.com/mitchellh/go-libucl/_obj/_cgo_import.go
pack r $WORK/github.com/mitchellh/go-libucl.a $WORK/github.com/mitchellh/go-libucl/_obj/_all.o # internal
command-line-arguments
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /home/mjohn/workspaces/ssengine-ng
/home/mjohn/software/go/pkg/tool/linux_386/compile -o $WORK/command-line-arguments.a -trimpath $WORK -p main -complete -buildid a96bfcd545f64c19539e7da30ab0c806d80d1c50 -D _/home/mjohn/workspaces/ssengine-ng -I $WORK -I /home/mjohn/workspaces/goprojects/pkg/linux_386 -pack ./ssengine.go
cd .
/home/mjohn/software/go/pkg/tool/linux_386/link -o $WORK/command-line-arguments/_obj/exe/ssengine -L $WORK -L /home/mjohn/workspaces/goprojects/pkg/linux_386 -w -extld=gcc -buildmode=exe -buildid=a96bfcd545f64c19539e7da30ab0c806d80d1c50 $WORK/command-line-arguments.a
$WORK/command-line-arguments/_obj/exe/ssengine
/tmp/go-build303126320/command-line-arguments/_obj/exe/ssengine: error while loading shared libraries: libucl.so.3: cannot open shared object file: No such file or directory
exit status 127

aka-mj avatar Sep 10 '15 19:09 aka-mj