On Fri, Sep 01, 2017 at 04:28:52AM -0400, Yongkui Guo wrote:
> > stamp-mlguestfs: libguestfsocaml.a $(guestfs_cmm)
> > $(OCAMLMKLIB) -o mlguestfs \
> > $(libguestfsocaml_a_OBJECTS) guestfs.cmo \
> > $(LDFLAGS) \
> > $(LTLIBINTL) \
> > - -L../lib/.libs -lguestfs
> > + -L../lib/.libs -lguestfs \
> > + -L../gnulib/lib/.libs -lgnu
[...]
> ocamlmklib -o mlguestfs \
> libguestfsocaml_a-guestfs-c.o libguestfsocaml_a-guestfs-c-actions.o
> libguestfsocaml_a-guestfs-c-errnos.o
> ../common/utils/libguestfsocaml_a-utils.o guestfs.cmo \
> -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
The problem is unrelated to the patch.
$(LDFLAGS) are added to the ocamlmklib command, but ocamlmklib only
understands a limited subset of linker flags, including -L but not
including -Wl.
Possibly something like this might work:
stamp-mlguestfs: libguestfsocaml.a $(guestfs_cmm)
$(OCAMLMKLIB) -o mlguestfs \
$(libguestfsocaml_a_OBJECTS) guestfs.cmo \
- $(LDFLAGS) \
+ -ldopt '$(LDFLAGS)' \
$(LTLIBINTL) \
-L../lib/.libs -lguestfs
(in all the places where $(LDFLAGS) is passed to ocamlmklib).
Unfortunately, it still didn't work well. Should I need to modify Makefile.am in
/home/mockbuild/rpmbuild/BUILD/libguestfs-1.36.5/ocaml/examples?
-------------------------------------------------
ocamlfind ocamlc -g -annot -warn-error CDEFLMPSUVYZX-3 -package unix -c guestfs.ml -o
guestfs.cmo
ocamlfind ocamlopt -g -annot -warn-error CDEFLMPSUVYZX-3 -package unix -c guestfs.ml -o
guestfs.cmx
rm -f libguestfsocaml.a
ar cr libguestfsocaml.a libguestfsocaml_a-guestfs-c.o
libguestfsocaml_a-guestfs-c-actions.o libguestfsocaml_a-guestfs-c-errnos.o
../common/utils/libguestfsocaml_a-utils.o
ranlib libguestfsocaml.a
ocamlmklib -o mlguestfs \
libguestfsocaml_a-guestfs-c.o libguestfsocaml_a-guestfs-c-actions.o
libguestfsocaml_a-guestfs-c-errnos.o ../common/utils/libguestfsocaml_a-utils.o guestfs.cmo
\
-ldopt '-fprofile-arcs -ftest-coverage -lgcov' \
\
-L../lib/.libs -lguestfs \
-L../gnulib/lib/.libs -lgnu
ocamlmklib -o mlguestfs \
libguestfsocaml_a-guestfs-c.o libguestfsocaml_a-guestfs-c-actions.o
libguestfsocaml_a-guestfs-c-errnos.o ../common/utils/libguestfsocaml_a-utils.o guestfs.cmx
\
-ldopt '-fprofile-arcs -ftest-coverage -lgcov' \
\
-L../lib/.libs -lguestfs \
-L../gnulib/lib/.libs -lgnu
touch stamp-mlguestfs
Warning: Element Unix.error not found
make[2]: Leaving directory `/home/mockbuild/rpmbuild/BUILD/libguestfs-1.36.5/ocaml'
Making all in ocaml/examples
make[2]: Entering directory
`/home/mockbuild/rpmbuild/BUILD/libguestfs-1.36.5/ocaml/examples'
ocamlfind ocamlopt -cclib -L../../lib/.libs -package unix -linkpkg \
-warn-error A -I .. mlguestfs.cmxa create_disk.ml -o create_disk
ocamlfind ocamlopt -cclib -L../../lib/.libs -package unix -linkpkg \
-warn-error A -I .. mlguestfs.cmxa debug_logging.ml -o debug_logging
/usr/bin/ld: cannot find -lgnu
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
make[2]: *** [debug_logging] Error 2
make[2]: *** Waiting for unfinished jobs....
-------------------------------------------------