gohttplib icon indicating copy to clipboard operation
gohttplib copied to clipboard

examples/python: Link against c-archive?

Open shazow opened this issue 10 years ago • 4 comments

We got our example working with go build -buildmode=c-shared but haven't been able to get it working with the file produced by go build -buildmode=c-archive. Would be nice to link against the same thing from both the C and Python examples.

Or at least figure out why it's not working.

shazow avatar Jun 24 '15 20:06 shazow

My guess was that we needed to use extra_link_args=["gohttplib.a"] (or maybe -static go httplib.a) to get c-archive mode to work.

wolever avatar Jun 24 '15 20:06 wolever

My guess was that we needed to use extra_link_args=["gohttplib.a"] to get c-archive mode to work.

Then this happens:

ld: illegal text-relocation to 'type..eq.[0]string' in ../../build/gohttplib.a(go.o) from 'runtime.rodata' in ../../build/gohttplib.a(go.o) for architecture x86_64
clang: error: linker command failed with exit code 1

I think the problem might be that cffi runs the compile with -dynamic and this would need -static?

shazow avatar Jun 24 '15 20:06 shazow

Mmm… and if you run the compile "by hand" without -dynamic does that work?

wolever avatar Jun 24 '15 20:06 wolever

Hmm will need to strace the command and try it. Though reading up more, getting the sense c-shared mode should be sufficient if/when #6 is done.

shazow avatar Jun 24 '15 21:06 shazow