Skip to content
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

Bootstrap Opam with OCaml 4.11.1 #4242

Merged
merged 8 commits into from Sep 9, 2020
Merged

Conversation

MisterDA
Copy link
Contributor

@MisterDA MisterDA commented Jun 23, 2020

This PR builds on #4234 to fix the little things that are missing and completely replaces 4.07.1 with 4.10.0 for bootstrapping.
Updating findlib to 1.8.1 is mandatory because 1.8.0 checks for the -vmthread flag of ocamlc which has been removed in 4.10.0.
EDIT: I removed the 'flexdll appveyor patch' in favor of using the latest flexdll commit available at the time of writing.
I have also updated and expanded Travis test matrix.

Comment on lines 15 to 19
URL=`sed -ne 's/URL_ocaml *= *//p' ../src_ext/Makefile | tr -d '\r'`
MD5=`sed -ne 's/MD5_ocaml *= *//p' ../src_ext/Makefile | tr -d '\r'`
V=`echo ${URL}| sed -e 's|.*/\([^/]*\)\.tar\.gz|\1|'`
FV_URL=`sed -ne 's/URL_flexdll *= *//p' ../src_ext/Makefile | tr -d '\r'`
FLEXDLL=`echo ${FV_URL}| sed -e 's|.*/\([^/]*\)|\1|'`
URL=$(sed -ne 's/URL_ocaml *= *//p' ../src_ext/Makefile | tr -d '\r')
MD5=$(sed -ne 's/MD5_ocaml *= *//p' ../src_ext/Makefile | tr -d '\r')
V=$(echo ${URL}| sed -e 's|.*/\([^/]*\)\.tar\.gz|\1|')
FV_URL=$(sed -ne 's/URL_flexdll *= *//p' ../src_ext/Makefile | tr -d '\r')
FLEXDLL=$(echo ${FV_URL}| sed -e 's|.*/\([^/]*\)|\1|')
Copy link
Member

@dra27 dra27 Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still the odd Solaris user out there, and the default sh on still just-about supported Solaris doesn't recognise $(). These need to stay as they are (the ones in the Windows-specific part don't matter).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow! I did not know that. They’re not using xpg4 or xpg6?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the full detail - I just know that Solaris 10 uses an incredibly old sh by default (and IIRC a crazy patch too). I'm all for $() but for the most part, I tend to leave existing uses of backtick alone (you can still shoot yourself in the foot: cf. #3699 (comment))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I’m seeing is that Solaris provides multiples implementations of the tools, each following a standard.

An application that wants to use standard-conforming utilities must set the PATH (sh(1) or ksh(1)) or path (csh(1)) environment variable to specify the directories listed below in the order specified to get the appropriate utilities:

POSIX.1–2001, SUSv3

  • /usr/xpg6/bin
  • /usr/xpg4/bin
  • /usr/bin
  • directory containing binaries for your compiler
  • other directories containing binaries needed by the application

https://docs.oracle.com/cd/E86824_01/html/E54776/xpg-5.html

We could set the PATH to use the latest stuff 😄

@dra27
Copy link
Member

dra27 commented Jun 24, 2020

You do actually need to configure the Windows build 😉 This is working for me:

diff --git a/shell/bootstrap-ocaml.sh b/shell/bootstrap-ocaml.sh
index 3cf90659..13aea4fd 100755
--- a/shell/bootstrap-ocaml.sh
+++ b/shell/bootstrap-ocaml.sh
@@ -51,12 +51,23 @@ PATH_PREPEND=
 LIB_PREPEND=
 INC_PREPEND=
 if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
+  case "$(uname -m)" in
+    'i686')
+      BUILD=i686-pc-cygwin
+    ;;
+    'x86_64')
+      BUILD=x86_64-pc-cygwin
+    ;;
+  esac
   case "$1" in
-    "mingw"|"mingw64")
-      BUILD=$1
+    "mingw")
+      HOST=i686-w64-mingw32
+    ;;
+    "mingw64")
+      HOST=x86_64-w64-mingw32
     ;;
     "msvc")
-      BUILD=$1
+      HOST=i686-pc-windows
       if ! command -v ml > /dev/null ; then
         eval `${ROOT}../../shell/msvs-detect --arch=x86`
         if [ -n "${MSVS_NAME}" ] ; then
@@ -67,7 +78,7 @@ if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
       fi
     ;;
     "msvc64")
-      BUILD=$1
+      HOST=x86_64-pc-windows
       if ! command -v ml64 > /dev/null ; then
         eval `${ROOT}../../shell/msvs-detect --arch=x64`
         if [ -n "${MSVS_NAME}" ] ; then
@@ -88,24 +99,24 @@ if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
       fi

       if [ ${TRY64} -eq 1 ] && command -v x86_64-w64-mingw32-gcc > /dev/null ; then
