Coder Social home page Coder Social logo

How to complie in cross platform? about opus HOT 4 CLOSED

hraban avatar hraban commented on July 1, 2024
How to complie in cross platform?

from opus.

Comments (4)

juicechu avatar juicechu commented on July 1, 2024 1

Thank for you answer my question. I got it . I will continue research how to cross compiling CGO.

if i get some advancement, i will write down it.

from opus.

hraban avatar hraban commented on July 1, 2024

你好 :)

I've never tried this, but from what I understand CGO is disabled for cross compiling:

The cgo tool is enabled by default for native builds on systems where it is expected to work. It is disabled by default when cross-compiling. You can control this by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it. The go tool will set the build constraint "cgo" if cgo is enabled. The special import "C" implies the "cgo" build constraint, as though the file also said "// +build cgo". Therefore, if cgo is disabled, files that import "C" will not be built by the go tool. (For more about build constraints see https://golang.org/pkg/go/build/#hdr-Build_Constraints).

You'll need to figure out how to make pkgconfig work for cross compilation, as well, since this opus wrapper relies on pkgconfig to find the header files and libraries to link to.

All in all, this won't be easy. If you do succeed, let me know :) I can add the instructions to the README.

I'm closing this ticket because cross compiling CGO is a separate problem from what this package tries to solve.

Good luck!

from opus.

hraban avatar hraban commented on July 1, 2024

(some background info for clarity: this package , github.com/hraban/opus, is just a GO ↔ C translation layer. The real opus work is done by libopus, a library written in C and maintained by xiph.org. Cross compiling Go is easy, but cross compiling CGO means you need to cross compile the libopus header files as well, so you'll need a cross compiling C compiler. That's why this is tricky.)

from opus.

hraban avatar hraban commented on July 1, 2024

Let me know if you make it work. I'd love to add a section to the README about it.

from opus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.