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

fpm fails to run on macOS M1 #980

Open
certik opened this issue Jan 12, 2024 · 3 comments
Open

fpm fails to run on macOS M1 #980

certik opened this issue Jan 12, 2024 · 3 comments
Labels
bug Something isn't working regression Something isn't working that previously did work

Comments

@certik
Copy link
Member

certik commented Jan 12, 2024

I used the latest version (80869ad), and both fpm install and ./install.sh creates an fpm binary that segfaults. I am using:

$ gfortran --version
GNU Fortran (Spack GCC) 11.3.0

This used to work previously, since I had a working version.

Here is the full log:

$ ./install.sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 27841    0 27841    0     0  58219      0 --:--:-- --:--:-- --:--:-- 58736
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1380k  100 1380k    0     0  1284k      0  0:00:01  0:00:01 --:--:-- 11.2M
 + mkdir -p build/dependencies
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /Users/ondrej/repos/fortran-lang/fpm/build/dependencies/toml-f/.git/
remote: Enumerating objects: 289, done.
remote: Counting objects: 100% (289/289), done.
remote: Compressing objects: 100% (236/236), done.
remote: Total 289 (delta 54), reused 166 (delta 20), pack-reused 0
Receiving objects: 100% (289/289), 463.80 KiB | 1.58 MiB/s, done.
Resolving deltas: 100% (54/54), done.
From https://github.com/toml-f/toml-f
 * branch            d7b892b1d074b7cfc5d75c3e0eb36ebc1f7958c1 -> FETCH_HEAD
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /Users/ondrej/repos/fortran-lang/fpm/build/dependencies/M_CLI2/.git/
remote: Enumerating objects: 1335, done.
remote: Counting objects: 100% (1335/1335), done.
remote: Compressing objects: 100% (756/756), done.
remote: Total 1335 (delta 431), reused 1042 (delta 267), pack-reused 0
Receiving objects: 100% (1335/1335), 12.59 MiB | 8.63 MiB/s, done.
Resolving deltas: 100% (431/431), done.
From https://github.com/urbanjost/M_CLI2
 * branch            7264878cdb1baff7323cc48596d829ccfe7751b8 -> FETCH_HEAD
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /Users/ondrej/repos/fortran-lang/fpm/build/dependencies/fortran-regex/.git/
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 25 (delta 0), reused 15 (delta 0), pack-reused 0
Unpacking objects: 100% (25/25), 84.99 KiB | 669.00 KiB/s, done.
From https://github.com/perazz/fortran-regex
 * tag               1.1.2      -> FETCH_HEAD
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /Users/ondrej/repos/fortran-lang/fpm/build/dependencies/jonquil/.git/
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 47 (delta 7), reused 25 (delta 1), pack-reused 0
Unpacking objects: 100% (47/47), 55.71 KiB | 600.00 KiB/s, done.
From https://github.com/toml-f/jonquil
 * branch            4fbd4cf34d577c0fd25e32667ee9e41bf231ece8 -> FETCH_HEAD
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /Users/ondrej/repos/fortran-lang/fpm/build/dependencies/fortran-shlex/.git/
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 13 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), 7.71 KiB | 987.00 KiB/s, done.
From https://github.com/perazz/fortran-shlex
 * tag               1.0.1      -> FETCH_HEAD
