Bug 2363088 - Review Request: ocaml-camlpdf - OCaml library for reading, writing, and modifying PDFs
Summary: Review Request: ocaml-camlpdf - OCaml library for reading, writing, and modif...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/johnwhitington/cam...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-04-30 11:37 UTC by John Whitington
Modified: 2025-05-12 12:24 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description John Whitington 2025-04-30 11:37:15 UTC
Spec URL: https://coherentpdf.com/fedora/ocaml-camlpdf.spec
SRPM URL: https://coherentpdf.com/fedora/ocaml-camlpdf-2.8.1-1.fc41.src.rpm
Description: OCaml library for reading, writing and modifying PDFs. The basis of the Cpdf command line tools.
Fedora Account System Username: johnwhitington

Notes:

1. I have included an ExcludeArch for i686, but Koji seems to ignore it.

2. The %build/%install sections are not gated on ocaml_native_compiler because CamlPDF's build system already knows how to detect bytecode-only environments.

3. Lint errors:

ocaml-camlpdf.x86_64: W: unstripped-binary-or-object/usr/lib64/ocaml/stublibs/dllcampdf_stubs.so
ocaml-camlpdf-devel.x86_64: E: static-library-without-debuginfo/usr/lib64/ocaml/camlpdf/camlpdf.a
ocaml-camlpdf-devel.x86_64: E: static-library-without-debuginfo/usr/lib64/ocaml/camlpdf/libcamlpdf_stubs.a

These seem to be common with OCaml packages.

ocaml-camlpdf-devel.x86_64: W: no-documentation

Q: Where, if anywhere, should the HTML ocamldoc output be installed? Other packages don't seem to install it.

ocaml-camlpdf.spec: W: no-%check-section
ocaml-camlpdf.spec: W: no-%check-section

Q: What if anything is appropriate here?

Comment 1 Fedora Review Service 2025-04-30 12:04:43 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/8982518
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2363088-ocaml-camlpdf/fedora-rawhide-x86_64/08982518-ocaml-camlpdf/fedora-review/review.txt

Please take a look if any issues were found.


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 2 Richard W.M. Jones 2025-05-02 11:54:17 UTC
Instead of the ExcludeArch, use:

ExclusiveArch: %{ocaml_native_compiler}

(assuming, as you probably do, you want to ignore bytecode arches).  This macro is provided by this package and updated regularly:

https://src.fedoraproject.org/rpms/ocaml-srpm-macros/commits/rawhide

Unless there's a very good reason, you should drop this:

%global debug_package %{nil}

Your build system should be fixed to make sure that -g is passed to every compiler invocation
(maybe with a configure-time switch to turn this on or off if you prefer).

Also I'm confused about why you need to limit _smp_ncpus_max to 1, what is the reason for that?

Comment 3 John Whitington 2025-05-02 15:25:59 UTC
Thanks Richard:

1. ExclusiveArch %{ocaml_native_compiler}. Thanks. Fixed.

2. %global debug_package %{nil}. Fails if removed. When compiling CamlPDF, the only invocations without -g are when ocamlc compiles .mli files. Is it really needed there? If so, I'll see if it can be fixed, though it may involve hackery.

3. _smp_ncpus_max to 1. This is because OCamlMakefile breaks under -j.

Comment 4 Richard W.M. Jones 2025-05-02 15:31:54 UTC
It shouldn't be needed to use -g for *.mli files (although I don't think it hurts).
What's the error message?

Comment 5 John Whitington 2025-05-02 16:07:47 UTC
Excerpt:

