pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ocaml: linker uses $PTHREAD_CFLAGS



Module Name:	pkgsrc-wip
Committed By:	Atsushi Toyokura <asteria.at%gmail.com@localhost>
Pushed By:	steleto
Date:		Sun Sep 27 21:47:49 2026 +0900
Changeset:	75852504dcb3941c08db787f8cf7bdb49f291dc1

Modified Files:
	ocaml/PLIST
	ocaml/buildlink3.mk
	ocaml/distinfo
	ocaml/native.mk
	ocaml/ocaml.mk
Added Files:
	ocaml/patches/patch-asmcomp_asmlink.ml

Log Message:
ocaml: linker uses $PTHREAD_CFLAGS

When building outside of pkgsrc, Autoconf's AX_PTHREAD returns
$PTHREAD_CFLAGS="-pthread" and and $PTHREAD_LIBS="-lpthread".
However, for some reason, inside pkgsrc returns
$PTHREAD_CFLAGS="-pthread" and and $PTHREAD_LIBS="".
Therefore, linker loses pthread library, resulting in an error.

By the way, AX_PTHREAD assumes to not only compiler with cflags,
but also link with them. So, as a test, I tried adding
'Config.native_cflags' to linker, it working.

https://www.gnu.org/software/autoconf-archive/ax_pthread.html

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=75852504dcb3941c08db787f8cf7bdb49f291dc1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 ocaml/PLIST                            | 21 +++++++++++++++++----
 ocaml/buildlink3.mk                    |  4 ++--
 ocaml/distinfo                         |  1 +
 ocaml/native.mk                        |  3 ++-
 ocaml/ocaml.mk                         |  4 ++--
 ocaml/patches/patch-asmcomp_asmlink.ml | 27 +++++++++++++++++++++++++++
 6 files changed, 51 insertions(+), 9 deletions(-)

diffs:
diff --git a/ocaml/PLIST b/ocaml/PLIST
index a892c8a989..b7fb3733cf 100644
--- a/ocaml/PLIST
+++ b/ocaml/PLIST
@@ -242,6 +242,7 @@ lib/ocaml/compiler-libs/ast_mapper.mli
 lib/ocaml/compiler-libs/asttypes.cmi
 lib/ocaml/compiler-libs/asttypes.cmt
 lib/ocaml/compiler-libs/asttypes.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/asttypes.cmx
 lib/ocaml/compiler-libs/asttypes.mli
 lib/ocaml/compiler-libs/attr_helper.cmi
 lib/ocaml/compiler-libs/attr_helper.cmt
@@ -317,6 +318,7 @@ lib/ocaml/compiler-libs/bytepackager.mli
 lib/ocaml/compiler-libs/byterntm.cmi
 lib/ocaml/compiler-libs/byterntm.cmt
 lib/ocaml/compiler-libs/byterntm.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/byterntm.cmx
 lib/ocaml/compiler-libs/byterntm.mli
 lib/ocaml/compiler-libs/bytesections.cmi
 lib/ocaml/compiler-libs/bytesections.cmt
@@ -513,6 +515,7 @@ lib/ocaml/compiler-libs/ctype.mli
 lib/ocaml/compiler-libs/data_types.cmi
 lib/ocaml/compiler-libs/data_types.cmt
 lib/ocaml/compiler-libs/data_types.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/data_types.cmx
 lib/ocaml/compiler-libs/data_types.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/dataflow.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/dataflow.cmt
@@ -610,6 +613,7 @@ lib/ocaml/compiler-libs/errortrace.mli
 lib/ocaml/compiler-libs/errortrace_report.cmi
 lib/ocaml/compiler-libs/errortrace_report.cmt
 lib/ocaml/compiler-libs/errortrace_report.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/errortrace_report.cmx
 lib/ocaml/compiler-libs/errortrace_report.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/export_id.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/export_id.cmt
@@ -673,6 +677,7 @@ ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/flambda_utils.mli
 lib/ocaml/compiler-libs/format_doc.cmi
 lib/ocaml/compiler-libs/format_doc.cmt
 lib/ocaml/compiler-libs/format_doc.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/format_doc.cmx
 lib/ocaml/compiler-libs/format_doc.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/freshening.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/freshening.cmt
@@ -687,6 +692,7 @@ lib/ocaml/compiler-libs/genprintval.mli
 lib/ocaml/compiler-libs/gprinttyp.cmi
 lib/ocaml/compiler-libs/gprinttyp.cmt
 lib/ocaml/compiler-libs/gprinttyp.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/gprinttyp.cmx
 lib/ocaml/compiler-libs/gprinttyp.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/id_types.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/id_types.cmt
@@ -859,6 +865,7 @@ ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/linkage_name.mli
 lib/ocaml/compiler-libs/linkdeps.cmi
 lib/ocaml/compiler-libs/linkdeps.cmt
 lib/ocaml/compiler-libs/linkdeps.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/linkdeps.cmx
 lib/ocaml/compiler-libs/linkdeps.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/linscan.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/linscan.cmt
@@ -997,6 +1004,7 @@ lib/ocaml/compiler-libs/optmaindriver.mli
 lib/ocaml/compiler-libs/out_type.cmi
 lib/ocaml/compiler-libs/out_type.cmt
 lib/ocaml/compiler-libs/out_type.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/out_type.cmx
 lib/ocaml/compiler-libs/out_type.mli
 lib/ocaml/compiler-libs/outcometree.cmi
 lib/ocaml/compiler-libs/outcometree.cmti
@@ -1142,6 +1150,7 @@ ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/projection.mli
 lib/ocaml/compiler-libs/rawprinttyp.cmi
 lib/ocaml/compiler-libs/rawprinttyp.cmt
 lib/ocaml/compiler-libs/rawprinttyp.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/rawprinttyp.cmx
 lib/ocaml/compiler-libs/rawprinttyp.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/ref_to_variables.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/ref_to_variables.cmt
@@ -1246,6 +1255,7 @@ lib/ocaml/compiler-libs/signature_group.mli
 lib/ocaml/compiler-libs/signature_matching.cmi
 lib/ocaml/compiler-libs/signature_matching.cmt
 lib/ocaml/compiler-libs/signature_matching.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/signature_matching.cmx
 lib/ocaml/compiler-libs/signature_matching.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/simple_value_approx.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/simple_value_approx.cmt
@@ -1288,6 +1298,7 @@ ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/split.mli
 lib/ocaml/compiler-libs/stable_matching.cmi
 lib/ocaml/compiler-libs/stable_matching.cmt
 lib/ocaml/compiler-libs/stable_matching.cmti
+${PLIST.ocaml-opt}lib/ocaml/compiler-libs/stable_matching.cmx
 lib/ocaml/compiler-libs/stable_matching.mli
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/stackframe.cmi
 ${PLIST.ocaml-opt}lib/ocaml/compiler-libs/stackframe.cmt