[  0%]         filesystem_utilities.c
[  1%]         filesystem_utilities.c  done.
[  1%]        fpm_backend_console.f90
[  2%]        fpm_backend_console.f90  done.
[  2%]                       fpm_os.c
[  3%]                       fpm_os.c  done.
[  3%]                fpm_strings.f90
[  4%]                fpm_strings.f90  done.
[  4%]                       isatty.c
[  5%]                       isatty.c  done.
[  5%]                     iscygpty.c
[  6%]                     iscygpty.c  done.
[  6%]                  constants.f90
[  7%]                  constants.f90  done.
[  7%]                    version.f90
[  8%]                    version.f90  done.
[  8%]                      token.f90
[ 10%]                      token.f90  done.
[ 10%]                     M_CLI2.F90
[ 11%]                     M_CLI2.F90  done.
[ 11%]                      regex.f90
[ 12%]                      regex.f90  done.
[ 12%]                    version.f90
[ 13%]                    version.f90  done.
[ 13%]               shlex_module.f90
[ 14%]               shlex_module.f90  done.
[ 14%]                      error.f90
[ 15%]                      error.f90  done.
[ 15%]                   datetime.f90
[ 16%]                   datetime.f90  done.
[ 16%]                      error.f90
[ 17%]                      error.f90  done.
[ 17%]                         io.f90
[ 18%]                         io.f90  done.
[ 18%]            fpm_environment.f90
[ 20%]            fpm_environment.f90  done.
[ 20%]                 versioning.f90
[ 21%]                 versioning.f90  done.
[ 21%]                      utils.f90
[ 22%]                      utils.f90  done.
[ 22%]                        abc.f90
[ 23%]                        abc.f90  done.
[ 23%]             fpm_filesystem.F90
[ 24%]             fpm_filesystem.F90  done.
[ 24%]                fpm_release.F90
[ 25%]                fpm_release.F90  done.
[ 25%]                   terminal.f90
[ 26%]                   terminal.f90  done.
[ 26%]                      value.f90
[ 27%]                      value.f90  done.
[ 27%]                      lexer.f90
[ 28%]                      lexer.f90  done.
[ 28%]               fpm_compiler.F90
[ 30%]               fpm_compiler.F90  done.
[ 30%]                     fpm_os.F90
[ 31%]                     fpm_os.F90  done.
[ 31%]                        git.f90
[ 32%]                        git.f90  done.
[ 32%]                  installer.f90
[ 33%]                  installer.f90  done.
[ 33%]                 diagnostic.f90
[ 34%]                 diagnostic.f90  done.
[ 34%]                       list.f90
[ 35%]                       list.f90  done.
[ 35%]                        map.f90
[ 36%]                        map.f90  done.
[ 36%]                       node.f90
[ 37%]                       node.f90  done.
[ 37%]                     keyval.f90
[ 38%]                     keyval.f90  done.
[ 38%]                       sort.f90
[ 40%]                       sort.f90  done.
[ 40%]           fpm_command_line.f90
[ 41%]           fpm_command_line.f90  done.
[ 41%]                    context.f90
[ 42%]                    context.f90  done.
[ 42%]                 array_list.f90
[ 43%]                 array_list.f90  done.
[ 43%]                ordered_map.f90
[ 44%]                ordered_map.f90  done.
[ 44%]                  structure.f90
[ 45%]                  structure.f90  done.
[ 45%]                      lexer.f90
[ 46%]                      lexer.f90  done.
[ 46%]                      array.f90
[ 47%]                      array.f90  done.
[ 47%]                      table.f90
[ 48%]                      table.f90  done.
[ 48%]                       type.f90
[ 50%]                       type.f90  done.
[ 50%]                        ser.f90
[ 51%]                        ser.f90  done.
[ 51%]                     keyval.f90
[ 52%]                     keyval.f90  done.
[ 52%]                      merge.f90
[ 53%]                      merge.f90  done.
[ 53%]                     parser.f90
[ 54%]                     parser.f90  done.
[ 54%]                        ser.f90
[ 55%]                        ser.f90  done.
[ 55%]                         de.f90
[ 56%]                         de.f90  done.
[ 56%]                      array.f90
[ 57%]                      array.f90  done.
[ 57%]                      table.f90
[ 58%]                      table.f90  done.
[ 58%]                       path.f90
[ 60%]                       path.f90  done.
[ 60%]                      build.f90
[ 61%]                      build.f90  done.
[ 61%]                      tomlf.f90
[ 62%]                      tomlf.f90  done.
[ 62%]                     parser.f90
[ 63%]                     parser.f90  done.
[ 63%]                       toml.f90
[ 64%]                       toml.f90  done.
[ 64%]                    jonquil.f90
[ 65%]                    jonquil.f90  done.
[ 65%]               fpm_settings.f90
[ 66%]               fpm_settings.f90  done.
[ 66%]                 downloader.f90
[ 67%]                 downloader.f90  done.
[ 67%]                      build.f90
[ 68%]                      build.f90  done.
[ 68%]                    fortran.f90
[ 70%]                    fortran.f90  done.
[ 70%]                    install.f90
[ 71%]                    install.f90  done.
[ 71%]                    library.f90
[ 72%]                    library.f90  done.
[ 72%]                       meta.f90
[ 73%]                       meta.f90  done.
[ 73%]                 preprocess.f90
[ 74%]                 preprocess.f90  done.
[ 74%]                   profiles.f90
[ 75%]                   profiles.f90  done.
[ 75%]                 dependency.f90
[ 76%]                 dependency.f90  done.
[ 76%]                 executable.f90
[ 77%]                 executable.f90  done.
[ 77%]                    example.f90
[ 78%]                    example.f90  done.
[ 78%]                       test.f90
[ 80%]                       test.f90  done.
[ 80%]                    package.f90
[ 81%]                    package.f90  done.
[ 81%]                   manifest.f90
[ 82%]                   manifest.f90  done.
[ 82%]                        new.f90
[ 83%]                        new.f90  done.
[ 83%]                 dependency.f90
[ 84%]                 dependency.f90  done.
[ 84%]                  fpm_model.f90
[ 85%]                  fpm_model.f90  done.
[ 85%]                     update.f90
[ 86%]                     update.f90  done.
[ 86%]                   fpm_meta.f90
[ 87%]                   fpm_meta.f90  done.
[ 87%]         fpm_source_parsing.f90
[ 88%]         fpm_source_parsing.f90  done.
[ 88%]                fpm_sources.f90
[ 90%]                fpm_sources.f90  done.
[ 90%]                fpm_targets.f90
[ 91%]                fpm_targets.f90  done.
[ 91%]         fpm_backend_output.f90
[ 92%]         fpm_backend_output.f90  done.
[ 92%]                fpm_backend.F90
[ 93%]                fpm_backend.F90  done.
[ 93%]                        fpm.f90
[ 94%]                        fpm.f90  done.
[ 94%]                    install.f90
[ 95%]                    install.f90  done.
[ 95%]                    publish.f90
[ 96%]                    publish.f90  done.
[ 96%]                       libfpm.a
[ 97%]                       libfpm.a  done.
[ 97%]                       main.f90
[ 98%]                       main.f90  done.
[ 98%]                            fpm
[100%]                            fpm  done.
[100%] Project compiled successfully.
# Update: build/gfortran_7E39037AD371E5BE/app/fpm -> /Users/ondrej/.local/bin
fortran-lang/fpm(main) $ ~/.local/bin/fpm --version
zsh: killed     ~/.local/bin/fpm --version
@certik certik added bug Something isn't working regression Something isn't working that previously did work labels Jan 12, 2024
@certik
Copy link
Member Author

certik commented Jan 12, 2024

The version 39fdc09 works.

@certik
Copy link
Member Author

certik commented Jan 12, 2024

Using git bisect:

3f98e657dc8cdf95da20be5a40d81ac4a6e99b33 is the first bad commit
commit 3f98e657dc8cdf95da20be5a40d81ac4a6e99b33
Author: Federico Perini <...>
Date:   Thu Sep 14 21:58:28 2023 +0200

    add `-Ofast` optimization flags for intel compiler (release profile)

 src/fpm_compiler.F90 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Here is the commit: 3f98e65, it doesn't seem to change things for gfortran, but it causes the generated fpm binary to segfault. Any ideas what can be causing this?

CC @perazz .

@perazz
Copy link
Contributor

perazz commented Jan 12, 2024

Works on M1, my side, both fpm install and install.sh, gfortran (brew) 13.2.0. That commit did not add anything meaningful that could break the code as far as I can tell. Can I ask you to try install.sh in debug mode? Just replace the flags in install.sh with

if [ -z ${FFLAGS+x} ]; then
    FFLAGS="-g -fbacktrace -Og -fcheck=all"
fi

and maybe later with -O2, let's see if there is any optimization issues. (I actually see that fpm is compiled with -O3 right now, maybe it's too much of an optimization for a package manager? gcc -O3 is notoriously buggy). I'll note a couple of things here so we can act:

  • Should we actually use -O2 when building fpm?
  • macOS CI uses gfortran-10, maybe it's time to update / add more versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something isn't working that previously did work
Projects
None yet
Development

No branches or pull requests

2 participants