0

I am building the shared library which can be used for my python program using command.

go build -o program.so -buildmode=c-shared myprogram/program.go

However, it seems that for me to use the shared library on another machine, I have to include all the source code. Otherwise, I would get OSError: invalid ELF header.

Is using the shared library without source code possible?

1 Answer 1

4

Library is a binary artifact and will only work on same architecture as it was built for. OSError: invalid ELF header means the library is for different architecture (e.g. library built on x86_64 Linux won't load on arm Linux, x86_64 MacOS X and so on).

Use without source code is perfectly possible if you build library binaries for all architectures (CPU and OS) where your users intend to use it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.