public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [ITA] ocaml 4.14.0
@ 2022-07-04  2:03 William Hu
  2022-07-04 17:03 ` Jon Turney
  0 siblings, 1 reply; 20+ messages in thread
From: William Hu @ 2022-07-04  2:03 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Hello,

I noticed that the ocaml source package is currently unmaintained and the most recent package version is 4.10.0, so I'd like to adopt the packages under it (specifically, ocaml, ocaml-compiler-libs, ocaml-runtime, ocaml-doc, ocaml-ocamldoc, and ocaml-source). Attached is a cygport file that I've modified for the newest version 4.14.0. Please let me know if there's anything else that has to be done/changed. Thank you!

[-- Attachment #2: ocaml.cygport --]
[-- Type: application/octet-stream, Size: 2048 bytes --]

NAME="ocaml"
VERSION=4.14.0
RELEASE=1
CATEGORY="OCaml"
SUMMARY="OCaml compilers"
DESCRIPTION="OCaml is a fast modern type-inferring functional programming
language descended from the ML (Meta Language) family, featuring objects,
modules, and a high-performance native-code compiler. The OCaml compiler is
developed by a worldwide distributed team coordinated by the Gallium
project-team at Inria Paris-Rocquencourt."
HOMEPAGE="https://ocaml.org/"
SRC_URI="https://github.com/ocaml/ocaml/archive/${VERSION}.tar.gz"
PATCH_URI="4.14.0-configure-cflags.patch"

OCAML_LIBDIR=/usr/lib/ocaml
KEEPDIRS="${D}/usr/lib/ocaml/ocamldoc/custom"

PKG_NAMES="${NAME} ${NAME}-runtime ${NAME}-compiler-libs ${NAME}-ocamldoc ${NAME}-source ${NAME}-doc"
ocaml_OBSOLETES="ocaml-base emacs-ocaml"
ocaml_REQUIRES="flexdll ${NAME}-runtime"
ocaml_CONTENTS="
	--exclude=camlheader[di].exe
	--exclude=compiler-libs
	--exclude=ocamldoc*
	--exclude=ocamlrun*
	--exclude=stublibs
	--exclude=*.ml
	--exclude=*.cma
	--exclude=*.cmi
	--exclude=*.cmo
	usr/bin/ocaml*
	${OCAML_LIBDIR#/}/
	usr/share/doc/${NAME}/
	usr/share/man/man1/
"
ocaml_runtime_SUMMARY="OCaml bytecode runtime"
ocaml_runtime_CONTENTS="
	usr/bin/ocamlrun*
	${OCAML_LIBDIR#/}/camlheader[di].exe
	${OCAML_LIBDIR#/}/*.cm[aio]
	${OCAML_LIBDIR#/}/stublibs/
	${OCAML_LIBDIR#/}/threads/*.cm[ai]
	usr/share/man/man1/ocamlrun*
"
ocaml_compiler_libs_SUMMARY="OCaml compiler internals"
ocaml_compiler_libs_REQUIRES=${NAME}
ocaml_compiler_libs_CONTENTS="${OCAML_LIBDIR#/}/compiler-libs/"
ocaml_ocamldoc_SUMMARY="OCaml documentation generator"
ocaml_ocamldoc_CONTENTS="
	usr/bin/ocamldoc*
	${OCAML_LIBDIR#/}/ocamldoc/
	usr/share/man/man1/ocamldoc*
"
ocaml_source_SUMMARY="OCaml standard library sources"
ocaml_source_CONTENTS="${OCAML_LIBDIR#/}/*.ml"
ocaml_doc_SUMMARY="OCaml API documentation"
ocaml_doc_CONTENTS="usr/share/man/man3/"

src_compile() {
	lndirs
	cd ${B}
	./configure --prefix=/usr || error "configure failed"
	cygmake
}

src_test() { :
	cd ${B}/testsuite
	cygmake all
}

src_install() {
	cd ${B}
	cyginstall
}

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-04  2:03 [ITA] ocaml 4.14.0 William Hu
@ 2022-07-04 17:03 ` Jon Turney
  2022-07-05  0:42   ` William Hu
  0 siblings, 1 reply; 20+ messages in thread
From: Jon Turney @ 2022-07-04 17:03 UTC (permalink / raw)
  To: William Hu, cygwin-apps

On 04/07/2022 03:03, William Hu via Cygwin-apps wrote:
> Hello,
> 
> I noticed that the ocaml source package is currently unmaintained and the most recent package version is 4.10.0, so I'd like to adopt the packages under it (specifically, ocaml, ocaml-compiler-libs, ocaml-runtime, ocaml-doc, ocaml-ocamldoc, and ocaml-source). Attached is a cygport file that I've modified for the newest version 4.14.0. Please let me know if there's anything else that has to be done/changed. Thank you!

Thanks!

I wasn't able to test your cygport file as you didn't attach the patch 
it references, but it looks correct:


Please consider adding:

LICENSE="LGPL-2.1-or-later"
BUILD_REQUIRES="flexdll" (I think that's all that's needed?)


Please provide a SSH key as explained here:

    https://cygwin.com/packaging/key.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-04 17:03 ` Jon Turney
@ 2022-07-05  0:42   ` William Hu
  2022-07-05 19:44     ` Jon Turney
  0 siblings, 1 reply; 20+ messages in thread
From: William Hu @ 2022-07-05  0:42 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

Hi Jon,

Oops, sorry about that. The patch and updated cygport are now attached.
Sending SSH key shortly.

Thanks,
William

------- Original Message -------
On Monday, July 4th, 2022 at 1:03 PM, Jon Turney <jon.turney@dronecode.org.uk> wrote:


> On 04/07/2022 03:03, William Hu via Cygwin-apps wrote:
>
> > Hello,
> >
> > I noticed that the ocaml source package is currently unmaintained and the most recent package version is 4.10.0, so I'd like to adopt the packages under it (specifically, ocaml, ocaml-compiler-libs, ocaml-runtime, ocaml-doc, ocaml-ocamldoc, and ocaml-source). Attached is a cygport file that I've modified for the newest version 4.14.0. Please let me know if there's anything else that has to be done/changed. Thank you!
>
>
> Thanks!
>
> I wasn't able to test your cygport file as you didn't attach the patch
> it references, but it looks correct:
>
>
> Please consider adding:
>
> LICENSE="LGPL-2.1-or-later"
> BUILD_REQUIRES="flexdll" (I think that's all that's needed?)
>
>
> Please provide a SSH key as explained here:
>
> https://cygwin.com/packaging/key.html