-        BUILD=mingw64
+        HOST=x86_64-w64-mingw32
       elif command -v i686-w64-mingw32-gcc > /dev/null ; then
-        BUILD=mingw
+        HOST=i686-w64-mingw32
       elif [ ${TRY64} -eq 1 ] && command -v ml64 > /dev/null ; then
-        BUILD=msvc64
+        HOST=x86_64-pc-windows
         PATH_PREPEND=`bash ${ROOT}../../shell/check_linker`
       elif command -v ml > /dev/null ; then
-        BUILD=msvc
+        HOST=i686-pc-windows
         PATH_PREPEND=`bash ${ROOT}../../shell/check_linker`
       else
         if [ ${TRY64} -eq 1 ] ; then
-          BUILD=msvc64
-          BUILD_ARCH=x64
+          HOST=x86_64-pc-windows
+          HOST_ARCH=x64
         else
-          BUILD=msvc
-          BUILD_ARCH=x86
+          HOST=i686-pc-windows
+          HOST_ARCH=x86
         fi
-        eval `${ROOT}../../shell/msvs-detect --arch=${BUILD_ARCH}`
+        eval `${ROOT}../../shell/msvs-detect --arch=${HOST_ARCH}`
         if [ -z "${MSVS_NAME}" ] ; then
           echo "No appropriate C compiler was found -- unable to build OCaml"
           exit 1
@@ -123,9 +134,8 @@ if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
   PREFIX=`cd .. ; pwd`/ocaml
   WINPREFIX=`echo ${PREFIX} | cygpath -f - -m`
   if [ ${GEN_CONFIG_ONLY} -eq 0 ] ; then
-    sed -e "s|^PREFIX=.*|PREFIX=${WINPREFIX}|" -e "s|/lib|/lib/ocaml|" config/Makefile.${BUILD} > config/Makefile
-    cp config/s-nt.h byterun/caml/s.h
-    cp config/m-nt.h byterun/caml/m.h
+    # --disable-ocamldoc can change to --disable-stdlib-manpages when bumped to 4.11
+    PATH="${PATH_PREPEND}${PREFIX}/bin:${PATH}" Lib="${LIB_PREPEND}${Lib}" Include="${INC_PREPEND}${Include}" ./configure --prefix "$WINPREFIX" --build=$BUILD --host=$HOST --disable-ocamldoc
   fi
   cd ..
   if [ ! -e ${ROOT}${FLEXDLL} ]; then
@@ -136,7 +146,9 @@ if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
     tar -xzf ${ROOT}../${FLEXDLL}
     rm -rf flexdll
     mv flexdll-* flexdll
-    PATH="${PATH_PREPEND}${PREFIX}/bin:${PATH}" Lib="${LIB_PREPEND}${Lib}" Include="${INC_PREPEND}${Include}" make flexdll world.opt install
+    PATH="${PATH_PREPEND}${PREFIX}/bin:${PATH}" Lib="${LIB_PREPEND}${Lib}" Include="${INC_PREPEND}${Include}" make -j flexdll
+    PATH="${PATH_PREPEND}${PREFIX}/bin:${PATH}" Lib="${LIB_PREPEND}${Lib}" Include="${INC_PREPEND}${Include}" make -j world.opt
+    PATH="${PATH_PREPEND}${PREFIX}/bin:${PATH}" Lib="${LIB_PREPEND}${Lib}" Include="${INC_PREPEND}${Include}" make install
     mkdir -p ../../src_ext
   fi
   OCAMLLIB=${WINPREFIX}/lib/ocaml

@MisterDA
Copy link
Contributor Author

MisterDA commented Jun 24, 2020

@dra27 there’s something weird in your patch. The line mkdir -p ../../src_ext is not present in the file in master, but it is not marked as added in your patch. Is it a left over from something else?

EDIT: oh, it’s not just that. My guess is that the diff wasn’t made against master. There are maybe other changes that are important. For instance, you have

eval `${ROOT}../../shell/msvs-detect --arch=x86`

but master contains

eval `../../shell/msvs-detect --arch=x86`

@dra27
Copy link
Member

dra27 commented Jun 24, 2020

Oops, that patch’s against a different branch which supports building 4 bootstrap compilers! It should be sufficient just to ignore the ROOT variable!

@MisterDA
Copy link
Contributor Author

@dra27 an idea why the msvc builds are failing?
And what's happening in Travis with the last failing builds?

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

This should unlock the Travis failure:

diff --git a/.travis-ci.sh b/.travis-ci.sh
index 9d85a845..f4621b91 100755
--- a/.travis-ci.sh
+++ b/.travis-ci.sh
@@ -192,6 +192,7 @@ EOF
           make world.opt
         fi
         make install
