K
K
khevse2015-09-12 02:02:06
go
khevse, 2015-09-12 02:02:06

[golang] How to statically link c++ libraries on build?

Hello.
I am unable to statically link libraries compiled with golang and c++ (mingw) ( assembly was tested for windows only ).
Errors while compiling:
build option #2 : utils\compressor.go:4:2: no buildable Go source files in .....\ConfRobber\src\zlibwrapper
build option #3 : error linking c++ library "libzlibstatic. a":
zlibwrapper(.text): inflateInit2_: not defined
zlibwrapper(.text): inflate: not defined
zlibwrapper(.text): inflateEnd: not defined
zlibwrapper(.text): deflateInit2_: not defined
...
Program code : https://github.com/khevse/ConfRobber
At the root of the project is the build.bat file , which contains the order of my actions and build options
Clarifications to the solution:
1 The most interesting option is to build the project using golang.
2. Dynamic linking of libraries does not suit, because
there are too many problems when migrating an executable to another machine.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
khevse, 2015-09-14
@khevse

Thanks everyone, the issue has been resolved.
It turned out to be partially static, i.e. the wrapper is statically linked, and the rest of the libraries go as 3rd-Party.
Of the disadvantages of working with MinGW, there is no way to statically link the gcc and stdc ++ libraries. Because of this,
you have to drag along with the executable file of the library libgcc_s_seh-1.dll and libstdc++-6.dll. But this is exclusively a feature of working with MinGW.

B
beduin01, 2015-09-12
@beduin01

As far as I know, Go cannot be linked from C++. Only a very limited number of third-party language compilers like https://github.com/Syniurge/Calypso support direct linking to C++

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question