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

Haskell fpm cannot build stdlib #11

Open
awvwgk opened this issue Mar 14, 2021 · 7 comments
Open

Haskell fpm cannot build stdlib #11

awvwgk opened this issue Mar 14, 2021 · 7 comments

Comments

@awvwgk
Copy link
Member

awvwgk commented Mar 14, 2021

Trying to use stdlib (https://github.com/LKedward/stdlib-fpm at commit eadc8ad5eaf182adee04f1bd31624ad19b9eaf2c) for fpm yields the following error in Haskell fpm:

fpm: Error when running Shake build system:
  at want, called at src/Build.hs:167:11 in fpm-0.1.0.0-5jx9ZzGZ9Bb3Rtenr4ru0y:Build
* Depends on: build/gfortran_30e5626f04e0df84_2a4c534d3ee9fc79/stdlib/libstdlib.a
  at undefined, called at src/BuildModel.hs:108:16 in fpm-0.1.0.0-5jx9ZzGZ9Bb3Rtenr4ru0y:BuildModel
  at error, called at libraries/base/GHC/Err.hs:78:14 in base:GHC.Err
* Raised the exception:
Prelude.undefined

This is a major blocker for using stdlib in Fortran fpm.

@awvwgk
Copy link
Member Author

awvwgk commented Mar 14, 2021

@everythingfunctional Do you have any pointers on what is throwing up the Haskell version here?

@everythingfunctional
Copy link
Member

Does stdlib have source files that don't have a program, module or submodule? The error is coming from this line, which is at the end of an if-else chain. The Haskell model of a project assumes that each file contains one (and only one) program, module or submodule. It could be extended to allow for files that contain multiple (or even no) programs, modules and/or submodules, but if the Fortran version works I don't feel much urgency in actually doing it given how close we are to being able to have fpm no longer relying on it (i.e. fortran-lang/fpm#253). I could be persuaded if there is a good reason to do so.

@LKedward
Copy link
Member

Apologies, I think this is due to an empty source file common.f90 that's been included in stdlib-fpm by mistake. Removing it appears to fix the problem for me.

@LKedward
Copy link
Member

Okay not quite fixed, there's another issue :-/

@LKedward
Copy link
Member

LKedward commented Mar 15, 2021

Okay, so the second problem is that stdlib_bitsets is using the use :: syntax (with double-colons) which isn't supported by the Haskell implementation. Replacing it fixes the problem.

Edit: I've added a patch to stdlib-fpm; the most recent version now builds with both Fortran and Haskell implementations of fpm in the CI.

@awvwgk
Copy link
Member Author

awvwgk commented Mar 15, 2021

@LKedward Thanks for working around these issues. Should any of those changes get upstreamed to stdlib?

@LKedward
Copy link
Member

Perhaps the instance of use :: stdlib_kinds should be replaced with use stdlib_kinds for consistency across stdlib, but otherwise the changes are really just workarounds for compatibility with Haskell fpm and so don't necessitate upstreaming.

@awvwgk awvwgk transferred this issue from fortran-lang/fpm Mar 31, 2021
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

3 participants