+        rm -rf "ocaml-$OCAML_VERSION.tar.gz"
         echo "LOCAL_OCAML_VERSION=$OCAML_VERSION" > ~/local/versions
         echo -en "travis_fold:end:ocaml\r"
       fi

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

The msvc failure is more subtle - I'm looking into it

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

OK, there's a path-blowout in msvs-detect - I'm just working on a fix. Hopefully the upstream maintainer for msvs-tools will merge it quickly 😉

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

Sorry - that patch I gave you was wrong - it's the directory which needs removing, not the tarball.

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

i.e.

diff --git a/.travis-ci.sh b/.travis-ci.sh
index 9d85a845..73bc1670 100755
--- a/.travis-ci.sh
+++ b/.travis-ci.sh
@@ -192,6 +192,7 @@ EOF
           make world.opt
         fi
         make install
+        rm -rf "ocaml-$OCAML_VERSION"
         echo "LOCAL_OCAML_VERSION=$OCAML_VERSION" > ~/local/versions
         echo -en "travis_fold:end:ocaml\r"
       fi

@MisterDA
Copy link
Contributor Author

I think that at this point we’re in the directory "ocaml-$OCAML_VERSION" (line 173) so we should cd .. before removing it.

@dra27
Copy link
Member

dra27 commented Jun 25, 2020

Incidentally, and hopefully trivially, this should be 4.10.1 (it’s apparently been a long day!)

@rjbou
Copy link
Collaborator

rjbou commented Jun 26, 2020

@MisterDA Please cherry-pick 1b0f4ba as it is reverted in master

@MisterDA
Copy link
Contributor Author

MisterDA commented Jul 7, 2020

Rebased against master. Some of the changes were integrated when transitioning from 4.07 to 4.09.1 in bootstrap, and some other fixes were integrated independently.

Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various bits and bobs - always worth checking the overall diff after rebasing!

#4260 will fix the transient problems affecting Travis - AppVeyor will fail because you need the upstream fix to caml/domain_state.h header. I'd suggest stalling this therefore until 4.10.1 is released (which I believe should be relatively soon, as it should shortly precede the release of 4.11).

.gitattributes Outdated Show resolved Hide resolved
.travis-ci.sh Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
master_changes.md Outdated Show resolved Hide resolved
src_ext/Makefile Show resolved Hide resolved
src_ext/Makefile Outdated Show resolved Hide resolved
src_ext/Makefile Outdated Show resolved Hide resolved
MisterDA added a commit to MisterDA/opam that referenced this pull request Jul 7, 2020
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
MisterDA added a commit to MisterDA/opam that referenced this pull request Aug 17, 2020
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
@MisterDA MisterDA changed the title Bootstrap Opam with OCaml 4.10.0 Bootstrap Opam with OCaml 4.10 Aug 17, 2020
@MisterDA
Copy link
Contributor Author

Rebase on master (2.1.0-alpha3) and test OCaml 4.10.1+rc1.

MisterDA added a commit to MisterDA/opam that referenced this pull request Aug 18, 2020
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
MisterDA added a commit to MisterDA/opam that referenced this pull request Sep 2, 2020
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
@MisterDA MisterDA changed the title Bootstrap Opam with OCaml 4.10 Bootstrap Opam with OCaml 4.11.1 Sep 2, 2020
MisterDA added a commit to MisterDA/opam that referenced this pull request Sep 3, 2020
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
avsm and others added 2 commits September 3, 2020 13:36
This is because gcc10 defaults to -fcommon which causes
compatibility carnage.  See ocaml/opam-repository#16583.

Co-authored-by: Antonin Décimo <antonin.decimo@gmail.com>
When cloning the repository under Cygwin, CRLF are not set on batch
scripts. This is irrelevant for most CIs because the repository is
cloned outside of Cygwin, but this can happen to a user building Opam
from Cygwin and experimenting with the appveyor_build.cmd script.
> the pattern is not necessary, as the scripts with those extensions
> are not executable and are crunched into an OCaml script

ocaml#4242 (comment)
@MisterDA MisterDA marked this pull request as ready for review September 5, 2020 11:52
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed one additional commit to action a comment in shell/bootstrap_ocaml.sh. Good to merge once CI comes back confirming that I didn't break the script!

@AltGr
Copy link
Member

AltGr commented Sep 9, 2020

Thanks!

@AltGr AltGr merged commit 7e4b50c into ocaml:master Sep 9, 2020
@rjbou rjbou added this to PR in Progress in Opam 2.1.x via automation Sep 14, 2020
@rjbou rjbou added this to the 2.1.0~beta2 milestone Sep 14, 2020
@rjbou rjbou moved this from PR in Progress to Done in Opam 2.1.x Sep 14, 2020
@MisterDA MisterDA deleted the cold-with-4.10 branch April 18, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.1.x
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants