Hi,

I need to build go with an archive file which requires to be linked with 
the option "-Wl,--whole-archive" on linux or "-Wl,-all_load" on macos.

My go file contains this code:

/*

*#cgo darwin LDFLAGS: -L.. -Wl,-all_load -lmy_lib* 
#cgo linux LDFLAGS: -L.. -Wl,--whole-archive -lmy_lib 

*/
import "C"

When I try to compile on Linux or Mac, this doesn't work. I read these 
errors:

Mac:

go build _/Users/thierryfournier/git/my-lib/my_lib: invalid flag in #cgo 
LDFLAGS: -Wl,-all_load 

Linux:

go build _/home/thierry/my_lib/my_lib: invalid flag in #cgo LDFLAGS: 
-Wl,--whole-archive 

I test the local link on both OS, and the option exists and works for c.

So, i don’t found any way to embed the whole library.

   - I don’t find a way to understand how the linker is called
   - I don’t find documentation about supported flag.

If anyone has a solution or a clue, it will be welcome

Thanks,
Thierry

-- 
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/ee488437-4411-4757-9854-3405d55527e9n%40googlegroups.com.

Reply via email to