Giter Site home page Giter Site logo

Comments (5)

gen2brain avatar gen2brain commented on August 16, 2024

You are building with -tags extlib,pkgconfig,extlib,pkgconfig, so it expects you to install mupdf libraries and all dependencies and will not use bundled static libraries.

from go-fitz.

gen2brain avatar gen2brain commented on August 16, 2024

But then again, it wants mupdf_linux_amd64, which is a static library bundled, it would need only -lmudpf in that case. No idea, can you build with go build? Does bazel uses go build or some of their implementation?

Btw. also check #31

from go-fitz.

LuizEduardoCardozo avatar LuizEduardoCardozo commented on August 16, 2024

The tags was a test that I did before. I updated the error file to the version without it, and the error is the same...

The project builds normally with go build, the problem only occurs with bazel build.

And I think yes, the bazel just wraps the go compiler. I'm looking in the go_rules repository to check for some "default tags" that could be the cause.

The "-lmupdf" is being used, but it's in go-fitz BUILD.bazel. This error is caused by it: I tell to bazel use the mupdf lib, but it's doesn't find it.

from go-fitz.

gen2brain avatar gen2brain commented on August 16, 2024

No idea, as you can see from the previous bazel issue it seemed like it does not respect build tags at all, it enabled them all by default and that is not how it should work.

Anyway, nothing that I can fix here, this library is specific in that it includes static libraries, so vendoring will not work then (it will not copy libraries), etc. unless you use your external libraries and extlib tag.

from go-fitz.

wisechengyi avatar wisechengyi commented on August 16, 2024

To follow up, we found a way to build it in bazel, here is a manual diff on top of what can be generated automatically by gazelle, which essentially does two things

  1. include the header files directly into go_library
  2. put .a files into a cc_library target and add to the go_library as cdeps, inspired by bazelbuild/bazel-gazelle#1120 (comment)
diff --git a/BUILD.bazel b/BUILD.bazel
index e8ba74f..2dc361d 100755
--- a/BUILD.bazel
+++ b/BUILD.bazel
 
+cc_library(
+    name = "clib",
+    srcs = select({
+        "@io_bazel_rules_go//go/platform:darwin_amd64": [
+            "libs/libmupdf_darwin_amd64.a",
+            "libs/libmupdfthird_darwin_amd64.a",
+        ],
+        "@io_bazel_rules_go//go/platform:darwin_arm64": [
+            "libs/libmupdf_darwin_arm64.a",
+            "libs/libmupdfthird_darwin_arm64.a",
+        ],
+        "@io_bazel_rules_go//go/platform:linux_amd64": [
+            "libs/libmupdf_linux_amd64.a",
+            "libs/libmupdfthird_linux_amd64.a",
+        ],
+        "@io_bazel_rules_go//go/platform:linux_arm64": [
+            "libs/libmupdf_linux_arm64.a",
+            "libs/libmupdfthird_linux_arm64.a",
+        ],
+        "//conditions:default": ["UNSUPPORTED_PLATFORM"],
+    }),
+)
+
 go_library(
     name = "fitz",
     srcs = [
         "fitz.go",
         "fitz_cgo.go",
         "fitz_content_types.go",
-    ],
+    ] + glob(["include/**/*.h"]),
+    cdeps = [":clib"],
     cgo = True,

from go-fitz.

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.