[-- Attachment #2: ocaml.cygport --]
[-- Type: application/octet-stream, Size: 2101 bytes --]

NAME="ocaml"
VERSION=4.14.0
RELEASE=1
CATEGORY="OCaml"
SUMMARY="OCaml compilers"
DESCRIPTION="OCaml is a fast modern type-inferring functional programming
language descended from the ML (Meta Language) family, featuring objects,
modules, and a high-performance native-code compiler. The OCaml compiler is
developed by a worldwide distributed team coordinated by the Gallium
project-team at Inria Paris-Rocquencourt."
HOMEPAGE="https://ocaml.org/"
LICENSE="LGPL-2.1-or-later"
BUILD_REQUIRES="flexdll"
SRC_URI="https://github.com/ocaml/ocaml/archive/${VERSION}.tar.gz"
PATCH_URI="4.14.0-configure-cflags.patch"

OCAML_LIBDIR=/usr/lib/ocaml
KEEPDIRS="${D}/usr/lib/ocaml/ocamldoc/custom"

PKG_NAMES="${NAME} ${NAME}-runtime ${NAME}-compiler-libs ${NAME}-ocamldoc ${NAME}-source ${NAME}-doc"
ocaml_OBSOLETES="ocaml-base emacs-ocaml"
ocaml_REQUIRES="flexdll ${NAME}-runtime"
ocaml_CONTENTS="
	--exclude=camlheader[di].exe
	--exclude=compiler-libs
	--exclude=ocamldoc*
	--exclude=ocamlrun*
	--exclude=stublibs
	--exclude=*.ml
	--exclude=*.cma
	--exclude=*.cmi
	--exclude=*.cmo
	usr/bin/ocaml*
	${OCAML_LIBDIR#/}/
	usr/share/doc/${NAME}/
	usr/share/man/man1/
"
ocaml_runtime_SUMMARY="OCaml bytecode runtime"
ocaml_runtime_CONTENTS="
	usr/bin/ocamlrun*
	${OCAML_LIBDIR#/}/camlheader[di].exe
	${OCAML_LIBDIR#/}/*.cm[aio]
	${OCAML_LIBDIR#/}/stublibs/
	${OCAML_LIBDIR#/}/threads/*.cm[ai]
	usr/share/man/man1/ocamlrun*
"
ocaml_compiler_libs_SUMMARY="OCaml compiler internals"
ocaml_compiler_libs_REQUIRES=${NAME}
ocaml_compiler_libs_CONTENTS="${OCAML_LIBDIR#/}/compiler-libs/"
ocaml_ocamldoc_SUMMARY="OCaml documentation generator"
ocaml_ocamldoc_CONTENTS="
	usr/bin/ocamldoc*
	${OCAML_LIBDIR#/}/ocamldoc/
	usr/share/man/man1/ocamldoc*
"
ocaml_source_SUMMARY="OCaml standard library sources"
ocaml_source_CONTENTS="${OCAML_LIBDIR#/}/*.ml"
ocaml_doc_SUMMARY="OCaml API documentation"
ocaml_doc_CONTENTS="usr/share/man/man3/"

src_compile() {
	lndirs
	cd ${B}
	./configure --prefix=/usr || error "configure failed"
	cygmake
}

src_test() { :
	cd ${B}/testsuite
	cygmake all
}

src_install() {
	cd ${B}
	cyginstall
}

[-- Attachment #3: 4.14.0-configure-cflags.patch --]
[-- Type: application/octet-stream, Size: 401 bytes --]

--- origsrc/ocaml-4.14.0/configure	2022-03-28 08:27:36.000000000 -0400
+++ src/ocaml-4.14.0/configure	2022-06-28 21:29:43.682865800 -0400
@@ -13084,6 +13084,7 @@
     CC="$flexlink -chain $flexdll_chain -exe"
     LIBS="conftest2.$ac_objext"
     CPPFLAGS="$internal_cppflags $CPPFLAGS"
+    CFLAGS=""
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 int main() { return 0; }

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-05  0:42   ` William Hu
@ 2022-07-05 19:44     ` Jon Turney
  2022-07-13  2:56       ` William Hu
  0 siblings, 1 reply; 20+ messages in thread
From: Jon Turney @ 2022-07-05 19:44 UTC (permalink / raw)
  To: William Hu, cygwin-apps

On 05/07/2022 01:42, William Hu via Cygwin-apps wrote:
> Hi Jon,
> 
> Oops, sorry about that. The patch and updated cygport are now attached.
> Sending SSH key shortly.

Thanks.

Firstly, I notice that you dropped 4.10.0-libcamlrun_shared.patch.  Can 
you explain the reasoning behind that?

(After a bit of digging, I found this mail 
https://cygwin.com/pipermail/cygwin/2010-October/191524.html which 
explains the rationale behind it)

Next, when I try to build this:

on x86:

>  checking whether fma works... no
> configure: error: fma does not work, enable emulation with --enable-imprecise-c99-float-ops

I guess perhaps that configure option needs to be conditionally used on x86?

>>>> ocaml-runtime-4.14.0-1.tar.xz
> usr/bin/ocamlrun.exe
> usr/bin/ocamlrund.exe
> usr/bin/ocamlruni.exe
> tar: usr/lib/ocaml/camlheader[di].exe: Cannot stat: No such file or directory
[...]
> tar: Exiting with failure status due to previous errors
> *** ERROR: Binary package creation failed: ocaml-runtime

camlheader[di] are made without the .exe extensions (you've changed the 
cygport to add the exe, so maybe this was wrong before as they are 
executables)

I'm not sure if that's a missing bit of patching or something different 
in your environment?

> $ cygport ocaml.cygport test
>>>> Testing ocaml-4.14.0-1.x86_64
> Makefile:162: *** ocamltest not found in ../ocamltest.  Stop.
> make: *** [Makefile:156: all] Error 2
> *** ERROR: make failed

Seems like this requires the --enable-ocamltest configure option?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-05 19:44     ` Jon Turney
@ 2022-07-13  2:56       ` William Hu
  2022-07-13 15:41         ` David Allsopp
  2022-07-16 14:05         ` Jon Turney
  0 siblings, 2 replies; 20+ messages in thread
From: William Hu @ 2022-07-13  2:56 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 4324 bytes --]

Apologies, meant to click reply-all.

Hi Jon,

Thanks for all of the detailed feedback - I'll test the package more
thoroughly next time.

1) libcamlrun: Oops, that's another oversight, forgot to look at the old
patches. The other 3 patches seem unnecessary, but I had trouble linking
 either libcamlrun_shared.so or libcamlrun_shared.dll.a into a program
(unresolved symbol errors). Added but it possibly needs further patching.
I'll keep on digging.

1.5) I checked for other differences between the cygports to make sure I
didn't miss anything else. I made some edits to src_install: I removed `dodoc
 Updating` since there doesn't seem to be a file named "Updating". I also
removed symlinking header files to /usr/include.  From what I understood, the
 OCaml documentation says the headers should "reside in the caml/ subdirectory
 of the OCaml standard library directory, which is returned by the command
ocamlc -where (usually /usr/local/lib/ocaml or /usr/lib/ocaml)". Obviously the
 symlink doesn't move anything, but since their location is well documented I
 didn't see a reason to have the extra symlinks. Please let me know if this is
 too large of a change or there's a Cygwin (or non-Cygwin) convention that
precludes this - I'm still getting the hang of this.

2) fma on x86: I'm actually getting the same error, but the tests should
ostensibly pass on Cygwin32. I'll also look into this.

3) Interesting - on my machine, the camlheader[di] files had the .exe
extensions. I did some digging around and found the files are *built* without
 the .exe suffix, and even *initially installed* without the .exe suffix, but
 ultimately come out with the .exe suffix. I ran cyport in debug mode and
apparently the files are being renamed with the suffix post-install:

+ case "${exe##*/}" in
+ mv usr/lib/ocaml/camlheaderd usr/lib/ocaml/camlheaderd.exe
+ exe+=.exe

and did a little more digging and I think these lines in cygport are the
cause:
https://github.com/cygwin/cygport/blob/096f27644bd3b28f29d7522e816bebd327cf24cb/lib/src_postinst.cygpart#L1010

On the topic of "testing more thoroughly", I attempted to use ocamlc to
compile a simple program and it fails with "Cannot find file camlheader" but
works when I remove the ".exe", so it seems that the presence of the .exe
suffixes breaks the compiler. Is there a way to prevent cygport from adding
it?

4) Thanks for the catch. Added --enable-ocamltest to the cygport.

William

------- Original Message -------
On Tuesday, July 5th, 2022 at 3:44 PM, Jon Turney <jon.turney@dronecode.org.uk> wrote:


> On 05/07/2022 01:42, William Hu via Cygwin-apps wrote:
>
> > Hi Jon,
> >
> > Oops, sorry about that. The patch and updated cygport are now attached.
> > Sending SSH key shortly.
>
>
> Thanks.
>
> Firstly, I notice that you dropped 4.10.0-libcamlrun_shared.patch. Can
> you explain the reasoning behind that?
>
> (After a bit of digging, I found this mail
> https://cygwin.com/pipermail/cygwin/2010-October/191524.html which
> explains the rationale behind it)
>
> Next, when I try to build this:
>
> on x86:
>
> > checking whether fma works... no
> > configure: error: fma does not work, enable emulation with --enable-imprecise-c99-float-ops
>
>
> I guess perhaps that configure option needs to be conditionally used on x86?
>
> > > > > ocaml-runtime-4.14.0-1.tar.xz
> > > > > usr/bin/ocamlrun.exe
> > > > > usr/bin/ocamlrund.exe
> > > > > usr/bin/ocamlruni.exe
> > > > > tar: usr/lib/ocaml/camlheader[di].exe: Cannot stat: No such file or directory
>
> [...]
>
> > tar: Exiting with failure status due to previous errors
> > *** ERROR: Binary package creation failed: ocaml-runtime
>
>
> camlheader[di] are made without the .exe extensions (you've changed the
> cygport to add the exe, so maybe this was wrong before as they are
> executables)
>
> I'm not sure if that's a missing bit of patching or something different
> in your environment?
>
> > $ cygport ocaml.cygport test
> >
> > > > > Testing ocaml-4.14.0-1.x86_64
> > > > > Makefile:162: *** ocamltest not found in ../ocamltest. Stop.
> > > > > make: *** [Makefile:156: all] Error 2
> > > > > *** ERROR: make failed
>
>
> Seems like this requires the --enable-ocamltest configure option?

[-- Attachment #2: ocaml.cygport --]
[-- Type: application/octet-stream, Size: 2183 bytes --]

NAME="ocaml"
VERSION=4.14.0
RELEASE=1
CATEGORY="OCaml"
SUMMARY="OCaml compilers"
DESCRIPTION="OCaml is a fast modern type-inferring functional programming
language descended from the ML (Meta Language) family, featuring objects,
modules, and a high-performance native-code compiler. The OCaml compiler is
developed by a worldwide distributed team coordinated by the Gallium
project-team at Inria Paris-Rocquencourt."
HOMEPAGE="https://ocaml.org/"
LICENSE="LGPL-2.1-or-later"
BUILD_REQUIRES="flexdll"
SRC_URI="https://github.com/ocaml/ocaml/archive/${VERSION}.tar.gz"
PATCH_URI="
	4.14.0-configure-cflags.patch
	4.14.0-libcamlrun_shared.patch
"

OCAML_LIBDIR=/usr/lib/ocaml
KEEPDIRS="${D}/usr/lib/ocaml/ocamldoc/custom"

PKG_NAMES="${NAME} ${NAME}-runtime ${NAME}-compiler-libs ${NAME}-ocamldoc ${NAME}-source ${NAME}-doc"
ocaml_OBSOLETES="ocaml-base emacs-ocaml"
ocaml_REQUIRES="flexdll ${NAME}-runtime"
ocaml_CONTENTS="
	--exclude=camlheader[di].exe
	--exclude=compiler-libs
	--exclude=ocamldoc*
	--exclude=ocamlrun*
	--exclude=stublibs
	--exclude=*.ml
	--exclude=*.cma
	--exclude=*.cmi
	--exclude=*.cmo
	usr/bin/cyg*run_shared.dll
	usr/bin/ocaml*
	${OCAML_LIBDIR#/}/
	usr/share/doc/${NAME}/
	usr/share/man/man1/
"
ocaml_runtime_SUMMARY="OCaml bytecode runtime"
ocaml_runtime_CONTENTS="
	usr/bin/ocamlrun*
	${OCAML_LIBDIR#/}/camlheader[di].exe
	${OCAML_LIBDIR#/}/*.cm[aio]
	${OCAML_LIBDIR#/}/stublibs/
	${OCAML_LIBDIR#/}/threads/*.cm[ai]
	usr/share/man/man1/ocamlrun*
"
ocaml_compiler_libs_SUMMARY="OCaml compiler internals"
ocaml_compiler_libs_REQUIRES=${NAME}
ocaml_compiler_libs_CONTENTS="${OCAML_LIBDIR#/}/compiler-libs/"
ocaml_ocamldoc_SUMMARY="OCaml documentation generator"
ocaml_ocamldoc_CONTENTS="
	usr/bin/ocamldoc*
	${OCAML_LIBDIR#/}/ocamldoc/
	usr/share/man/man1/ocamldoc*
"
ocaml_source_SUMMARY="OCaml standard library sources"
ocaml_source_CONTENTS="${OCAML_LIBDIR#/}/*.ml"
ocaml_doc_SUMMARY="OCaml API documentation"
ocaml_doc_CONTENTS="usr/share/man/man3/"

src_compile() {
	lndirs
	cd ${B}
	./configure --prefix=/usr --enable-ocamltest || error "configure failed"
	cygmake
}

src_test() { :
	cd ${B}/testsuite
	cygmake all
}

src_install() {
	cd ${B}
	cyginstall
}

[-- Attachment #3: 4.14.0-libcamlrun_shared.patch --]
[-- Type: application/octet-stream, Size: 1526 bytes --]

--- origsrc/ocaml-4.14.0/runtime/Makefile	2022-03-28 08:27:36.000000000 -0400
+++ src/ocaml-4.14.0/runtime/Makefile	2022-07-10 22:37:06.338715000 -0400
@@ -74,9 +74,9 @@
 ifeq "$(UNIX_OR_WIN32)" "unix"
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
 BYTECODE_STATIC_LIBRARIES += libcamlrun_pic.$(A)
-BYTECODE_SHARED_LIBRARIES += libcamlrun_shared.$(SO)
+BYTECODE_SHARED_LIBRARIES += libcamlrun_shared.dll.a
 NATIVE_STATIC_LIBRARIES += libasmrun_pic.$(A)
-NATIVE_SHARED_LIBRARIES += libasmrun_shared.$(SO)
+NATIVE_SHARED_LIBRARIES += libasmrun_shared.dll.a
 endif
 endif
 
@@ -164,6 +164,7 @@
 ifneq "$(BYTECODE_SHARED_LIBRARIES)" ""
 	$(INSTALL_PROG) $(BYTECODE_SHARED_LIBRARIES) "$(INSTALL_LIBDIR)"
 endif
+	$(INSTALL_PROG) cygasmrun_shared.dll cygcamlrun_shared.dll "$(INSTALL_BINDIR)"
 	mkdir -p "$(INSTALL_INCDIR)"
 	$(INSTALL_DATA) caml/domain_state.tbl caml/*.h "$(INSTALL_INCDIR)"
 
@@ -294,6 +295,9 @@
 libcamlrun_shared.$(SO): $(libcamlrunpic_OBJECTS)
 	$(MKDLL) -o $@ $^ $(BYTECCLIBS)
 
+libcamlrun_shared.dll.a: $(libcamlrunpic_OBJECTS)
+	$(MKDLL) -o cygcamlrun_shared.dll -link -Wl,--out-implib,$@ $^ $(BYTECCLIBS)
+
 libasmrun.$(A): $(libasmrun_OBJECTS)
 	$(call MKLIB,$@, $^)
 
@@ -309,6 +313,9 @@
 libasmrun_shared.$(SO): $(libasmrunpic_OBJECTS)
 	$(MKDLL) -o $@ $^ $(NATIVECCLIBS)
 
+libasmrun_shared.dll.a: $(libasmrunpic_OBJECTS)
+	$(MKDLL) -o cygasmrun_shared.dll -link -Wl,--out-implib,$@ $^ $(BYTECCLIBS)
+
 # Target-specific preprocessor and compiler flags
 
 %.bd.$(O): OC_CPPFLAGS += $(OC_DEBUG_CPPFLAGS)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-07-13  2:56       ` William Hu
@ 2022-07-13 15:41         ` David Allsopp
  2022-07-14  3:36           ` William Hu
  2022-07-16 14:22           ` Jon Turney
  2022-07-16 14:05         ` Jon Turney
  1 sibling, 2 replies; 20+ messages in thread
From: David Allsopp @ 2022-07-13 15:41 UTC (permalink / raw)
  To: William Hu, Jon Turney; +Cc: cygwin-apps

> 1) libcamlrun: Oops, that's another oversight, forgot to look at the old
> patches. The other 3 patches seem unnecessary, but I had trouble linking
> either libcamlrun_shared.so or libcamlrun_shared.dll.a into a program
> (unresolved symbol errors). Added but it possibly needs further patching.
> I'll keep on digging.

What were the missing symbols? With the OCaml 4.10 package, I hit problems with this:

  echo 'print_endline "hello, world"' > hello.ml
  ocamlc -custom -runtime-variant _shared -o hello.exe hello.ml

I think that may be an issue upstream (libasmrun_shared.so IIRC is broken on all platforms - on Cygwin, you can just about to persuade it to get to the same symbol errors because of the extra .dll.a file which gets generated). 

> 1.5) I checked for other differences between the cygports to make sure I
> didn't miss anything else. I made some edits to src_install: I removed
> `dodoc  Updating` since there doesn't seem to be a file named "Updating".
> I also removed symlinking header files to /usr/include.  From what I
> understood, the  OCaml documentation says the headers should "reside in
> the caml/ subdirectory  of the OCaml standard library directory, which is
> returned by the command ocamlc -where (usually /usr/local/lib/ocaml or
> /usr/lib/ocaml)". Obviously the  symlink doesn't move anything, but since
> their location is well documented I  didn't see a reason to have the extra
> symlinks. Please let me know if this is  too large of a change or there's
> a Cygwin (or non-Cygwin) convention that precludes this - I'm still
> getting the hang of this.

> 2) fma on x86: I'm actually getting the same error, but the tests should
> ostensibly pass on Cygwin32. I'll also look into this.

What's the full configuration command and what gets inferred for the build, host and target triplets? fma should work without emulation in Cygwin32 and it should be detecting as failing on Cygwin64 but the emulation should be enabled by default unless you explicitly passed --disable-imprecise-c99-float-ops.

> 3) Interesting - on my machine, the camlheader[di] files had the .exe
> extensions. I did some digging around and found the files are *built*
> without  the .exe suffix, and even *initially installed* without the .exe
> suffix, but  ultimately come out with the .exe suffix. I ran cyport in
> debug mode and apparently the files are being renamed with the suffix
> post-install:
> 
> + case "${exe##*/}" in
> + mv usr/lib/ocaml/camlheaderd usr/lib/ocaml/camlheaderd.exe
> + exe+=.exe
> 
> and did a little more digging and I think these lines in cygport are the
> cause:
> https://github.com/cygwin/cygport/blob/096f27644bd3b28f29d7522e816bebd327c
> f24cb/lib/src_postinst.cygpart#L1010
> 
> On the topic of "testing more thoroughly", I attempted to use ocamlc to
> compile a simple program and it fails with "Cannot find file camlheader"
> but works when I remove the ".exe", so it seems that the presence of the
> .exe suffixes breaks the compiler. Is there a way to prevent cygport from
> adding it?

The camlheader files are data files and definitely mustn't be installed with a .exe extension (nor do they need to be executable).

Incidentally, OCaml 4.12+ is also likely to run into problems if flexlink is older than 0.39 - I just removed the test mark from the flexdll 0.39 package (which I thought I'd done quite some time ago...)

HTH,


David

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-07-13 15:41         ` David Allsopp
@ 2022-07-14  3:36           ` William Hu
  2022-07-14 14:56             ` David Allsopp
  2022-07-16 14:22           ` Jon Turney
  1 sibling, 1 reply; 20+ messages in thread
From: William Hu @ 2022-07-14  3:36 UTC (permalink / raw)
  To: David Allsopp; +Cc: Jon Turney, cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 3033 bytes --]

Hi David,

> What were the missing symbols? With the OCaml 4.10 package, I hit problems with this:
>
> echo 'print_endline "hello, world"' > hello.ml
>
> ocamlc -custom -runtime-variant _shared -o hello.exe hello.ml
>
> I think that may be an issue upstream (libasmrun_shared.so IIRC is broken on all platforms - on Cygwin, you can just about to persuade it to get to the same symbol errors because of the extra .dll.a file which gets generated).

It's a very long list of missing symbols (~400) so it's included as an
attachment in case the mailing list truncates extremely lengthy emails. Also,
just to note, the .dll.a file doesn't seem to be automatically generated by
upstream OCaml.

> What's the full configuration command and what gets inferred for the build, host and target triplets? fma should work without emulation in Cygwin32 and it should be detecting as failing on Cygwin64 but the emulation should be enabled by default unless you explicitly passed --disable-imprecise-c99-float-ops.

Configuration command:
./configure --prefix=/usr --enable-ocamltest

If it's relevant, I'm compiling on a 64-bit machine with Cygwin32 installed to
compile the 32-bit version. Inferred build/host/target:
configure:2779: Configuring OCaml version 4.14.0
configure:3007: checking build system type
configure:3021: result: i686-pc-cygwin
configure:3041: checking host system type
configure:3054: result: i686-pc-cygwin
configure:3074: checking target system type
configure:3087: result: i686-pc-cygwin

On Cygwin64, the test does fail and emulate by default:

configure:14872: result: no
configure:14896: WARNING: fma does not work; emulation enabled

However, on Cygwin32, I get

configure:14872: result: no
configure:14894: error: fma does not work, enable emulation with --enable-imprecise-c99-float-ops

config.log conveniently includes the program that fails, so I copy-pasted some
very redundant code (attached) and ran it on the different architectures:

Cygwin64:
t264| ans: 0x0p+0   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044 0x1.0ap-1044
t264| pass?: 0
t265| ans: 0x0p+0   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-1060
t265| pass?: 0
t266| ans: 0x1p-1074   accept: 0x1p-1073
t266| pass?: 0

Cygwin32:
t264| ans: 0x1.0ap-1044   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044 0x1.0ap-1044
t264| pass?: 1
t265| ans: 0x1.0ap-1060   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-1060
t265| pass?: 1
t266| ans: 0x1p-1073   accept: 0x1p-1073
t266| pass?: 1

The numbers look like they agree but configure doesn't think so for some reason.

> The camlheader files are data files and definitely mustn't be installed with a .exe extension (nor do they need to be executable).
>
> Incidentally, OCaml 4.12+ is also likely to run into problems if flexlink is older than 0.39 - I just removed the test mark from the flexdll 0.39 package (which I thought I'd done quite some time ago...)
>
> HTH,
>
>
> David

Yep, these pointers help a ton! Thank you!

William

[-- Attachment #2: fma_configure_test.c --]
[-- Type: text/plain, Size: 1029 bytes --]

#include <math.h>
#include <stdio.h>
int main (void) {
	static volatile double x, y, z;
	double t264, t265, t266;
	x = 0x3.bd5b7dde5fddap-496;
	y = 0x3.bd5b7dde5fddap-496;
	z = -0xd.fc352bc352bap-992;
	t264 = fma(x, y, z);
	x = 0x3.bd5b7dde5fddap-504;
	y = 0x3.bd5b7dde5fddap-504;
	z = -0xd.fc352bc352bap-1008;
	t265 = fma(x, y, z);
	x = 0x8p-540;
	y = 0x4p-540;
	z = 0x4p-1076;
	t266 = fma(x, y, z);
	printf("t264| ans: %a   accept: %a %a %a\nt264| pass?: %d\n", 
			t264, 
			0x1.0989687cp-1044, 
			0x0.000004277ca1fp-1022,
			0x0.00000428p-1022,
			t264 == 0x1.0989687cp-1044 ||
			t264 == 0x0.000004277ca1fp-1022 ||
			t264 == 0x0.00000428p-1022
		);
	printf("t265| ans: %a   accept: %a %a %a\nt265| pass?: %d\n", 
			t265,
			0x1.0988p-1060,
			0x0.0000000004278p-1022,
			0x0.000000000428p-1022,
			t265 == 0x1.0988p-1060 ||
			t265 == 0x0.0000000004278p-1022 ||
			t265 == 0x0.000000000428p-1022
		);
	printf("t266| ans: %a   accept: %a\nt266| pass?: %d\n", 
			t266,
			0x8p-1076,
			t266 == 0x8p-1076
		);
	return 0;
}

[-- Attachment #3: camlrun_shared_missing_symbols.txt --]
[-- Type: text/plain, Size: 8709 bytes --]

$ /usr/bin/ocamlc -verbose -custom -runtime-variant _shared -o hello.exe hello.ml
+ flexlink -chain cygwin64 -merge-manifest -stack 16777216 -exe  -o 'hello.exe'  '-L/usr/lib/ocaml'  '-link' '-fdebug-prefix-map=/tmp/camlprim56f84c.c=camlprim.c' '/tmp/camlprim56f84c.c' '-lcamlrun_shared' -I'/usr/lib/ocaml' -lm  -lpthread
** Cannot resolve symbols for /tmp/dyndll87882d.o:
 caml_abs_float
 caml_acos_float
 caml_acosh_float
 caml_add_float
 caml_alloc_dummy
 caml_alloc_dummy_float
 caml_alloc_dummy_function
 caml_alloc_dummy_infix
 caml_array_append
 caml_array_blit
 caml_array_concat
 caml_array_fill
 caml_array_get
 caml_array_get_addr
 caml_array_set
 caml_array_set_addr
 caml_array_sub
 caml_array_unsafe_get
 caml_array_unsafe_set
 caml_asin_float
 caml_asinh_float
 caml_atan2_float
 caml_atan_float
 caml_atanh_float
 caml_ba_blit
 caml_ba_change_layout
 caml_ba_create
 caml_ba_dim
 caml_ba_dim_1
 caml_ba_dim_2
 caml_ba_dim_3
 caml_ba_fill
 caml_ba_get_1
 caml_ba_get_2
 caml_ba_get_3
 caml_ba_get_generic
 caml_ba_kind
 caml_ba_layout
 caml_ba_num_dims
 caml_ba_reshape
 caml_ba_set_1
 caml_ba_set_2
 caml_ba_set_3
 caml_ba_set_generic
 caml_ba_slice
 caml_ba_sub
 caml_ba_uint8_get16
 caml_ba_uint8_get32
 caml_ba_uint8_get64
 caml_ba_uint8_set16
 caml_ba_uint8_set32
 caml_ba_uint8_set64
 caml_backtrace_status
 caml_blit_bytes
 caml_blit_string
 caml_bswap16
 caml_bytes_compare
 caml_bytes_equal
 caml_bytes_get
 caml_bytes_get16
 caml_bytes_get32
 caml_bytes_get64
 caml_bytes_greaterequal
 caml_bytes_greaterthan
 caml_bytes_lessequal
 caml_bytes_lessthan
 caml_bytes_notequal
 caml_bytes_of_string
 caml_bytes_set
 caml_bytes_set16
 caml_bytes_set32
 caml_bytes_set64
 caml_cbrt_float
 caml_ceil_float
 caml_channel_descriptor
 caml_classify_float
 caml_compare
 caml_convert_raw_backtrace
 caml_convert_raw_backtrace_slot
 caml_copysign_float
 caml_cos_float
 caml_cosh_float
 caml_create_bytes
 caml_create_string
 caml_div_float
 caml_dynlink_add_primitive
 caml_dynlink_close_lib
 caml_dynlink_get_current_libs
 caml_dynlink_lookup_symbol
 caml_dynlink_open_lib
 caml_ensure_stack_capacity
 caml_ephe_blit_data
 caml_ephe_blit_key
 caml_ephe_check_data
 caml_ephe_check_key
 caml_ephe_create
 caml_ephe_get_data
 caml_ephe_get_data_copy
 caml_ephe_get_key
 caml_ephe_get_key_copy
 caml_ephe_set_data
 caml_ephe_set_key
 caml_ephe_unset_data
 caml_ephe_unset_key
 caml_eq_float
 caml_equal
 caml_erf_float
 caml_erfc_float
 caml_eventlog_pause
 caml_eventlog_resume
 caml_exp2_float
 caml_exp_float
 caml_expm1_float
 caml_fill_bytes
 caml_fill_string
 caml_final_register
 caml_final_register_called_without_value
 caml_final_release
 caml_float_compare
 caml_float_of_int
 caml_float_of_string
 caml_floatarray_blit
 caml_floatarray_create
 caml_floatarray_get
 caml_floatarray_set
 caml_floatarray_unsafe_get
 caml_floatarray_unsafe_set
 caml_floor_float
 caml_fma_float
 caml_fmod_float
 caml_format_float
 caml_format_int
 caml_fresh_oo_id
 caml_frexp_float
 caml_gc_compaction
 caml_gc_counters
 caml_gc_full_major
 caml_gc_get
 caml_gc_huge_fallback_count
 caml_gc_major
 caml_gc_major_slice
 caml_gc_minor
 caml_gc_minor_words
 caml_gc_quick_stat
 caml_gc_set
 caml_gc_stat
 caml_ge_float
 caml_get_current_callstack
 caml_get_current_environment
 caml_get_exception_backtrace
 caml_get_exception_raw_backtrace
 caml_get_global_data
 caml_get_major_bucket
 caml_get_major_credit
 caml_get_minor_free
 caml_get_public_method
 caml_get_section_table
 caml_greaterequal
 caml_greaterthan
 caml_gt_float
 caml_hash
 caml_hexstring_of_float
 caml_hypot_float
 caml_input_value
 caml_input_value_from_bytes
 caml_install_signal_handler
 caml_int32_add
 caml_int32_and
 caml_int32_bits_of_float
 caml_int32_bswap
 caml_int32_compare
 caml_int32_div
 caml_int32_float_of_bits
 caml_int32_format
 caml_int32_mod
 caml_int32_mul
 caml_int32_neg
 caml_int32_of_float
 caml_int32_of_int
 caml_int32_of_string
 caml_int32_or
 caml_int32_shift_left
 caml_int32_shift_right
 caml_int32_shift_right_unsigned
 caml_int32_sub
 caml_int32_to_float
 caml_int32_to_int
 caml_int32_xor
 caml_int64_add
 caml_int64_add_native
 caml_int64_and
 caml_int64_and_native
 caml_int64_bits_of_float
 caml_int64_bswap
 caml_int64_compare
 caml_int64_div
 caml_int64_div_native
 caml_int64_float_of_bits
 caml_int64_format
 caml_int64_mod
 caml_int64_mod_native
 caml_int64_mul
 caml_int64_mul_native
 caml_int64_neg
 caml_int64_neg_native
 caml_int64_of_float
 caml_int64_of_int
 caml_int64_of_int32
 caml_int64_of_nativeint
 caml_int64_of_string
 caml_int64_or
 caml_int64_or_native
 caml_int64_shift_left
 caml_int64_shift_right
 caml_int64_shift_right_unsigned
 caml_int64_sub
 caml_int64_sub_native
 caml_int64_to_float
 caml_int64_to_int
 caml_int64_to_int32
 caml_int64_to_nativeint
 caml_int64_xor
 caml_int64_xor_native
 caml_int_as_pointer
 caml_int_compare
 caml_int_of_float
 caml_int_of_string
 caml_invoke_traced_function
 caml_lazy_make_forward
 caml_ldexp_float
 caml_le_float
 caml_lessequal
 caml_lessthan
 caml_lex_engine
 caml_log10_float
 caml_log1p_float
 caml_log2_float
 caml_log_float
 caml_lt_float
 caml_make_array
 caml_make_float_vect
 caml_make_vect
 caml_marshal_data_size
 caml_md5_chan
 caml_md5_string
 caml_memprof_start
 caml_memprof_stop
 caml_ml_bytes_length
 caml_ml_channel_size
 caml_ml_channel_size_64
 caml_ml_close_channel
 caml_ml_debug_info_status
 caml_ml_enable_runtime_warnings
 caml_ml_flush
 caml_ml_input
 caml_ml_input_char
 caml_ml_input_int
 caml_ml_input_scan_line
 caml_ml_is_buffered
 caml_ml_open_descriptor_in
 caml_ml_open_descriptor_out
 caml_ml_out_channels_list
 caml_ml_output
 caml_ml_output_bytes
 caml_ml_output_char
 caml_ml_output_int
 caml_ml_pos_in
 caml_ml_pos_in_64
 caml_ml_pos_out
 caml_ml_pos_out_64
 caml_ml_runtime_warnings_enabled
 caml_ml_seek_in
 caml_ml_seek_in_64
 caml_ml_seek_out
 caml_ml_seek_out_64
 caml_ml_set_binary_mode
 caml_ml_set_buffered
 caml_ml_set_channel_name
 caml_ml_string_length
 caml_modf_float
 caml_mul_float
 caml_nativeint_add
 caml_nativeint_and
 caml_nativeint_bswap
 caml_nativeint_compare
 caml_nativeint_div
 caml_nativeint_format
 caml_nativeint_mod
 caml_nativeint_mul
 caml_nativeint_neg
 caml_nativeint_of_float
 caml_nativeint_of_int
 caml_nativeint_of_int32
 caml_nativeint_of_string
 caml_nativeint_or
 caml_nativeint_shift_left
 caml_nativeint_shift_right
 caml_nativeint_shift_right_unsigned
 caml_nativeint_sub
 caml_nativeint_to_float
 caml_nativeint_to_int
 caml_nativeint_to_int32
 caml_nativeint_xor
 caml_neg_float
 caml_neq_float
 caml_new_lex_engine
 caml_nextafter_float
 caml_notequal
 caml_obj_add_offset
 caml_obj_block
 caml_obj_dup
 caml_obj_make_forward
 caml_obj_raw_field
 caml_obj_reachable_words
 caml_obj_set_raw_field
 caml_obj_set_tag
 caml_obj_tag
 caml_obj_truncate
 caml_obj_with_tag
 caml_output_value
 caml_output_value_to_buffer
 caml_output_value_to_bytes
 caml_output_value_to_string
 caml_parse_engine
 caml_power_float
 caml_raw_backtrace_length
 caml_raw_backtrace_next_slot
 caml_raw_backtrace_slot
 caml_realloc_global
 caml_record_backtrace
 caml_register_named_value
 caml_reify_bytecode
 caml_reset_afl_instrumentation
 caml_restore_raw_backtrace
 caml_round_float
 caml_runtime_parameters
 caml_runtime_variant
 caml_set_oo_id
 caml_set_parser_trace
 caml_signbit
 caml_signbit_float
 caml_sin_float
 caml_sinh_float
 caml_sqrt_float
 caml_static_release_bytecode
 caml_string_compare
 caml_string_equal
 caml_string_get
 caml_string_get16
 caml_string_get32
 caml_string_get64
 caml_string_greaterequal
 caml_string_greaterthan
 caml_string_lessequal
 caml_string_lessthan
 caml_string_notequal
 caml_string_of_bytes
 caml_string_set
 caml_sub_float
 caml_sys_argv
 caml_sys_chdir
 caml_sys_close
 caml_sys_const_backend_type
 caml_sys_const_big_endian
 caml_sys_const_int_size
 caml_sys_const_max_wosize
 caml_sys_const_naked_pointers_checked
 caml_sys_const_ostype_cygwin
 caml_sys_const_ostype_unix
 caml_sys_const_ostype_win32
 caml_sys_const_word_size
 caml_sys_executable_name
 caml_sys_exit
 caml_sys_file_exists
 caml_sys_get_argv
 caml_sys_get_config
 caml_sys_getcwd
 caml_sys_getenv
 caml_sys_is_directory
 caml_sys_isatty
 caml_sys_mkdir
 caml_sys_modify_argv
 caml_sys_open
 caml_sys_random_seed
 caml_sys_read_directory
 caml_sys_remove
 caml_sys_rename
 caml_sys_rmdir
 caml_sys_system_command
 caml_sys_time
 caml_sys_time_include_children
 caml_sys_unsafe_getenv
 caml_tan_float
 caml_tanh_float
 caml_terminfo_rows
 caml_trunc_float
 caml_update_dummy
 caml_weak_blit
 caml_weak_check
 caml_weak_create
 caml_weak_get
 caml_weak_get_copy
 caml_weak_set
File "hello.ml", line 1:
Error: Error while building custom runtime system

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-07-14  3:36           ` William Hu
@ 2022-07-14 14:56             ` David Allsopp
  2022-07-15  3:20               ` William Hu
  0 siblings, 1 reply; 20+ messages in thread
From: David Allsopp @ 2022-07-14 14:56 UTC (permalink / raw)
  To: William Hu; +Cc: Jon Turney, cygwin-apps

William Hu wrote:
> Hi David,
> 
> > What were the missing symbols? With the OCaml 4.10 package, I hit
> problems with this:
> >
> > echo 'print_endline "hello, world"' > hello.ml
> >
> > ocamlc -custom -runtime-variant _shared -o hello.exe hello.ml
> >
> > I think that may be an issue upstream (libasmrun_shared.so IIRC is
> broken on all platforms - on Cygwin, you can just about to persuade it to
> get to the same symbol errors because of the extra .dll.a file which gets
> generated).
> 
> It's a very long list of missing symbols (~400) so it's included as an
> attachment in case the mailing list truncates extremely lengthy emails.
> Also, just to note, the .dll.a file doesn't seem to be automatically
> generated by upstream OCaml.

I think this down to neglect - the PIC/shared versions of the runtime were contributed for a specific purpose and aren't properly maintained/tested AFAICT.

I'm not sure that libcamlrun_shared can ever have worked on Cygwin, at least certainly not since OCaml 3.11 (which is a loooong time ago). The patch builds cygcamlrun_shared.dll as a plugin DLL - so the symbols will have been stripped and moved into symtbl (hence the huge number of missing symbols when linking against it when it gets passed to a normal linker).

What normally happens with flexlink is that either an executable or a "main program DLL" (compiled with flexlink -maindll) would receive that symtbl from a DLL it flexdll_dlopen's and the DLL receives static_symtbl from the executable. That then means that the DLL can relocate any symbols it expected from the main executable and any other flexdll_dlopen'd DLLs. However, that's all meant to happen at runtime - I don't think flexlink has ever supported compiling an executable _itself_ which must flexdll_dlopen DLLs _before_ its main function.

I think it's quite feasible to add that to flexlink, but it's not a small piece of work - in the meantime I'd suggest instead deleting the BYTECODE_SHARED_LIBRARIES += and NATIVE_SHARED_LIBRARIES += lines in runtime/Makefile instead of patching them.

> > What's the full configuration command and what gets inferred for the
> build, host and target triplets? fma should work without emulation in
> Cygwin32 and it should be detecting as failing on Cygwin64 but the
> emulation should be enabled by default unless you explicitly passed --
> disable-imprecise-c99-float-ops.
> 
> Configuration command:
> ./configure --prefix=/usr --enable-ocamltest
> 
> If it's relevant, I'm compiling on a 64-bit machine with Cygwin32
> installed to compile the 32-bit version. Inferred build/host/target:
> configure:2779: Configuring OCaml version 4.14.0
> configure:3007: checking build system type
> configure:3021: result: i686-pc-cygwin
> configure:3041: checking host system type
> configure:3054: result: i686-pc-cygwin
> configure:3074: checking target system type
> configure:3087: result: i686-pc-cygwin
> 
> On Cygwin64, the test does fail and emulate by default:
> 
> configure:14872: result: no
> configure:14896: WARNING: fma does not work; emulation enabled
> 
> However, on Cygwin32, I get
> 
> configure:14872: result: no
> configure:14894: error: fma does not work, enable emulation with --enable-
> imprecise-c99-float-ops
> 
> config.log conveniently includes the program that fails, so I copy-pasted
> some very redundant code (attached) and ran it on the different
> architectures:
> 
> Cygwin64:
> t264| ans: 0x0p+0   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044 0x1.0ap-
> 1044
> t264| pass?: 0
> t265| ans: 0x0p+0   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-1060
> t265| pass?: 0
> t266| ans: 0x1p-1074   accept: 0x1p-1073
> t266| pass?: 0
> 
> Cygwin32:
> t264| ans: 0x1.0ap-1044   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044
> 0x1.0ap-1044
> t264| pass?: 1
> t265| ans: 0x1.0ap-1060   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-
> 1060
> t265| pass?: 1
> t266| ans: 0x1p-1073   accept: 0x1p-1073
> t266| pass?: 1
> 
> The numbers look like they agree but configure doesn't think so for some
> reason.

Would you be able to send the entire config.log file (off-list is fine!). I'm not seeing this at all in Cygwin32 here! 

All best,


David

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-07-14 14:56             ` David Allsopp
@ 2022-07-15  3:20               ` William Hu
  0 siblings, 0 replies; 20+ messages in thread
From: William Hu @ 2022-07-15  3:20 UTC (permalink / raw)
  To: David Allsopp; +Cc: Jon Turney, cygwin-apps

Hi David,

> I think this down to neglect - the PIC/shared versions of the runtime were contributed for a specific purpose and aren't properly maintained/tested AFAICT.
>
> I'm not sure that libcamlrun_shared can ever have worked on Cygwin, at least certainly not since OCaml 3.11 (which is a loooong time ago). The patch builds cygcamlrun_shared.dll as a plugin DLL - so the symbols will have been stripped and moved into symtbl (hence the huge number of missing symbols when linking against it when it gets passed to a normal linker).
>
> What normally happens with flexlink is that either an executable or a "main program DLL" (compiled with flexlink -maindll) would receive that symtbl from a DLL it flexdll_dlopen's and the DLL receives static_symtbl from the executable. That then means that the DLL can relocate any symbols it expected from the main executable and any other flexdll_dlopen'd DLLs. However, that's all meant to happen at runtime - I don't think flexlink has ever supported compiling an executable itself which must flexdll_dlopen DLLs before its main function.
>
> I think it's quite feasible to add that to flexlink, but it's not a small piece of work - in the meantime I'd suggest instead deleting the BYTECODE_SHARED_LIBRARIES += and NATIVE_SHARED_LIBRARIES += lines in runtime/Makefile instead of patching them.

Duly noted. Thanks for the explanation!

>
> Would you be able to send the entire config.log file (off-list is fine!). I'm not seeing this at all in Cygwin32 here!
>
> All best,
>
>
> David

Config.log sent :) On another note, on x86_64, 16 of the testsuite tests are failing:
    tests/lib-scanf-2/'tscanf2_master.ml' with 1.1.1.1.1.1 (run)
    tests/lib-unix/common/'cloexec.ml' with 1.1.1.1.1.1.1 (run)
    tests/lib-systhreads/'testfork.ml' with 1.1.1.1 (bytecode)
    tests/tool-debugger/basic/'debuggee.ml' with 1.1.1.1.1.1.1 (check-program-output)
    tests/lib-unix/common/'process_pid.ml' with 1.1 (bytecode)
    tests/tool-debugger/dynlink/'host.ml' with 1.1.1.1.1.1.1.2.1 (check-program-output)
    tests/lib-unix/common/'pipe_eof.ml' with 1.1 (bytecode)
    tests/lib-unix/common/'wait_nohang.ml' with 1.1.1.1.1.1 (run)
    tests/tool-debugger/find-artifacts/'debuggee.ml' with 1.1.1.1.1.1.1.1.1.1 (check-program-output)
    tests/c-api/'alloc_async.ml' with 1 (native)
    tests/c-api/'alloc_async.ml' with 2 (bytecode)
    tests/lib-unix/common/'test_unix_cmdline.ml' with 1.1.1.1.1.1 (run)
    tests/lib-unix/common/'redirections.ml' with 1.1.1.1.1.1 (run)
    tests/tool-debugger/module_named_main/'main.ml' with 1.1.1.1.1.1.1 (check-program-output)
    tests/tool-debugger/no_debug_event/'noev.ml' with 1.1.1.1.1.1.1.1.1.1 (check-program-output)
    tests/tool-debugger/printer/'debuggee.ml' with 1.1.1.2.1.1.1 (check-program-output)

Two are innocuous "unused variable" warnings, but the others are of this form:

> Loading program...       0 [main] ocamlrun 40657 child_info_fork::abort: address space needed by 'dllunix.so' (0x400000) is already occupied
> Unix error: 'fork' failed: Resource temporarily unavailable

Github issues (e.g., https://github.com/ocaml/opam/issues/3785) have encountered
this error before, but the issue seems to imply it's been resolved. Are these test
failures expected/known (to be fair, 16 is a small number compared to 3000)? I can
send the test log too if that helps.

Thanks,
William


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-13  2:56       ` William Hu
  2022-07-13 15:41         ` David Allsopp
@ 2022-07-16 14:05         ` Jon Turney
  2022-07-17 20:56           ` William Hu
  1 sibling, 1 reply; 20+ messages in thread
From: Jon Turney @ 2022-07-16 14:05 UTC (permalink / raw)
  To: William Hu, cygwin-apps

On 13/07/2022 03:56, William Hu via Cygwin-apps wrote:
> Apologies, meant to click reply-all.
> 
> Hi Jon,
> 
> Thanks for all of the detailed feedback - I'll test the package more
> thoroughly next time.

I added 'ocaml' to your authorized packages.

Please go ahead and upload (perhaps as a test release?) when you are ready.

Please see [1] for how to upload packages and push to the packaging git 
repository.

[1] https://cygwin.com/packages.html

Thanks.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-13 15:41         ` David Allsopp
  2022-07-14  3:36           ` William Hu
@ 2022-07-16 14:22           ` Jon Turney
  2022-07-23 16:38             ` William Hu
  2022-08-23 20:00             ` David Allsopp
  1 sibling, 2 replies; 20+ messages in thread
From: Jon Turney @ 2022-07-16 14:22 UTC (permalink / raw)
  To: William Hu, David Allsopp, cygwin-apps

On 13/07/2022 16:41, David Allsopp wrote:
> 
>> 3) Interesting - on my machine, the camlheader[di] files had the .exe
>> extensions. I did some digging around and found the files are *built*
>> without  the .exe suffix, and even *initially installed* without the .exe
>> suffix, but  ultimately come out with the .exe suffix. I ran cyport in
>> debug mode and apparently the files are being renamed with the suffix
>> post-install:
>>
>> + case "${exe##*/}" in
>> + mv usr/lib/ocaml/camlheaderd usr/lib/ocaml/camlheaderd.exe
>> + exe+=.exe
>>
>> and did a little more digging and I think these lines in cygport are the
>> cause:
>> https://github.com/cygwin/cygport/blob/096f27644bd3b28f29d7522e816bebd327c
>> f24cb/lib/src_postinst.cygpart#L1010

Yeah, that seems plausible, but I'm not clear why we are seeing 
different behaviour...

>> On the topic of "testing more thoroughly", I attempted to use
>> ocamlc to compile a simple program and it fails with "Cannot find
>> file camlheader" but works when I remove the ".exe", so it seems
>> that the presence of the .exe suffixes breaks the compiler. Is
>> there a way to prevent cygport from adding it?
> 
> The camlheader files are data files and definitely mustn't be
> installed with a .exe extension (nor do they need to be executable).

I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like executables 
(according to file etc.)

If they genuinely aren't, then perhaps they shouldn't have execute 
permission (which is I think what is causing them to be caught by that 
piece of code in cygport...)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-16 14:05         ` Jon Turney
@ 2022-07-17 20:56           ` William Hu
  0 siblings, 0 replies; 20+ messages in thread
From: William Hu @ 2022-07-17 20:56 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-apps

> I added 'ocaml' to your authorized packages.
>
> Please go ahead and upload (perhaps as a test release?) when you are ready.
>
> Please see [1] for how to upload packages and push to the packaging git
> repository.
>
> [1] https://cygwin.com/packages.html
>

Great, thank you so much for the help and guidance! Once those last few bumps are smoothed out, I'll upload it as a test release.

William

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-16 14:22           ` Jon Turney
@ 2022-07-23 16:38             ` William Hu
  2022-07-31 14:52               ` Jon Turney
  2022-08-23 20:00             ` David Allsopp
  1 sibling, 1 reply; 20+ messages in thread
From: William Hu @ 2022-07-23 16:38 UTC (permalink / raw)
  To: Jon Turney; +Cc: David Allsopp, cygwin-apps

>
> Yeah, that seems plausible, but I'm not clear why we are seeing
> different behaviour...
>

After a long period of poking around for differences, I think I found the error - I had the `noacl` option activated in /etc/fstab which was preventing chmod and executable bits from working properly. Removing noacl and rebuilding fixed the problem (no more exe suffixes!)

More fixes:
- The failing tests about address spaces were resolved when I upgraded to flexdll 0.39.
- The failing tests about unused variables are patched
- Shared runtime removed as per above

As far as I know, I think this is everything resolved for 64-bit. The package passes all tests and runs on a few simple files when installed through an overlay. I've uploaded the 64-bit version as a test package.

Thanks,
William

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-23 16:38             ` William Hu
@ 2022-07-31 14:52               ` Jon Turney
  2022-08-07  2:26                 ` William Hu
  0 siblings, 1 reply; 20+ messages in thread
From: Jon Turney @ 2022-07-31 14:52 UTC (permalink / raw)
  To: William Hu, cygwin-apps; +Cc: cygwin-apps

On 23/07/2022 17:38, William Hu via Cygwin-apps wrote:
>>
>> Yeah, that seems plausible, but I'm not clear why we are seeing
>> different behaviour...
>>
> 
> After a long period of poking around for differences, I think I found the error - I had the `noacl` option activated in /etc/fstab which was preventing chmod and executable bits from working properly. Removing noacl and rebuilding fixed the problem (no more exe suffixes!)
> 
> More fixes:
> - The failing tests about address spaces were resolved when I upgraded to flexdll 0.39.
> - The failing tests about unused variables are patched
> - Shared runtime removed as per above
> 
> As far as I know, I think this is everything resolved for 64-bit. The package passes all tests and runs on a few simple files when installed through an overlay. I've uploaded the 64-bit version as a test package.
> 
> Thanks,

Thanks for working on this.

Please accept this literally priceless gold star for adopting this package

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-07-31 14:52               ` Jon Turney
@ 2022-08-07  2:26                 ` William Hu
  0 siblings, 0 replies; 20+ messages in thread
From: William Hu @ 2022-08-07  2:26 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-apps

Hi Jon,
>
> Thanks for working on this.
>
> Please accept this literally priceless gold star for adopting this package

Thank you very much for the valuable and shiny award!

I've also pushed the cygport and corresponding patches to the git repository.

William

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-07-16 14:22           ` Jon Turney
  2022-07-23 16:38             ` William Hu
@ 2022-08-23 20:00             ` David Allsopp
  2022-08-24  9:20               ` Corinna Vinschen
  1 sibling, 1 reply; 20+ messages in thread
From: David Allsopp @ 2022-08-23 20:00 UTC (permalink / raw)
  To: Jon Turney, William Hu, cygwin-apps

Jon Turney wrote:
> On 13/07/2022 16:41, David Allsopp wrote:
> >
> >> 3) Interesting - on my machine, the camlheader[di] files had the .exe
> >> extensions. I did some digging around and found the files are *built*
> >> without  the .exe suffix, and even *initially installed* without the
> >> .exe suffix, but  ultimately come out with the .exe suffix. I ran
> >> cyport in debug mode and apparently the files are being renamed with
> >> the suffix
> >> post-install:
> >>
> >> + case "${exe##*/}" in
> >> + mv usr/lib/ocaml/camlheaderd usr/lib/ocaml/camlheaderd.exe
> >> + exe+=.exe
> >>
> >> and did a little more digging and I think these lines in cygport are
> >> the
> >> cause:
> >> https://github.com/cygwin/cygport/blob/096f27644bd3b28f29d7522e816beb
> >> d327c
> >> f24cb/lib/src_postinst.cygpart#L1010
> 
> Yeah, that seems plausible, but I'm not clear why we are seeing different
> behaviour...
> 
> >> On the topic of "testing more thoroughly", I attempted to use ocamlc
> >> to compile a simple program and it fails with "Cannot find file
> >> camlheader" but works when I remove the ".exe", so it seems that the
> >> presence of the .exe suffixes breaks the compiler. Is there a way to
> >> prevent cygport from adding it?
> >
> > The camlheader files are data files and definitely mustn't be
> > installed with a .exe extension (nor do they need to be executable).
> 
> I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like executables
> (according to file etc.)
> 
> If they genuinely aren't, then perhaps they shouldn't have execute
> permission (which is I think what is causing them to be caught by that
> piece of code in cygport...)

ocamlc won't care about the executable bit, but these files are _data_ and so it will care if they end up with a .exe extension, because they are open'd not exec'd.

The files themselves form the start of executables produced by ocamlc. For both Cygwin and native Windows, it's a tiny C program responsible for locating ocamlrun (on Unix, it's just a shebang line) and the bytecode itself gets appended.

All best,


David

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-08-23 20:00             ` David Allsopp
@ 2022-08-24  9:20               ` Corinna Vinschen
  2022-08-24  9:28                 ` David Allsopp
  0 siblings, 1 reply; 20+ messages in thread
From: Corinna Vinschen @ 2022-08-24  9:20 UTC (permalink / raw)
  To: David Allsopp; +Cc: William Hu, cygwin-apps

On Aug 23 20:00, David Allsopp wrote:
> Jon Turney wrote:
> > I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like executables
> > (according to file etc.)
> > 
> > If they genuinely aren't, then perhaps they shouldn't have execute
> > permission (which is I think what is causing them to be caught by that
> > piece of code in cygport...)
> 
> ocamlc won't care about the executable bit, but these files are _data_
> and so it will care if they end up with a .exe extension, because they
> are open'd not exec'd.
> 
> The files themselves form the start of executables produced by ocamlc.
> For both Cygwin and native Windows, it's a tiny C program responsible
> for locating ocamlrun (on Unix, it's just a shebang line) and the
> bytecode itself gets appended.

Why is ocaml for Cygwin not produing shebang files as well?  After all,
we're trying to be as Unix-compatible as possible.


Corinna

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-08-24  9:20               ` Corinna Vinschen
@ 2022-08-24  9:28                 ` David Allsopp
  2022-08-24  9:28                   ` David Allsopp
  2022-08-24 10:04                   ` Corinna Vinschen
  0 siblings, 2 replies; 20+ messages in thread
From: David Allsopp @ 2022-08-24  9:28 UTC (permalink / raw)
  To: cygwin-apps; +Cc: William Hu

Corinna Vinschen wrote:
> On Aug 23 20:00, David Allsopp wrote:
> > Jon Turney wrote:
> > > I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like
> > > executables (according to file etc.)
> > >
> > > If they genuinely aren't, then perhaps they shouldn't have execute
> > > permission (which is I think what is causing them to be caught by
> > > that piece of code in cygport...)
> >
> > ocamlc won't care about the executable bit, but these files are _data_
> > and so it will care if they end up with a .exe extension, because they
> > are open'd not exec'd.
> >
> > The files themselves form the start of executables produced by ocamlc.
> > For both Cygwin and native Windows, it's a tiny C program responsible
> > for locating ocamlrun (on Unix, it's just a shebang line) and the
> > bytecode itself gets appended.
> 
> Why is ocaml for Cygwin not produing shebang files as well?  After all,
> we're trying to be as Unix-compatible as possible.

I'm not 100% that this is the correct history, but I think it's down to being able to start the programs from outside a Cygwin bash prompt - i.e. the programs emitted want to have a .exe by default and it's strange to have ".exe" files with a shebang header (at least from outside Cygwin).

This part of OCaml is actually old enough (late nineties) that this executable was also used on "real" Unix systems where shebang didn't work properly :)

It is possible to configure Cygwin OCaml to use shebang headers (although at the moment only by changing Makefile.config after running configure)

All best,


David

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ITA] ocaml 4.14.0
  2022-08-24  9:28                 ` David Allsopp
@ 2022-08-24  9:28                   ` David Allsopp
  2022-08-24 10:04                   ` Corinna Vinschen
  1 sibling, 0 replies; 20+ messages in thread
From: David Allsopp @ 2022-08-24  9:28 UTC (permalink / raw)
  To: cygwin-apps

Corinna Vinschen wrote:
> On Aug 23 20:00, David Allsopp wrote:
> > Jon Turney wrote:
> > > I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like
> > > executables (according to file etc.)
> > >
> > > If they genuinely aren't, then perhaps they shouldn't have execute
> > > permission (which is I think what is causing them to be caught by
> > > that piece of code in cygport...)
> >
> > ocamlc won't care about the executable bit, but these files are _data_
> > and so it will care if they end up with a .exe extension, because they
> > are open'd not exec'd.
> >
> > The files themselves form the start of executables produced by ocamlc.
> > For both Cygwin and native Windows, it's a tiny C program responsible
> > for locating ocamlrun (on Unix, it's just a shebang line) and the
> > bytecode itself gets appended.
> 
> Why is ocaml for Cygwin not produing shebang files as well?  After all,
> we're trying to be as Unix-compatible as possible.

I'm not 100% that this is the correct history, but I think it's down to being able to start the programs from outside a Cygwin bash prompt - i.e. the programs emitted want to have a .exe by default and it's strange to have ".exe" files with a shebang header (at least from outside Cygwin).

This part of OCaml is actually old enough (late nineties) that this executable was also used on "real" Unix systems where shebang didn't work properly :)

It is possible to configure Cygwin OCaml to use shebang headers (although at the moment only by changing Makefile.config after running configure)

All best,


David

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ITA] ocaml 4.14.0
  2022-08-24  9:28                 ` David Allsopp
  2022-08-24  9:28                   ` David Allsopp
@ 2022-08-24 10:04                   ` Corinna Vinschen
  1 sibling, 0 replies; 20+ messages in thread
From: Corinna Vinschen @ 2022-08-24 10:04 UTC (permalink / raw)
  To: David Allsopp; +Cc: cygwin-apps

On Aug 24 09:28, David Allsopp wrote:
> Corinna Vinschen wrote:
> > On Aug 23 20:00, David Allsopp wrote:
> > > Jon Turney wrote:
> > > > I'm confused here: /usr/lib/ocaml/camlheaderd[di] look like
> > > > executables (according to file etc.)
> > > >
> > > > If they genuinely aren't, then perhaps they shouldn't have execute
> > > > permission (which is I think what is causing them to be caught by
> > > > that piece of code in cygport...)
> > >
> > > ocamlc won't care about the executable bit, but these files are _data_
> > > and so it will care if they end up with a .exe extension, because they
> > > are open'd not exec'd.
> > >
> > > The files themselves form the start of executables produced by ocamlc.
> > > For both Cygwin and native Windows, it's a tiny C program responsible
> > > for locating ocamlrun (on Unix, it's just a shebang line) and the
> > > bytecode itself gets appended.
> > 
> > Why is ocaml for Cygwin not produing shebang files as well?  After all,
> > we're trying to be as Unix-compatible as possible.
> 
> I'm not 100% that this is the correct history, but I think it's down
> to being able to start the programs from outside a Cygwin bash prompt
> - i.e. the programs emitted want to have a .exe by default and it's
> strange to have ".exe" files with a shebang header (at least from
> outside Cygwin).
> 
> This part of OCaml is actually old enough (late nineties) that this
> executable was also used on "real" Unix systems where shebang didn't
> work properly :)
> 
> It is possible to configure Cygwin OCaml to use shebang headers
> (although at the moment only by changing Makefile.config after running
> configure)

That would be nice, actually, together with dropping the .exe suffix,
perhaps.  Dunno about others, but I'd prefer to have ocaml scripts w/o
exe prefix and working OOTB on other Unixoid systems in the first place.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-08-24 10:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04  2:03 [ITA] ocaml 4.14.0 William Hu
2022-07-04 17:03 ` Jon Turney
2022-07-05  0:42   ` William Hu
2022-07-05 19:44     ` Jon Turney
2022-07-13  2:56       ` William Hu
2022-07-13 15:41         ` David Allsopp
2022-07-14  3:36           ` William Hu
2022-07-14 14:56             ` David Allsopp
2022-07-15  3:20               ` William Hu
2022-07-16 14:22           ` Jon Turney
2022-07-23 16:38             ` William Hu
2022-07-31 14:52               ` Jon Turney
2022-08-07  2:26                 ` William Hu
2022-08-23 20:00             ` David Allsopp
2022-08-24  9:20               ` Corinna Vinschen
2022-08-24  9:28                 ` David Allsopp
2022-08-24  9:28                   ` David Allsopp
2022-08-24 10:04                   ` Corinna Vinschen
2022-07-16 14:05         ` Jon Turney
2022-07-17 20:56           ` William Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).