+ /usr/bin/find-debuginfo -j1 --strict-build-id -m -i --build-id-seed 2.8.1-1.fc41 --unique-debug-suffix -2.8.1-1.fc41.x86_64 --unique-debug-src-base ocaml-camlpdf-2.8.1-1.fc41.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /builddir/build/BUILD/ocaml-camlpdf-2.8.1-build/camlpdf-2.8.1
find-debuginfo: starting
Extracting debug info from 1 files
Error while writing index for `/builddir/build/BUILD/ocaml-camlpdf-2.8.1-build/BUILDROOT/usr/lib64/ocaml/stublibs/dllcamlpdf_stubs.so': No debugging symbols
gdb-add-index: No index was created for /builddir/build/BUILD/ocaml-camlpdf-2.8.1-build/BUILDROOT/usr/lib64/ocaml/stublibs/dllcamlpdf_stubs.so
gdb-add-index: [Was there no debuginfo? Was there already an index?]
DWARF-compressing 1 files
sepdebugcrcfix: Updated 0 CRC32s, 1 CRC32s did match.
Creating .debug symlinks for symlinks to ELF files
find-debuginfo: done

Full log: https://coherentpdf.com/fedora/build.log

(Sidenote: I copied the %global debug_package %{nil} from here https://docs.fedoraproject.org/en-US/packaging-guidelines/OCaml/ so if that's wrong, it wants updating...)

Comment 6 Richard W.M. Jones 2025-05-02 16:34:51 UTC
It seems as if it's very specifically complaining about dllcamlpdf_stubs.so.
Since that has the C bindings but you're not passing "-g" in the -ccopt list
(ie. to the C compiler), maybe that's the problem?

Comment 7 John Whitington 2025-05-05 12:36:42 UTC
Thanks. I have patched Makefile (and, in fact, OCamlMakefile too, since it wasn't passing -ccopts when building with -custom). There are now no complaints in the build log about debug information extraction. Fedpkg lint still fails with this, however:

ocaml-camlpdf-devel.x86_64: E: static-library-without-debuginfo /usr/lib64/ocaml/camlpdf/camlpdf.a
ocaml-camlpdf-devel.x86_64: E: static-library-without-debuginfo /usr/lib64/ocaml/camlpdf/libcamlpdf_stubs.a

Koji builds ok.

Here's the updated spec file, patch file, and srpm:

https://www.coherentpdf.com/fedora/ocaml-camlpdf-2.zip

And here's the build log:

https://www.coherentpdf.com/fedora/build.log

Comment 8 John Whitington 2025-05-05 12:57:58 UTC
Actually, that OCamlmakefile change may be wrong and/or unneeded. Let me take a look.

Comment 9 John Whitington 2025-05-05 13:44:26 UTC
Right. It seems that the OCamlMakefile part of the patch (where we pass -ccopt "-o2 -g" even when building with -custom):

a) Isn't required for the mockbuild debuginfo extraction to succeed. Just fixing Makefile alone fixes that.

b) Means that when I build cpdf (which uses camlpdf) I get a cpdf.dSYM folder created, which was not previously the case. Is that good?

c) -o2 here causes problems. So if we keep the OCamlMakefile part of the patch, we need to drop -o2. Which is fine.

Here, for reference is the patch:

--- Makefile.orig	2025-05-03 14:53:49.000000000 +0100
+++ Makefile	2025-05-03 14:53:30.000000000 +0100
@@ -10,7 +10,7 @@
 
 RESULT = camlpdf
 
-CFLAGS = -o2
+CFLAGS = -o2 -g
 OCAMLFLAGS = -bin-annot
 OCAMLNCFLAGS = -g -safe-string
 OCAMLBCFLAGS = -g -safe-string
--- OCamlMakefile.orig	2025-05-03 16:07:01.000000000 +0100
+++ OCamlMakefile	2025-05-03 16:06:47.000000000 +0100
@@ -614,7 +614,7 @@
 
 ifneq ($(strip $(OBJ_LINK)),)
   ifdef CREATE_LIB
-    OBJS_LIBS := -cclib -l$(CLIB_BASE) $(CLIBS_OPTS) $(MAYBE_IDL)
+    OBJS_LIBS := -ccopt "$(CFLAGS)" -cclib -l$(CLIB_BASE) $(CLIBS_OPTS) $(MAYBE_IDL)
   else
     OBJS_LIBS := $(OBJ_LINK) $(CLIBS_OPTS) $(MAYBE_IDL)
   endif

Comment 10 John Whitington 2025-05-12 12:24:08 UTC
For clarity, I have prepared two srpm/spec/patch/build-log archives:

1. With the minimal patch, just to Makefile:

https://www.coherentpdf.com/fedora/ocaml-camlpdf-minpatch.zip

2. With both that and the patch to OCamlMakefile:

https://www.coherentpdf.com/fedora/ocaml-camlpdf-maxpatch.zip

In both cases the Koji build works, and there are no debug extraction errors in the build log.


Note You need to log in before you can comment on or make changes to this bug.