Re: [go-nuts] Re: CGO: How to link static library across dependent packages?

2019-09-13 Thread Sriram
No, unfortunately I worked around the problem by redesigning the modules

On Thu, Sep 12, 2019, 8:52 PM  wrote:

> Did you find the solution to this problem?  I think I might have the same
> problem.
>
> Also, if there is useful info, and it's not too much trouble, can you link
> to the issue you opened?
> Thanks
>
> On Sunday, October 30, 2016 at 9:18:27 AM UTC-7, Sriram wrote:
>>
>> Sure will do that.. Thanks Ian
>>
>> On Oct 30, 2016 9:37 PM, "Ian Lance Taylor"  wrote:
>>
>>> On Sat, Oct 29, 2016 at 10:22 AM,   wrote:
>>> > Can you please provide more info? If i use the below command to
>>> compile my
>>> > project, the linker error still pops up.
>>> >
>>> > Just to recap,
>>> >
>>> > My packages A and B statically link a common library LIBA. Also,
>>> Package B
>>> > imports A. Compilation of the individual packages is successful but
>>> when i
>>> > try to create a binary (using package main which imports B) I get a
>>> linker
>>> > error for redefinition of the library.
>>> >
>>> >
>>> > I understand that Im linking the library twice (once in package A and
>>> once
>>> > in B) but I cant compile the individual packages without linking it in
>>> each
>>> > of the packages.
>>> >
>>> >
>>> > package A:
>>> >
>>> > package A
>>> > /*
>>> > #cgo LDFLAGS: -Bstatic  ${SRCDIR}/../lib/libeventbridge.a
>>> > */
>>> > import "C"
>>> >
>>> >
>>> > The same thing in package B:
>>> >
>>> > package B
>>> >
>>> > import "A"
>>> > /*
>>> > #cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
>>> > */
>>> > import "C"
>>>
>>> Please open an issue at https://golang.org/issue with a complete
>>> standalone reproduction case.  I'm not really sure what is going on.
>>>
>>> Ian
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/IxNoiFog6sM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/70f1422b-92b6-4be1-ac5f-e7452b1f7e02%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMyu9N1-ytgL6UrVSvYzhkx7DSZUM%2BhDGR4Fg-4zyMurce5PkA%40mail.gmail.com.


Re: [go-nuts] Re: CGO: How to link static library across dependent packages?

2019-09-12 Thread bkirsch1000
Did you find the solution to this problem?  I think I might have the same 
problem.

Also, if there is useful info, and it's not too much trouble, can you link 
to the issue you opened?
Thanks

On Sunday, October 30, 2016 at 9:18:27 AM UTC-7, Sriram wrote:
>
> Sure will do that.. Thanks Ian
>
> On Oct 30, 2016 9:37 PM, "Ian Lance Taylor"  > wrote:
>
>> On Sat, Oct 29, 2016 at 10:22 AM,  > 
>> wrote:
>> > Can you please provide more info? If i use the below command to compile 
>> my
>> > project, the linker error still pops up.
>> >
>> > Just to recap,
>> >
>> > My packages A and B statically link a common library LIBA. Also, 
>> Package B
>> > imports A. Compilation of the individual packages is successful but 
>> when i
>> > try to create a binary (using package main which imports B) I get a 
>> linker
>> > error for redefinition of the library.
>> >
>> >
>> > I understand that Im linking the library twice (once in package A and 
>> once
>> > in B) but I cant compile the individual packages without linking it in 
>> each
>> > of the packages.
>> >
>> >
>> > package A:
>> >
>> > package A
>> > /*
>> > #cgo LDFLAGS: -Bstatic  ${SRCDIR}/../lib/libeventbridge.a
>> > */
>> > import "C"
>> >
>> >
>> > The same thing in package B:
>> >
>> > package B
>> >
>> > import "A"
>> > /*
>> > #cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
>> > */
>> > import "C"
>>
>> Please open an issue at https://golang.org/issue with a complete
>> standalone reproduction case.  I'm not really sure what is going on.
>>
>> Ian
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/70f1422b-92b6-4be1-ac5f-e7452b1f7e02%40googlegroups.com.


Re: [go-nuts] Re: CGO: How to link static library across dependent packages?

2016-10-30 Thread Sriram
Sure will do that.. Thanks Ian

On Oct 30, 2016 9:37 PM, "Ian Lance Taylor"  wrote:

> On Sat, Oct 29, 2016 at 10:22 AM,   wrote:
> > Can you please provide more info? If i use the below command to compile
> my
> > project, the linker error still pops up.
> >
> > Just to recap,
> >
> > My packages A and B statically link a common library LIBA. Also, Package
> B
> > imports A. Compilation of the individual packages is successful but when
> i
> > try to create a binary (using package main which imports B) I get a
> linker
> > error for redefinition of the library.
> >
> >
> > I understand that Im linking the library twice (once in package A and
> once
> > in B) but I cant compile the individual packages without linking it in
> each
> > of the packages.
> >
> >
> > package A:
> >
> > package A
> > /*
> > #cgo LDFLAGS: -Bstatic  ${SRCDIR}/../lib/libeventbridge.a
> > */
> > import "C"
> >
> >
> > The same thing in package B:
> >
> > package B
> >
> > import "A"
> > /*
> > #cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
> > */
> > import "C"
>
> Please open an issue at https://golang.org/issue with a complete
> standalone reproduction case.  I'm not really sure what is going on.
>
> Ian
>

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


Re: [go-nuts] Re: CGO: How to link static library across dependent packages?

2016-10-30 Thread Ian Lance Taylor
On Sat, Oct 29, 2016 at 10:22 AM,   wrote:
> Can you please provide more info? If i use the below command to compile my
> project, the linker error still pops up.
>
> Just to recap,
>
> My packages A and B statically link a common library LIBA. Also, Package B
> imports A. Compilation of the individual packages is successful but when i
> try to create a binary (using package main which imports B) I get a linker
> error for redefinition of the library.
>
>
> I understand that Im linking the library twice (once in package A and once
> in B) but I cant compile the individual packages without linking it in each
> of the packages.
>
>
> package A:
>
> package A
> /*
> #cgo LDFLAGS: -Bstatic  ${SRCDIR}/../lib/libeventbridge.a
> */
> import "C"
>
>
> The same thing in package B:
>
> package B
>
> import "A"
> /*
> #cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
> */
> import "C"

Please open an issue at https://golang.org/issue with a complete
standalone reproduction case.  I'm not really sure what is going on.

Ian

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


[go-nuts] Re: CGO: How to link static library across dependent packages?

2016-10-29 Thread kumargv
Hi Mate,

why Don't you try to make a static binary 

go build --ldflags ' -extldflags "-static"' filename.go

On Thursday, October 27, 2016 at 8:10:55 PM UTC+5:30, pat.s...@gmail.com 
wrote:
>
> Folks,
>
> Two of my packages have dependency on the same C library. I have linked 
> them successfully using the LDFLAGS directives. 
>
> But I'm facing a multiple definitions error when linking my project 
> executable
>
>
> Here is an overview of my project structure:
>
> Pkg A -> depends on LIBA
>
> Pkg B (imports Pkg A) -> and also depends on LIBA
>
> Pkg Main imports B
>
>
> Commands used to build: In Pkg Main directory: go build
>
>
>
> Appreciate any thoughts on this issue
>
>
> 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.