-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build on OmniOS #9087
Build on OmniOS #9087
Conversation
Some context to help review this PR: OmniOS is a Unix distribution based on the Illumos kernel and core system, which is a descendant of Sun Solaris 2. In #2024 we removed Before we accept this PR we should think of how OCaml on OmniOS will be tested and maintained in the future. |
Well for what it is worth, it seems to build and work perfectly on OmniOS/Illumos with very little modification. What's more, Illumos distros are the perfect host environments for OCaml applications precisely because they are so stable. I would be willing to help out with whatever is needed for CI as much as I can to get this supported, including providing a dedicated a OmniOS test machine. Solaris may be dead, but Illumos is certainly not. |
It's excellent to see the Illumos kernel continue on! I notice that OmniOS publishes Amazon AMIs, so I could provision a machine or two on AWS for use by the Inria Jenkins CI. It'll be a while longer before we can meaningfully test opam on it, but we're on our way there with FreeBSD support being worked on for the next iteration of the opam CI at the moment... |
That is great to hear. If you need any help with OmniOS setup (which packages to install for compiler, headers etc.) or anything else, I will be glad to assist in any way I can. |
I managed to install OmniOS as a VM in our CI system. This is good sign because I tried with IllumOS some time ago and could never get it to work. However, I failed to build this PR on this OmniOS installation.
For reference, my configuration is:
|
I have the fix for that. It has to do with the system linker options in
autotools I think. I will find the appropriate code and post it later today
or tomorrow.
…On Sun, Dec 8, 2019, 4:32 AM Xavier Leroy ***@***.***> wrote:
I managed to install OmniOS as a VM in our CI system. This is good sign
because I tried with IllumOS some time ago and could never get it to work.
However, I failed to build this PR on this OmniOS installation.
-
./configure defaults to building for x86 32 bits, without native-code
compilation. ./configure CC="gcc -m64" is necessary to get 64-bit
support and native-code compilation. This would have been nice to mention,
or even to autoselect as a default.
-
runtime/misc.c triggers a warning-as-error. This is actually a mistake
in OCaml's code concerning the type pid_t. The fix is
--- a/runtime/misc.c
+++ b/runtime/misc.c
@@ -244,7 +244,7 @@ void caml_instr_atexit (void)
char *name = fname;
if (name[0] == '@'){
- snprintf (buf, sizeof(buf), "%s.%d", name + 1, getpid ());
+ snprintf (buf, sizeof(buf), "%s.%ld", name + 1, (long)(getpid ()));
name = buf;
}
if (name[0] == '+'){
- Linking the bytecode interpreter fails:
gcc -m64 -O2 -fno-strict-aliasing -fwrapv -Wall -Werror -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE -Wl,-E -o ocamlrun prims.o libcamlrun.a -lm -lpthread -lposix4 -lsocket -lnsl -lrt -lresolv
ld: fatal: unrecognized option '-E'
ld: fatal: use the -z help option for usage information
For reference, my configuration is:
$ uname -a
SunOS ocaml-omnios 5.11 omnios-r151030-1b80ce3d31 i86pc i386 i86pc
$ cat /etc/motd
OmniOS 5.11 omnios-r151030-1b80ce3d31 June 2019
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9087?email_source=notifications&email_token=AAG6TEF6G33XFQC3S7PIBU3QXTENNA5CNFSM4JIA3TS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGG2WWA#issuecomment-562932568>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6TEDI435RIM2COWFWCDLQXTENNANCNFSM4JIA3TSQ>
.
|
Actually the changes are in my pull request:
https://github.com/ocaml/ocaml/pull/9087/files
…On Sun, Dec 8, 2019 at 11:06 AM Mike Owens ***@***.***> wrote:
I have the fix for that. It has to do with the system linker options in
autotools I think. I will find the appropriate code and post it later today
or tomorrow.
On Sun, Dec 8, 2019, 4:32 AM Xavier Leroy ***@***.***>
wrote:
> I managed to install OmniOS as a VM in our CI system. This is good sign
> because I tried with IllumOS some time ago and could never get it to work.
>
> However, I failed to build this PR on this OmniOS installation.
>
> -
>
> ./configure defaults to building for x86 32 bits, without native-code
> compilation. ./configure CC="gcc -m64" is necessary to get 64-bit
> support and native-code compilation. This would have been nice to mention,
> or even to autoselect as a default.
> -
>
> runtime/misc.c triggers a warning-as-error. This is actually a
> mistake in OCaml's code concerning the type pid_t. The fix is
>
> --- a/runtime/misc.c
> +++ b/runtime/misc.c
> @@ -244,7 +244,7 @@ void caml_instr_atexit (void)
> char *name = fname;
>
> if (name[0] == '@'){
> - snprintf (buf, sizeof(buf), "%s.%d", name + 1, getpid ());
> + snprintf (buf, sizeof(buf), "%s.%ld", name + 1, (long)(getpid ()));
> name = buf;
> }
> if (name[0] == '+'){
>
>
> - Linking the bytecode interpreter fails:
>
> gcc -m64 -O2 -fno-strict-aliasing -fwrapv -Wall -Werror -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE -Wl,-E -o ocamlrun prims.o libcamlrun.a -lm -lpthread -lposix4 -lsocket -lnsl -lrt -lresolv
> ld: fatal: unrecognized option '-E'
> ld: fatal: use the -z help option for usage information
>
> For reference, my configuration is:
>
> $ uname -a
> SunOS ocaml-omnios 5.11 omnios-r151030-1b80ce3d31 i86pc i386 i86pc
> $ cat /etc/motd
> OmniOS 5.11 omnios-r151030-1b80ce3d31 June 2019
>
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#9087?email_source=notifications&email_token=AAG6TEF6G33XFQC3S7PIBU3QXTENNA5CNFSM4JIA3TS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGG2WWA#issuecomment-562932568>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAG6TEDI435RIM2COWFWCDLQXTENNANCNFSM4JIA3TSQ>
> .
>
--
Mike
|
I fetched your branch and ran "autoconf", then observed the two errors I reported (the fatal warning and the |
I am sorry. I found the problem. Starting at line 772 in configure.ac the clause should be changed to the following:
Basically Solaris needs to be removed from the last case with Linux and FreeBSD et. al. and given its own special case to omit the -Wl,E flags. I think my diff was taken against release 4.09.0 rather than trunk and that's why I missed this. I am very sorry for the inconvenience. |
Also, another issue I ran into on this build. I am not sure is the right way to handle this in all cases but it is needed on Illumos:
|
Let me just check out the latest version on trunk, reapply the changes, test again and then I will notify you. I will have it done in the next day or so. |
I have merged the latest from trunk and updated my branch (https://github.com/mikeowens/ocaml) to include the above changes. I am running into the following problem however where some system link flags are not being passed correctly with respect to otherlibs/unix/libunix.a:
I am pretty sure these correspond to "-lsocket -lnsl -lrt -lresolv" which I did include in the (seemingly) relevant places in the |
@mikeowens are you still maintaining this PR? Will you rebase and update, or should I open a new PR? A variation/simplification of this PR works well for me on OmniOS (with GCC). diff --git a/Makefile.config.in b/Makefile.config.in
index 6252b5dc4..eae3fcb8a 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -172,6 +172,7 @@ OTHERLIBRARIES=@otherlibraries@
# Needed for the "systhreads" package
PTHREAD_LINK=@pthread_link@
PTHREAD_CAML_LINK=$(addprefix -cclib ,$(PTHREAD_LINK))
+PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
UNIX_OR_WIN32=@unix_or_win32@
UNIXLIB=@unixlib@
diff --git a/configure.ac b/configure.ac
index f96dfdedc..df2a8cd7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,6 +836,12 @@ AS_IF([test x"$enable_shared" != "xno"],
[xlc*],
[mksharedlib="$CC -qmkshrobj -G"
shared_libraries_supported=true])],
+ [*-*-solaris*],
+ [sharedlib_cflags="-fPIC"
+ mksharedlib="$CC -shared"
+ rpath="-Wl,-rpath,"
+ mksharedlibrpath="-Wl,-rpath,"
+ shared_libraries_supported=true],
[[*-*-linux*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\
|*-*-openbsd*|*-*-netbsd*|*-*-dragonfly*|*-*-gnu*|*-*-haiku*]],
[sharedlib_cflags="-fPIC"
@@ -867,6 +873,7 @@ AS_IF([test x"$enable_shared" != "xno"],
[x86_64-*-darwin*], [natdynlink=true],
[s390x*-*-linux*], [natdynlink=true],
[powerpc*-*-linux*], [natdynlink=true],
+ [x86_64-*-solaris*], [natdynlink=true],
[i686-*-kfreebsd*], [natdynlink=true],
[x86_64-*-kfreebsd*], [natdynlink=true],
[x86_64-*-dragonfly*], [natdynlink=true],
@@ -964,6 +971,8 @@ AS_CASE([$host],
[arch=amd64; system=gnu],
[x86_64-*-dragonfly*],
[arch=amd64; system=dragonfly],
+ [x86_64-*-solaris*],
+ [arch=amd64; system=solaris],
[x86_64-*-freebsd*],
[arch=amd64; system=freebsd],
[x86_64-*-netbsd*],
@@ -1003,7 +1012,6 @@ AC_CHECK_TOOL([DIRECT_LD],[ld])
AS_IF([test -z "$PARTIALLD"],
[AS_CASE(["$arch,$CC,$system,$model"],
[amd64,gcc*,macosx,*], [PACKLD_FLAGS=' -arch x86_64'],
- [amd64,gcc*,solaris,*], [PACKLD_FLAGS=' -m elf_x86_64'],
[power,gcc*,elf,ppc], [PACKLD_FLAGS=' -m elf32ppclinux'],
[power,gcc*,elf,ppc64], [PACKLD_FLAGS=' -m elf64ppc'],
[power,gcc*,elf,ppc64le], [PACKLD_FLAGS=' -m elf64lppc'],
@@ -1253,6 +1261,9 @@ AS_CASE([$host],
[*-*-haiku],
[cclibs="$cclibs -lnetwork"
sockets=true],
+ [*-*-solaris*],
+ [cclibs="$cclibs -lsocket -lnsl"
+ sockets=true],
[
AC_CHECK_FUNC([socket])
AC_CHECK_FUNC([socketpair])
@@ -1624,7 +1635,6 @@ AS_IF([test x"$enable_systhreads" = "xno"],
[systhread_support=true
otherlibraries="$otherlibraries systhreads"
AS_CASE([$host],
- [*-*-solaris*], [pthread_link="-lpthread -lposix4"],
[*-*-haiku*], [pthread_link=""],
[*-*-android*], [pthread_link=""],
[pthread_link="-lpthread"])
diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
index 5ac70d777..be42d0b81 100644
--- a/otherlibs/systhreads/Makefile
+++ b/otherlibs/systhreads/Makefile
@@ -22,7 +22,7 @@ ifneq "$(CCOMPTYPE)" "msvc"
OC_CFLAGS += -g
endif
-OC_CFLAGS += $(SHAREDLIB_CFLAGS)
+OC_CFLAGS += $(SHAREDLIB_CFLAGS) $(PTHREAD_CFLAGS)
OC_CPPFLAGS += -I$(ROOTDIR)/runtime
diff --git a/otherlibs/systhreads/st_posix.h b/otherlibs/systhreads/st_posix.h
index b4ed6860c..e4b862a37 100644
--- a/otherlibs/systhreads/st_posix.h
+++ b/otherlibs/systhreads/st_posix.h
@@ -21,9 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
-#ifdef __sun
-#define _POSIX_PTHREAD_SEMANTICS
-#endif
#include <signal.h>
#include <time.h>
#include <sys/time.h>
diff --git a/otherlibs/systhreads/st_stubs.c b/otherlibs/systhreads/st_stubs.c
index 9af8c45fe..64a559003 100644
--- a/otherlibs/systhreads/st_stubs.c
+++ b/otherlibs/systhreads/st_stubs.c
@@ -13,6 +13,10 @@
/* */
/**************************************************************************/
+#if defined(__sun) && !defined(_POSIX_PTHREAD_SEMANTICS)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+
#define CAML_INTERNALS
#include "caml/alloc.h"
diff --git a/otherlibs/unix/execvp.c b/otherlibs/unix/execvp.c
index ce3e99ec9..8063567b3 100644
--- a/otherlibs/unix/execvp.c
+++ b/otherlibs/unix/execvp.c
@@ -14,7 +14,11 @@
/**************************************************************************/
#define _GNU_SOURCE /* helps to find execvpe() */
+#ifdef __sun
+#include <strings.h>
+#else
#include <string.h>
+#endif
#include <caml/mlvalues.h>
#include <caml/memory.h>
#define CAML_INTERNALS The issue with _POSIX_PTHREAD_SEMANTICS is that even though it is defined in otherlibs/systhreads/st_posix.h, it is too late because otherlibs/systhreads/st_stubs.c includes caml/signals.h before st_posix.h. |
Separately, can enable stack overflow detection. diff --git a/configure.ac b/configure.ac
index df2a8cd7d..d7f94647d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1616,7 +1616,7 @@ AC_MSG_CHECKING([whether stack overflows can be detected])
AS_CASE([$arch,$system],
[i386,linux_elf|amd64,linux|amd64,macosx \
- |amd64,openbsd|i386,bsd_elf],
+ |amd64,solaris|amd64,openbsd|i386,bsd_elf],
[AC_DEFINE([HAS_STACK_OVERFLOW_DETECTION])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]) |
@tleedjarv No I'm not maintaining this. |
This PR can be safely closed - the support for OmniOS was restored in #10063 |
No description provided.