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

Error when creating opam switch: signals_nat.c:194:13: error: variably modified ‘sig_alt_stack’ at file scope #4577

Closed
Cameronsplaze opened this issue Nov 17, 2021 · 2 comments

Comments

@Cameronsplaze
Copy link
Contributor

When running:

opam init --yes --shell-setup
opam switch create xen-api opam-base-compiler.4.10.1 --yes

The second command gives me the following output:

[victor@fedora xen-api]$ opam switch create xen-api ocaml-base-compiler.4.10.1 --yes

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "4.10.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
⬇ retrieved ocaml-base-compiler.4.10.1  (cached)
[ERROR] The compilation of ocaml-base-compiler.4.10.1 failed at "make -j11 world.opt".

#=== ERROR while compiling ocaml-base-compiler.4.10.1 =========================#
# context     2.1.1 | linux/x86_64 |  | https://opam.ocaml.org#7247859e
# path        ~/.opam/xen-api/.opam-switch/build/ocaml-base-compiler.4.10.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j11 world.opt
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-13654-455f17.env
# output-file ~/.opam/log/ocaml-base-compiler-13654-455f17.out
### output ###
# [...]
# signals_nat.c:194:13: error: variably modified ‘sig_alt_stack’ at file scope
#   194 | static char sig_alt_stack[SIGSTKSZ];
#       |             ^~~~~~~~~~~~~
# gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -fno-common -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o memory_n.o memory.c
# make[3]: *** [Makefile:341: signals_nat_n.o] Error 1
# make[3]: *** Waiting for unfinished jobs....
# make[3]: Leaving directory '/home/victor/.opam/xen-api/.opam-switch/build/ocaml-base-compiler.4.10.1/runtime'
# make[2]: *** [Makefile:1008: makeruntimeopt] Error 2
# make[2]: Leaving directory '/home/victor/.opam/xen-api/.opam-switch/build/ocaml-base-compiler.4.10.1'
# make[1]: *** [Makefile:414: opt.opt] Error 2
# make[1]: Leaving directory '/home/victor/.opam/xen-api/.opam-switch/build/ocaml-base-compiler.4.10.1'
# make: *** [Makefile:472: world.opt] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-base-compiler 4.10.1
└─ 
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray base
│ ∗ install base-threads  base
│ ∗ install base-unix     base
└─ 

<><> ocaml-base-compiler.4.10.1 troubleshooting <><><><><><><><><><><><><><><><>
=> A failure in the middle of the build may be caused by build parallelism
      (enabled by default).
      Please file a bug report at https://github.com/ocaml/opam-repository/issues
=> You can try installing again including --jobs=1
      to force a sequential build instead.
# Run eval $(opam env --switch=xen-api) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] y

Tried with --jobs=1 too, same result. Running on a fresh install of Fedora Workstation 35. glibc version 2.34-8.fc35.

Looks like this is a problem with upstream glibc, and everything I can find says update ocaml to 4.13:
https://discuss.ocaml.org/t/ocaml-4-12-1-build-error-on-latest-ubuntu-21-10/8826
ocaml/ocaml#10250 (comment) (And the comment after this one).

There's a draft open, to push the fix back to older versions too, but it's not available yet:
ocaml/opam-repository#19855

If this is the cause of my error, is the best solution then to wait for this to get fixed upstream? And maybe pin glibc to the version before the breaking change, if I need to build this sooner?

@edwintorok
Copy link
Contributor

You can attempt to use a container with OCaml 4.10 meanwhile (there should be a script in xs-opam to create a docker package)
New OS releases typically require new compiler versions. I think we should able to compile with newer versions of the compiler, but some opam packages might need to be updated to support newer versions (in particular ppx/ocaml-migrate-parsetree related packages). I think we've got a 4.11 remote in xs-opam, might be useful to try and create a 4.13 one (especially that it is at a .1 release, which is usually the threshold when we start looking at new compiler versions)

@Cameronsplaze
Copy link
Contributor Author

Cameronsplaze commented Nov 21, 2021

I'm trying to get a working Docker image. The one in xs-opam/tools/Dockerfile gives this when I try to build it:

[victor@fedora xs-opam]$ docker build -f tools/Dockerfile -t xen-api .
Sending build context to Docker daemon  899.6kB
Step 1/5 : FROM ocaml/opam2:debian-10-ocaml-4.08
 ---> 28d75e7d1bf5
Step 2/5 : MAINTAINER  Christian Lindig <christian.lindig@citrix.com>
 ---> Using cache
 ---> f3a8110da4be
Step 3/5 : COPY . /tmp/xs-opam
 ---> Using cache
 ---> 825de69951a3
Step 4/5 : RUN sudo apt-get update
 ---> Running in 131787ac91f3
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Reading package lists...
E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
E: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
E: Repository 'http://deb.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
The command '/bin/sh -c sudo apt-get update' returned a non-zero code: 100

I tried to write my own, and this is what it looks like so far:

FROM ocaml/opam:fedora-ocaml-4.10

RUN sudo yum update -y && sudo yum upgrade

# Setup build repo
RUN git clone https://github.com/xapi-project/xen-api
WORKDIR /home/opam/xen-api

# Setup the switch enviornment
RUN opam init --yes --shell-setup
RUN opam switch create ocaml-base-compiler.4.10.1 --yes
RUN eval $(opam env --switch=ocaml-base-compiler.4.10.1 --set-switch)
RUN opam repo add --all-switches xs-opam https://github.com/xapi-project/xs-opam.git
RUN opam repo remove --all default

# Install the packages
RUN eval $(opam env)
RUN opam pin --yes add . --no-action
RUN eval $(opam env)
RUN opam --yes depext --yes -u xs-toolstack
RUN eval $(opam env)
RUN opam install xs-toolstack --yes --deps-only --with-test -v
RUN eval $(opam env)

# Build everything
RUN ./configure
RUN make
RUN make test

It fails on this line, reguardless if each of those commands are under a single RUN command, or spread out like above:

RUN opam install xs-toolstack --yes --deps-only --with-test -v

This is the error it's giving:

The packages you requested declare the following system dependencies. Please make sure they are installed before retrying:
    dlm-devel

# Run eval $(opam env) to update the current shell environment

The former state can be restored with:
    opam switch import "/home/opam/.opam/ocaml-base-compiler.4.10.1/.opam-switch/backup/state-20211121060228.export"
'opam install xs-toolstack --yes --deps-only --with-test -v' failed.
The command '/bin/sh -c eval $(opam env) && opam pin --yes add . --no-action && eval $(opam env) && opam --yes depext --yes -u xs-toolstack && eval $(opam env) && opam install xs-toolstack --yes --deps-only --with-test -v && eval $(opam env)' returned a non-zero code: 31

But if I add sudo yum install -y dlm-devel to the commands, it says it's already installed. Any idea how to best get past this? Or if it's worth it, if this might be fixed soon anyways?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants