On Tue, Jan 22, 2019, 8:27 AM snmed <sandro.p.da...@gmail.com> wrote:

> Hi thanks,
>
> Ah yes, it seems that i forgot that with the static library. Now i've the
> static library under ./libs folder and i use this command:
> go build -ldflags '-L./libs -w -extldflags "-static"' -a
>
> but now i get this message:
> flag provided but not defined: -L./libs
>
> usage: link [options] main.o
>
>   -B note
>
>         add an ELF NT_GNU_BUILD_ID note when using ELF
>
>   -D address
>
>         set data segment address (default -1)
>
>   -E entry
>
>         set entry symbol name
>
>   -H type
>
>         set header type
>
>   -I linker
>
> ...rest omitted for brevity
>
> am i using the command wrong or is there a flag i'm missing?
>

That is the flag for the Go tool linker. Check out this page:
https://golang.org/cmd/cgo/

You can either define external linking options within your source or with
CGO_LDFLAGS env var



> Am Montag, 21. Januar 2019 17:40:54 UTC+1 schrieb Kurtis Rader:
>>
>> You say you "verified that all necessary libs are under /lib64." Do you
>> actually have static versions of those libraries or just dynamic versions?
>> For example, on macOS I only have dynamic (ending in .dylib) versions so it
>> isn't possible to statically link a binary that requires those libraries.
>> The "file" command should tell you whether the library is dynamic or
>> static. But in general a static lib will have a ".a" extension and dynamic
>> libs will have a ".so" or ".dylib" extension. "In general" because this is
>> platform dependent and you could be working on a platform with different
>> conventions.
>>
>> On Mon, Jan 21, 2019 at 7:50 AM snmed <sandro....@gmail.com> wrote:
>>
>>> Hi all
>>>
>>> I try to compile and statically link the following example:
>>> https://github.com/rthornton128/goncurses/tree/master/examples/curs_menu
>>> I use this command:
>>> go build -ldflags '-w -extldflags "-static"' -a
>>>
>>> Unfortunately i get only this:
>>> /usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
>>>
>>> /usr/bin/ld: cannot find -lformw
>>>
>>> /usr/bin/ld: cannot find -lmenuw
>>>
>>> /usr/bin/ld: cannot find -lncursesw
>>>
>>> /usr/bin/ld: cannot find -lpanelw
>>>
>>> collect2: error: ld returned 1 exit status
>>>
>>>
>>>
>>> I have verified that all necessary libs are under /lib64, but the linker
>>> still complains. I'd appreciate any clues on this topic.
>>>
>>> Cheers,
>>>
>>> --
>>> 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...@googlegroups.com.
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>>
> --
> 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.
>

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