@@ -1628,7 +1639,7 @@ ${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink.cmx
 ${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink.cmxa
 lib/ocaml/dynlink/dynlink.mli
 ${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink_common.cmx
-${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink_compilerlibs.cmx
+${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink_config.cmx
 ${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink_platform_intf.cmx
 ${PLIST.ocaml-opt}lib/ocaml/dynlink/dynlink_types.cmx
 lib/ocaml/effect.ml
@@ -1665,6 +1676,7 @@ lib/ocaml/lazy.mli
 lib/ocaml/ld.conf
 lib/ocaml/lexing.ml
 lib/ocaml/lexing.mli
+${PLIST.ocaml-opt}lib/ocaml/libasmrun-${MACHINE_GNU_PLATFORM}-a100.so
 ${PLIST.ocaml-opt}lib/ocaml/libasmrun.a
 ${PLIST.ocaml-opt}lib/ocaml/libasmrun_pic.a
 ${PLIST.ocaml-opt}lib/ocaml/libasmrun_shared.so
@@ -2018,6 +2030,7 @@ ${PLIST.ocaml-opt}lib/ocaml/stdlib__Hashtbl.cmx
 lib/ocaml/stdlib__Iarray.cmi
 lib/ocaml/stdlib__Iarray.cmt
 lib/ocaml/stdlib__Iarray.cmti
+${PLIST.ocaml-opt}lib/ocaml/stdlib__Iarray.cmx
 lib/ocaml/stdlib__In_channel.cmi
 lib/ocaml/stdlib__In_channel.cmt
 lib/ocaml/stdlib__In_channel.cmti
@@ -2089,6 +2102,7 @@ ${PLIST.ocaml-opt}lib/ocaml/stdlib__Out_channel.cmx
 lib/ocaml/stdlib__Pair.cmi
 lib/ocaml/stdlib__Pair.cmt
 lib/ocaml/stdlib__Pair.cmti
+${PLIST.ocaml-opt}lib/ocaml/stdlib__Pair.cmx
 lib/ocaml/stdlib__Parsing.cmi
 lib/ocaml/stdlib__Parsing.cmt
 lib/ocaml/stdlib__Parsing.cmti
@@ -2096,6 +2110,7 @@ ${PLIST.ocaml-opt}lib/ocaml/stdlib__Parsing.cmx
 lib/ocaml/stdlib__Pqueue.cmi
 lib/ocaml/stdlib__Pqueue.cmt
 lib/ocaml/stdlib__Pqueue.cmti
+${PLIST.ocaml-opt}lib/ocaml/stdlib__Pqueue.cmx
 lib/ocaml/stdlib__Printexc.cmi
 lib/ocaml/stdlib__Printexc.cmt
 lib/ocaml/stdlib__Printexc.cmti
@@ -2115,6 +2130,7 @@ ${PLIST.ocaml-opt}lib/ocaml/stdlib__Random.cmx
 lib/ocaml/stdlib__Repr.cmi
 lib/ocaml/stdlib__Repr.cmt
 lib/ocaml/stdlib__Repr.cmti
+${PLIST.ocaml-opt}lib/ocaml/stdlib__Repr.cmx
 lib/ocaml/stdlib__Result.cmi
 lib/ocaml/stdlib__Result.cmt
 lib/ocaml/stdlib__Result.cmti
@@ -2185,12 +2201,9 @@ lib/ocaml/string.mli
 lib/ocaml/stringLabels.ml
 lib/ocaml/stringLabels.mli
 lib/ocaml/stublibs/dllcamlruntime_eventsbyt-${MACHINE_GNU_PLATFORM}-a100.so
-${PLIST.ocaml-opt}lib/ocaml/stublibs/dllcamlruntime_eventsnat.so
 lib/ocaml/stublibs/dllcamlstrbyt-${MACHINE_GNU_PLATFORM}-a100.so
-${PLIST.ocaml-opt}lib/ocaml/stublibs/dllcamlstrnat.so
 lib/ocaml/stublibs/dllthreads-${MACHINE_GNU_PLATFORM}-a100.so
 lib/ocaml/stublibs/dllunixbyt-${MACHINE_GNU_PLATFORM}-a100.so
-${PLIST.ocaml-opt}lib/ocaml/stublibs/dllunixnat.so
 lib/ocaml/sys.ml
 lib/ocaml/sys.ml.in
 lib/ocaml/sys.mli
diff --git a/ocaml/buildlink3.mk b/ocaml/buildlink3.mk
index 9f8dd0d900..afdec83c4c 100644
--- a/ocaml/buildlink3.mk
+++ b/ocaml/buildlink3.mk
@@ -6,8 +6,8 @@ BUILDLINK_TREE+=	ocaml
 .if !defined(OCAML_BUILDLINK3_MK)
 OCAML_BUILDLINK3_MK:=
 
-BUILDLINK_API_DEPENDS.ocaml+=	ocaml>=4.14.0
-BUILDLINK_ABI_DEPENDS.ocaml+=	ocaml>=4.14.0
+BUILDLINK_API_DEPENDS.ocaml+=	ocaml>=5.5.0
+BUILDLINK_ABI_DEPENDS.ocaml+=	ocaml>=5.5.0
 BUILDLINK_PKGSRCDIR.ocaml?=	../../wip/ocaml
 #BUILDLINK_DEPMETHOD.ocaml?=	build
 
diff --git a/ocaml/distinfo b/ocaml/distinfo
index c9b5e72aea..490e99cd76 100644
--- a/ocaml/distinfo
+++ b/ocaml/distinfo
@@ -3,3 +3,4 @@ $NetBSD$
 BLAKE2s (ocaml-5.5.0.tar.gz) = 8eb93b5952e90b1ae8cbb9034d3810aa13aa3c04c2c23fc79db05d5794566962
 SHA512 (ocaml-5.5.0.tar.gz) = 2692bc8fe34af4530b7cca8d98efe07c297e8bf46449b31d30b2cd5292c0b91afe8e88ded290f000025e047bd5bbee6b9119bd8aa38142a3d40d5e5af4475d53
 Size (ocaml-5.5.0.tar.gz) = 6609018 bytes
+SHA1 (patch-asmcomp_asmlink.ml) = 94c582292472f1266e1f417bd182af652be2b846
diff --git a/ocaml/native.mk b/ocaml/native.mk
index dc264d82b3..1c20fa99b2 100644
--- a/ocaml/native.mk
+++ b/ocaml/native.mk
@@ -30,7 +30,8 @@ _DEF_VARS.ocaml=	\
 # works when building outside of pkgsrc, breaks
 # when building inside
 # https://github.com/ocaml/ocaml/issues/14207#issuecomment-3228396849
-OCAML_USE_OPT_COMPILER?=	no
+# OCAML_USE_OPT_COMPILER?=       no
+# -> probably fixed. see patch-asmcomp_asmlink.ml
 
 OCAML_USE_OPT_COMPILER?=	yes
 .else
diff --git a/ocaml/ocaml.mk b/ocaml/ocaml.mk
index 2c8da80c69..8bf97b6be9 100644
--- a/ocaml/ocaml.mk
+++ b/ocaml/ocaml.mk
@@ -35,7 +35,7 @@ OCAML_MK=	# defined
 MKPIE_SUPPORTED=	no
 
 .include "../../mk/bsd.fast.prefs.mk"
-.include "../../lang/ocaml/native.mk"
+.include "../../wip/ocaml/native.mk"
 
 
 _PKG_VARS.ocaml=	\
@@ -249,6 +249,6 @@ do-build:
 .endif # ${OCAML_USE_DUNE} == "yes"
 
 # Add dependency on ocaml.
-.include "../../lang/ocaml/buildlink3.mk"
+.include "../../wip/ocaml/buildlink3.mk"
 
 .endif # OCAML_MK
diff --git a/ocaml/patches/patch-asmcomp_asmlink.ml b/ocaml/patches/patch-asmcomp_asmlink.ml
new file mode 100644
index 0000000000..3fbcc34fb8
--- /dev/null
+++ b/ocaml/patches/patch-asmcomp_asmlink.ml
@@ -0,0 +1,27 @@
+$NetBSD$
+
+linker uses $PTHREAD_CFLAGS.
+
+When building outside of pkgsrc, Autoconf's AX_PTHREAD returns
+$PTHREAD_CFLAGS="-pthread" and and $PTHREAD_LIBS="-lpthread".
+However, for some reason, inside pkgsrc returns
+$PTHREAD_CFLAGS="-pthread" and and $PTHREAD_LIBS="".
+Therefore, linker loses pthread library, resulting in an error.
+
+By the way, AX_PTHREAD assumes to not only compiler with cflags,
+but also link with them. So, as a test, I tried adding
+'Config.native_cflags' to linker, it working.
+
+https://www.gnu.org/software/autoconf-archive/ax_pthread.html
+
+--- asmcomp/asmlink.ml.orig	2026-06-19 12:16:03.000000000 +0000
++++ asmcomp/asmlink.ml
+@@ -323,7 +323,7 @@ let call_linker file_list startup_file output_name =
+       files @ (List.rev !Clflags.ccobjs) @ runtime_lib (),
+       native_ldflags ^ " " ^
+       (if !Clflags.nopervasives || (main_obj_runtime && not main_dll)
+-       then "" else Config.native_c_libraries)
++       then "" else Config.native_cflags ^ " " ^ Config.native_c_libraries)
+     else
+       files, ""
+   in


Home | Main Index | Thread Index | Old Index