Hi Ian, Here is the build output --
FYI -- The path: /<path>/goLang/goCode/src/eventbridge/EventBridge.c was where I had compiled the C library using the gcc toolchain. I copied this compiled library to my project and statically linked it. Path to my project is at /<path>/goLang/goCode/src/agent/ >echo $SHELL /bin/csh >pwd /<path>/goLang/goCode/src/agent >echo $GOPATH /<path>/goLang/goCode >go version go version go1.7.1 linux/amd64 >gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) >go build # agent /<path>/goLang/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /<path>/tmp/go-link-022070709/000001.o: In function `putStringToBuffer': /<path>/goLang/goCode/src/eventbridge/EventBridge.c:31: multiple definition of `putStringToBuffer' /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:31: first defined here /<path>/tmp/go-link-022070709/000001.o: In function `ReceiveEventBuffer': /<path>/goLang/goCode/src/eventbridge/EventBridge.c:446: multiple definition of `ReceiveEventBuffer' /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:446: first defined here /<path>/tmp/go-link-022070709/000001.o: In function `getStringFromBuffer': /<path>/goLang/goCode/src/eventbridge/EventBridge.c:37: multiple definition of `getStringFromBuffer' /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:37: first defined here : : : goes to point out multiple declaration error for each of the function defined in the library LIBA Thanks! Sriram On Saturday, October 29, 2016 at 3:29:59 AM UTC+5:30, Ian Lance Taylor wrote: > > On Wed, Oct 26, 2016 at 11:15 PM, <pat.s...@gmail.com <javascript:>> > wrote: > > > > 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 > > What is the actual error? > > 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.