fortran-lang / fpm

Fortran Package Manager (fpm)
https://fpm.fortran-lang.org
MIT License
868 stars 97 forks source link

Stdlib does not build with fpm on Windows, because of directory separator #674

Open Beliavsky opened 2 years ago

Beliavsky commented 2 years ago

I run

c:\fortran\public_domain\github\stdlib>git checkout stdlib-fpm
Branch 'stdlib-fpm' set up to track remote branch 'stdlib-fpm' from 'origin'.
Switched to a new branch 'stdlib-fpm'

Then

c:\fortran\public_domain\github\stdlib>fpm build --profile release
 + mkdir build\dependencies
Initialized empty Git repository in c:/fortran/public_domain/github/stdlib/build/dependencies/test-drive/.git/
From https://github.com/fortran-lang/test-drive
 * tag               v0.4.0     -> FETCH_HEAD
 + mkdir build\gfortran_EDF3F128DBFCA123\stdlib
 + gfortran -c .\.\src\stdlib_array.f90  -O3 -funroll-loops -Wimplicit-interface -fPIC -fmax-errors=1 -fcoarray=single -J build\gfortran_EDF3F128DBFCA123\stdlib -I build\gfortran_EDF3F128DBFCA123\stdlib  -o build\gfortran_EDF3F128DBFCA123\stdlib\src_stdlib_array.f90.o
f951.exe: Warning: Nonexistent include directory 'build\gfortran_EDF3F128DBFCA123\stdlib/' [-Wmissing-include-dirs]
f951.exe: Warning: Nonexistent include directory 'build\gfortran_EDF3F128DBFCA123\stdlib/' [-Wmissing-include-dirs]
<similar errors snipped>

I think it's because of the / directory separator used (note the last warnings), since I get

c:\fortran\public_domain\github\stdlib>dir build\gfortran_EDF3F128DBFCA123\stdlib/
Invalid switch - "".

but when I change the last / to \ the command works:

c:\fortran\public_domain\github\stdlib>dir build\gfortran_EDF3F128DBFCA123\stdlib\
 Volume in drive C has no label.
 Volume Serial Number is ECC7-1C96

 Directory of c:\fortran\public_domain\github\stdlib\build\gfortran_EDF3F128DBFCA123\stdlib

03/04/2022  10:07 AM    <DIR>          .
03/04/2022  10:06 AM    <DIR>          ..
03/04/2022  10:07 AM            54,195 build_dependencies_test-drive_src_testdrive.F90.o
03/04/2022  10:07 AM                23 build_dependencies_test-drive_src_testdrive.F90.o.digest
03/04/2022  10:07 AM             1,104 build_dependencies_test-drive_src_testdrive_version.f90.o
03/04/2022  10:07 AM                23 build_dependencies_test-drive_src_testdrive_version.f90.o.digest
03/04/2022  10:06 AM             3,355 src_stdlib_array.f90.o
03/04/2022  10:06 AM                23 src_stdlib_array.f90.o.digest
03/04/2022  10:06 AM               434 src_stdlib_kinds.f90.o
03/04/2022  10:06 AM                23 src_stdlib_kinds.f90.o.digest
03/04/2022  10:07 AM               964 src_stdlib_system.F90.o
03/04/2022  10:07 AM                23 src_stdlib_system.F90.o.digest
03/04/2022  10:07 AM               916 src_stdlib_version.f90.o
03/04/2022  10:07 AM                23 src_stdlib_version.f90.o.digest
03/04/2022  10:06 AM               730 stdlib_array.mod
03/04/2022  10:06 AM               450 stdlib_kinds.mod
03/04/2022  10:07 AM               270 stdlib_system.mod
03/04/2022  10:07 AM               458 stdlib_version.mod
03/04/2022  10:07 AM             4,028 testdrive.mod
03/04/2022  10:07 AM               527 testdrive_version.mod
              18 File(s)         67,569 bytes
               2 Dir(s)   2,149,904,384 bytes free
arjenmarkus commented 2 years ago

Yes, it seems the dir command cannot handle forward slashes - this in contrast to "cd". Very awkward.

Op vr 4 mrt. 2022 om 16:19 schreef Beliavsky @.***>:

I run

c:\fortran\public_domain\github\stdlib>git checkout stdlib-fpm Branch 'stdlib-fpm' set up to track remote branch 'stdlib-fpm' from 'origin'. Switched to a new branch 'stdlib-fpm'

Then

