Replies: 6 comments 10 replies
-
When a build fails with fpm-handle-unable-to-find-module "stdlib_linalg" If the plugin exits with SUCCESS, then fpm can automatically attempt a rebuild. |
Beta Was this translation helpful? Give feedback.
-
That looks attractive, indeed. Perhaps some caution is required:
- Different compilers will differ in the exact message
- Can we guarantee that we get the right module? (Perhaps limit this to
stdlib modules?)
Op do 15 jul. 2021 om 06:03 schreef Carlos Une ***@***.***>:
… When a build fails with Unable to find source for module dependency:
"stdlib_linalg", fpm can call an fpm plugin
fpm-handle-unable-to-find-module "stdlib_linalg"
If the plugin exits with SUCCESS, then fpm can automatically attempt a
rebuild.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#519 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6YR2GCBG6NNOUTWMP5MLTXZMYJANCNFSM5AMUWVBQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Yes this can be automated and would certainly be a nice convenience. Presumably the plugin will add the new dependency to the cache file? One downside is that this could take several fetch-scan iterations for deep dependency hierarchies. I am also concerned about getting the right module since Fortran doesn't have namespaces and there might be a lot of clashes in the future perhaps (see also #153). I'd probably prefer a new command such as |
Beta Was this translation helpful? Give feedback.
-
I use a preprocessor for almost code (mostly for documentation) and I made $INCLUDE call curl for URL syntax,( but that is specifically a particular URL so it did not cause many issues with clashes) and was thinking along somewhat similiar lines about a $USE, but I can see that doing it via a scan of the Fortran directly is very appealing, but if I had something like "use lapack" I could picture that really meaning a local package or one of several fpm packages. Of course if it was supposed to be local hopefully I had put that in my external libraries to load; but that would mean you have to check a name to make sure it it not specified in some other way via the fpm.toml file; but I like the idea. I could just write a program acting like all registered fpm packages were standard intrinsics if they were in modules and "automagically" get them; but I think there should be a flag to do it automatically that is not the default, and that you get prompted by default as to whether to add it or not. Maybe start with just doing this for stdlib? Might encourage stdlib usage and make it feel more "standard" too when using fpm. Maybe do it without a prompt if followed by a comment with the URL? |
Beta Was this translation helpful? Give feedback.
-
BackgroundMaybe my next discussion is not directly related to this topic. I learned that the process of RAM has no memory if once Description (Here comes my question:)Is it possible for Back to #519 discussion#519 discusses the establishment of a global |
Beta Was this translation helpful? Give feedback.
-
Well, it should be easier that this, but this bash(1) script illustrates the steps. Remember the drawback to not building it in your packages It is easiest to illustrate with the fpm package version of stdlib, but this would work with any library whether built with fpm or not.
For illustrations the script makes a directory called $HOME/github/test/ Even if not a bash(1) user, I think the script is readable enough to show the steps; but maybe this should be annotated and written up somewhere; as a few users of libGPF.a library, which also takes a while to build, were dealing with the same issue. #!/bin/bash
WHERE=$HOME/github/test
mkdir -p $WHERE
cd $WHERE
#######################################################
STDLIB(){
git clone https://github.com/LKedward/stdlib-fpm
(cd stdlib-fpm;fpm build)
cat >>stdlib-fpm <<\EOF
[install]
library = true
EOF
(cd stdlib-fpm;install --prefix $WHERE )
}
#######################################################
# make a manifest file that uses external stdlib module
MAKETOML(){
cat <<EOF
name = "$NAME"
version = "0.1.0"
license = "MIT"
author = "$MY_NAME"
maintainer = "$USER@$(hostname)"
copyright = "Copyright $(date +%Y), $MY_NAME"
[build]
#####################################
link = ["stdlib"]
external-modules = ["stdlib_ascii"]
#####################################
auto-executables = true
auto-tests = true
auto-examples = true
[install]
library = false
EOF
}
#######################################################
MAKESRC(){
# make a source file that uses stdlib module
cat <<EOF
module $NAME
use stdlib_ascii, only : to_lower, to_upper
implicit none
private
public :: say_hello
contains
subroutine say_hello
print *, "Hello, $NAME!"
print *, to_lower("Hello, $NAME!")
print *, to_upper("Hello, $NAME!")
end subroutine say_hello
end module $NAME
EOF
}
#######################################################
#STDLIB
export NAME MY_NAME='John S. Urban'
for NAME in A B C
do
# make a seed package
fpm new $NAME
# overwrite with modified manifest file that includes external
# link and external module example
MAKETOML >$NAME/fpm.toml
# make a source file that uses stdlib module
MAKESRC >$NAME/src/$NAME.f90
(
cd $NAME
fpm run -flag '-I../include -L../lib -lstdlib'
)
done
exit Typing the long list of -flag options can get tedious. You do not have to use -L if you add the directory to LD_LIBRARY_PATH on ULS; some compilers like ifort(1) let you set up files of options or environment variables of options; and generically you can set up a fpm.rsp file and then just use fpm @run instead of fpm run; which is really only described on the M_CLI2 site. |
Beta Was this translation helpful? Give feedback.
-
In MikTeX I can write
and MikTeX will download and install the required packages for me.
In Fortran, it would be nice to be able to write
and fpm would download and install
stdlib_linalg
for me.What we need
what-provides webservice
Example request: https://fortran-lang.org/what-provides?module=stdlib_linalg
Example response: {git = "https://github.com/LKedward/stdlib-fpm.git"}
what-provides client (fpm itself)
In a newly created fpm project, one would write
and run
fpm run
; fpm would query the what-provides webservice and update fpm.toml for me.The message is currently
Unable to find source for module dependency: "stdlib_linalg" used by "app\main.f90"
I find this inconvenient, because in this example I know exactly what the problem is, and we can automate the fix.
For security, users should be able to configure their allow-auto-list in $HOME/fpm.toml:
[allow-auto-install]
my-repos, univesity-repos, fortran-lang-org-repos, other-trusted-repos, etc
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions