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

Cannot build from source #76

Closed
ysimonson opened this issue Apr 20, 2015 · 8 comments
Closed

Cannot build from source #76

ysimonson opened this issue Apr 20, 2015 · 8 comments

Comments

@ysimonson
Copy link

Hello, I got the following error when attempting to go get:

$ go get -u github.com/wellington/wellington
# github.com/wellington/go-libsass
could not determine kind of name for C.Sass_Function_Entry
could not determine kind of name for C.Sass_Function_Fn
could not determine kind of name for C.Sass_Function_List
could not determine kind of name for C.sass_context_get_included_files_size

clang errors for preamble:
wellington/go-libsass/context.go:7:64: error: unknown type name 'Sass_Function_Entry'
 union Sass_Value* CallSassFunction( union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Options* opts ) {
                                                               ^
1 error generated.

For reference:

$ go version
go version go1.4.2 darwin/amd64

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ysimonson/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.4.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

~/go/src/github.com/wellington/go-libsass/libsass-src is empty, so I suspect it's trying to statically link against my brew installed version of libsass.

@drewwells
Copy link
Member

You'll need to have libsass.pc in your PKG_CONFIG_PATH to use go get. Since you have the source now, do these steps to build libsass and see if everything is working.

cd $GOPATH/src/github.com/wellington/libsass
make deps test

This will build libsass for you and do a test with a modified PKG_CONFIG_PATH. Setting PKG_CONFIG_PATH to .../go-libsass/lib/pkgconfig after running that command will make subsequent go build|test work

@drewwells
Copy link
Member

Ahh yeah, you'll need libsass source to do these steps. I'll add a make task for that. To get going

git submodule sync
git submodule update --init

Thanks for testing this out!

@ysimonson
Copy link
Author

Thanks for pointers!

I was having trouble still getting the tests to pass, and I see you already committed the fix on go-libsass, so I wiped out $GOPATH/src/github.com/wellington and started from scratch.

I think I'm doing this right now, but still getting the same error:

$ export PKG_CONFIG_PATH=$GOPATH/src/github.com/wellington/libsass/lib/pkgconfig
$ go get -u github.com/wellington/wellington
# github.com/wellington/go-libsass
could not determine kind of name for C.Sass_Function_Entry
could not determine kind of name for C.Sass_Function_Fn
could not determine kind of name for C.Sass_Function_List
could not determine kind of name for C.sass_context_get_included_files_size

clang errors for preamble:
wellington/go-libsass/context.go:7:64: error: unknown type name 'Sass_Function_Entry'
 union Sass_Value* CallSassFunction( union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Options* opts ) {
                                                               ^
1 error generated.

So I tried make deps test on go-libsass and got this:

$ make deps test
...
Makefile.am:30: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:30:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:30:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:30:   If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:30:   its definition is in aclocal's search path.
/usr/local/Cellar/automake/1.15/share/automake-1.15/am/ltlibrary.am: warning: 'libsass.la': linking libtool libraries using a non-POSIX
/usr/local/Cellar/automake/1.15/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
Makefile.am:30:   while processing Libtool library 'libsass.la'
Makefile.am:92: warning: source file '$(SASS_SASSC_PATH)/sassc.c' is in a subdirectory,
Makefile.am:92: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
Makefile.am: installing 'script/depcomp'
parallel-tests: installing 'script/test-driver'
autoreconf: automake failed with exit status: 1
make: *** [deps] Error 1

@ysimonson
Copy link
Author

Ah, just needed to install libtool! Looks like that part fixed. Will report back once everything is passing tests.

@ysimonson
Copy link
Author

Got it! For posterity, the only other thing is that PKG_CONFIG_PATH=$GOPATH/src/github.com/wellington/go-libsass/lib/pkgconfig (i.e. go-libsass rather than libsass.)

Thanks again @drewwells .

@drewwells
Copy link
Member

Sorry this part will be very hard until there's better support for building C++ with Go which isn't supported. Could you list any brew packages you needed to get this going ie. libtool? I'll add them to the readme

@ysimonson ysimonson reopened this Apr 20, 2015
@ysimonson
Copy link
Author

Sorry, didn't mean to re-open.

I brew installed autoconf, automake and libtool.

I also brew installed mercurial, but I can't remember if that was for this or v8, which I was building at the same time.

I already had pkg-config, which I'm guessing is required as well.

@drewwells
Copy link
Member

I probably have some dependency using mercurial, so Go will complain about it. Thanks ! I'll update readme with those.

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

2 participants