c:\fortran\public_domain\github\stdlib>fpm build --profile release

  • mkdir build\dependencies Initialized empty Git repository in c:/fortran/public_domain/github/stdlib/build/dependencies/test-drive/.git/ From https://github.com/fortran-lang/test-drive
  • tag v0.4.0 -> FETCH_HEAD
  • mkdir build\gfortran_EDF3F128DBFCA123\stdlib
  • gfortran -c ..\src\stdlib_array.f90 -O3 -funroll-loops -Wimplicit-interface -fPIC -fmax-errors=1 -fcoarray=single -J build\gfortran_EDF3F128DBFCA123\stdlib -I build\gfortran_EDF3F128DBFCA123\stdlib -o build\gfortran_EDF3F128DBFCA123\stdlib\src_stdlib_array.f90.o f951.exe: Warning: Nonexistent include directory 'build\gfortran_EDF3F128DBFCA123\stdlib/' [-Wmissing-include-dirs] f951.exe: Warning: Nonexistent include directory 'build\gfortran_EDF3F128DBFCA123\stdlib/' [-Wmissing-include-dirs]

I think it's because of the / directory separator used (note the last warnings), since I get

c:\fortran\public_domain\github\stdlib>dir build\gfortran_EDF3F128DBFCA123\stdlib/ Invalid switch - "".

but when I change the last / to \ the command works:

c:\fortran\public_domain\github\stdlib>dir build\gfortran_EDF3F128DBFCA123\stdlib\ Volume in drive C has no label. Volume Serial Number is ECC7-1C96

Directory of c:\fortran\public_domain\github\stdlib\build\gfortran_EDF3F128DBFCA123\stdlib

03/04/2022 10:07 AM

. 03/04/2022 10:06 AM .. 03/04/2022 10:07 AM 54,195 build_dependencies_test-drive_src_testdrive.F90.o 03/04/2022 10:07 AM 23 build_dependencies_test-drive_src_testdrive.F90.o.digest 03/04/2022 10:07 AM 1,104 build_dependencies_test-drive_src_testdrive_version.f90.o 03/04/2022 10:07 AM 23 build_dependencies_test-drive_src_testdrive_version.f90.o.digest 03/04/2022 10:06 AM 3,355 src_stdlib_array.f90.o 03/04/2022 10:06 AM 23 src_stdlib_array.f90.o.digest 03/04/2022 10:06 AM 434 src_stdlib_kinds.f90.o 03/04/2022 10:06 AM 23 src_stdlib_kinds.f90.o.digest 03/04/2022 10:07 AM 964 src_stdlib_system.F90.o 03/04/2022 10:07 AM 23 src_stdlib_system.F90.o.digest 03/04/2022 10:07 AM 916 src_stdlib_version.f90.o 03/04/2022 10:07 AM 23 src_stdlib_version.f90.o.digest 03/04/2022 10:06 AM 730 stdlib_array.mod 03/04/2022 10:06 AM 450 stdlib_kinds.mod 03/04/2022 10:07 AM 270 stdlib_system.mod 03/04/2022 10:07 AM 458 stdlib_version.mod 03/04/2022 10:07 AM 4,028 testdrive.mod 03/04/2022 10:07 AM 527 testdrive_version.mod 18 File(s) 67,569 bytes 2 Dir(s) 2,149,904,384 bytes free

— Reply to this email directly, view it on GitHub <fortran-lang/fpm#674>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN6YR5KEAWM2BK7DWXNXCLU6ISZBANCNFSM5P52GS7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

awvwgk commented 2 years ago

I wonder how the forward slash enters, checking the printed command-line there is no forward slash present

 + gfortran ... -J build\gfortran_EDF3F128DBFCA123\stdlib -I build\gfortran_EDF3F128DBFCA123\stdlib ...
f951.exe: Warning: Nonexistent include directory 'build\gfortran_EDF3F128DBFCA123\stdlib/' [-Wmissing-include-dirs]

Also, it seems like f951 rather than gfortran is reporting the error here, could f951 see something different than what we invoked gfortran with? If so this would be a bug in your GFortran distribution, rather than fpm.

awvwgk commented 2 years ago

Could you check whether this is a general problem or just specific to stdlib?

Beliavsky commented 2 years ago

Short answer -- the command in the initial post work fine with the gfortran binary from https://github.com/LKedward/quickstart-fortran

I usually use GNU Fortran (GCC) 12.0.1 20220213 from equation.com on Windows.

My c:\fortran\test directory has a file twice.f90 subdirectory gf, and on Windows I get

c:\fortran\test>gfortran -c -J gf twice.f90
f951.exe: Warning: Nonexistent include directory 'gf/' [-Wmissing-include-dirs]

although this works fine with quickstart-fortran. On WSL2 in the corresponding directory /mnt/c/fortran/test the same command works.

So the problem seems to be with the equation.com build of gfortran. I may contact them.

awvwgk commented 2 years ago

@Beliavsky there is a great distribution of GCC/MinGW by Brecht Sanders at https://winlibs.com/, it also comes with snapshot versions of the latest GCC development builds and I think Laurence @LKedward uses it for the quickstart-fortran installer as well.