Comments (3)
You could also use e.g. zig
, something like this CGO_ENABLED=1 CC="zig cc -target x86_64-windows-gnu" GOOS=windows
, or maybe with clang
, i.e. CC="clang --target=x86_64-pc-freebsd" CGO_ENABLED=1 GOOS=freebsd
. In go-fitz case, there are no additional libraries that you need to have, all it needs is to link precompiled static library.
from go-fitz.
You are trying to cross-compile the CGO project. Of course, you cannot just change GOOS and be done. When you cross-compile, the Go will disable CGO, i.e. it will set CGO_ENABLED=0, so enable it, i.e. GOOS=linux CGO_ENABLED=1. Then you will see real errors, i.e. you are missing the correct C toolchain.
from go-fitz.
Thanks, I made further progress on this since I last commented. My problem has nothing to do with Fitz itself, but as you said, cross compiling. I'd like to post what I ended up doing here in case it ever turns up in someone's Google search results.
I figured the easiest way to get around this would be to build from inside of a Docker container. So I made a Dockerfile like so,
FROM golang:1.21.6
RUN apt-get update
RUN apt-get install -y gcc-x86-64-linux-gnu
ENV CGO_ENABLED=1
ENV CC=x86_64-linux-gnu-gcc
Which includes gcc-x86-64-linux-gnu
as a cross compiler, and then built the dockerfile into an image:
docker build -t gobuild:latest .
From there, I used the new image to build my project:
docker run --rm -v "$(CURDIR)":/usr/src/myapp -w /usr/src/myapp gobuild:latest bash -c "export GO111MODULE=on && env GOARCH=amd64 go build -ldflags=\"-s -w\" -o bin/thumbnail cmd/thumbnail/main.go"
And that let me build without errors! I'm running into a further problem there with my serverless function hanging on invocation, but that is likely an entirely unrelated issue.
from go-fitz.
Related Issues (20)
- getting crash for some pdf format HOT 1
- start program HOT 2
- fitz is not importing correctly HOT 2
- centos alpine build faild HOT 5
- Linux platform, when PDF is invalid
- error: cannot find builtin CJK font HOT 2
- outline.page.page undefined (type _Ctype_int has no field or method page) compiler (MissingFieldOrMethod) HOT 6
- libmupdf_linux_amd64.a error HOT 8
- Implement Text Extraction in PyMuPdf Fitz Layout Mode HOT 4
- how to build mupdf static library in window platform HOT 10
- cannot find builtin CJK font HOT 1
- doc.HTML() can it support <table> <tr> <td>? HOT 1
- linux compilation error HOT 3
- linux ubuntu build fail HOT 5
- Makes discord/lilliput segfault HOT 2
- fitz is empty HOT 2
- How to build docker with this package?
- GCC 12.2 Support HOT 10
- Is it possible to add PDF splitting and merging functions? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-fitz.