Ian, thanks for the explanation!

I tried to split the go/swigcxx code and c++ code to two different 
directories as the example given by Stephen earlier. That didn't work. No 
matter what I do, I don't see the flags being passed to the compiler. 

For now, I will simply use the build script and passing all compiler 
parameters explicitly. But this does not seem to be an optimal solution. If 
there is anything else that I can try, please let me know. 

Thanks,
Chun



On Wednesday, March 1, 2017 at 1:20:16 PM UTC-5, Ian Lance Taylor wrote:
>
> On Wed, Mar 1, 2017 at 10:16 AM, Chun Zhang <[email protected] 
> <javascript:>> wrote: 
> > Thanks Ian! But that does not seem to be the issue, I changed 
> libcolor.go to 
> > color.go and still get the same error. 
> > 
> > However, I did made tiny progress, I can specifically pass the 
> parameters in 
> > the CLI and get it build, for example 
> > 
> > CGO_CXXFLAGS="-I$GOPATH/src/kflow/libcolor/include" 
> > CGO_LDFLAGS="-L$GOPATH/src/kflow/libcolor/lib -l:libCOLOR.a 
> > -l:libboost_system.a -l:libboost_regex.a -l:libboost_program_options.a 
> > -l:libboost_filesystem.a -l:libxml2.a -lz" go build -x 
> > 
> > but, the installed libcolor.a in the pkg directory looks suspiciously 
> small, 
> > only 55k, while libCOLOR.a itself is roughly 300MB. I wrote a simple 
> main 
> > file, the application is around 140MB. The numbers do not seem to agree 
> with 
> > each other. 
>
> That does not necessarily indicate a problem.  When the linker sees a 
> .a file, it only pulls in referenced symbols, not the entire archive. 
> So if your program only uses a small part of libCOLOR.a, it would be 
> natural for the program to be smaller than libCOLOR.a.  I don't know 
> whether there is a problem there or not, but the file size doesn't 
> necessarily mean that there is. 
>
> > I do notice though, the 
> > GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 
> > -fdebug-prefix-map=/tmp/go-build471211808=/tmp/go-build 
> > -gno-record-gcc-switches" 
> > in the `go env` output has the -fdebug-prefix-map changed each and 
> > everytime, is that expected? 
>
> Yes.  That option is keeping the Go temporary directory out of the 
> debug info stored in the object file.  This helps makes builds 
> reproducible. 
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to