FAQ
Ran into a problem linking a C library into my Go application (Go tip &
Windows 7). I did find a workaround, but I am at a loss to understand why
it works.

The C library is https://github.com/hcatlin/libsass. 'make shared'
generates libsass.so and 'make static' generates libsass.a

The Go wrapper is https://github.com/suapapa/go_sass. 'go install'
generates go_sass.a (file size 127KB).

The library and wrapper compile without error. However, the initial build
of my app produced the errors:

C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_new_context: not defined
C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_free_context: not defined
C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_compile: not defined
C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_new_file_context: not defined
C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_free_file_context: not defined
C:\DevBin\Go\ext\pkg\windows_386/github.com/suapapa/go_sass.a(libsass_wrapper.)(.text):
sass_compile_file: not defined
sass_compile_file(0): not defined
sass_free_file_context(0): not defined
sass_new_file_context(0): not defined
sass_compile(0): not defined
sass_free_context(0): not defined
sass_new_context(0): not defined

After searching, thinking, and a few too many WAGs, I found that renaming
libsass.so to libsass.dll and removing libsass.a works. 'go install'
generates a go_sass.a (file size 120KB) and my app links and runs as
expected. Renaming libsass.so to libsass.a also works. Having just
libsass.so without any libsass.dll or libsass.a does not work. The error
in this case is:

ld.exe: cannot find -lsass

Is the need to rename correct? Or, is there something else going on here?

Thanks...

--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 17, '13 at 9:33p
activeMar 17, '13 at 9:33p
posts1
users1
websitegolang.org

1 user in discussion

Gbr: 1 post

People

Translate

site design / logo © 2023 Grokbase