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

Cannot build with fpm on Windows: .\src\C-canvas.c:84:10: fatal error: sys/utsname.h: No such file or directory #2

Open
Beliavsky opened this issue Mar 21, 2021 · 3 comments

Comments

@Beliavsky
Copy link

On Windows, running fpm build gives this error:

c:\fortran\public_domain\github\general-purpose-fortran>fpm build

  • gfortran -c .\src\C-buffer.c -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fbounds-check -fcheck-array-temporaries -fbacktrace -fcoarray=single -J build\gfortran_debug\GPF -I build\gfortran_debug\GPF -o build\gfortran_debug\GPF\src_C-buffer.c.o
    cc1.exe: warning: command-line option '-Wimplicit-interface' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fcheck-array-temporaries' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fbacktrace' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fcoarray=single' is valid for Fortran but not for C
  • gfortran -c .\src\C-canvas.c -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fbounds-check -fcheck-array-temporaries -fbacktrace -fcoarray=single -J build\gfortran_debug\GPF -I build\gfortran_debug\GPF -o build\gfortran_debug\GPF\src_C-canvas.c.o
    cc1.exe: warning: command-line option '-Wimplicit-interface' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fcheck-array-temporaries' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fbacktrace' is valid for Fortran but not for C
    cc1.exe: warning: command-line option '-fcoarray=single' is valid for Fortran but not for C
    .\src\C-canvas.c:84:10: fatal error: sys/utsname.h: No such file or directory
    84 | #include <sys/utsname.h>
    | ^~~~~~~~~~~~~~~
    compilation terminated.
    Command failed
    ERROR STOP

Error termination. Backtrace:

Could not print backtrace: libbacktrace could not find executable to open
#0 0xffffffff
#1 0xffffffff
#2 0xffffffff
#3 0xffffffff
#4 0xffffffff
#5 0xffffffff
#6 0xffffffff
#7 0xffffffff
#8 0xffffffff
#9 0xffffffff
#10 0xffffffff
#11 0xffffffff

Thanks for this project.

@urbanjost
Copy link
Owner

the sys/utsname.h header file is not a standard part of Windows, and not always on POSIX platforms by default. You will probably have to run in Cygwin or add WSL (assuming you have a newer WIndows OS) and build there; or change the code to not require
calling uname(3c) or whatever is dependent on the file. Are you using MSWIndows straight, or Mingw, MSYS2, Cygwin, ...

@Beliavsky
Copy link
Author

I am using "MSWIndows straight".

@urbanjost
Copy link
Owner

MSWIndows has a non-POSIX proprietary OS; and uname(3c) is POSIX so you cannot call that routine from that environment without calling MSWIndows routines to emulate uname(3c), or using the WIndows Linux WLS interface, a virtual POSIX platform, Cygwin, ... or something that provides a POSIX environment. Can you use a POSIX environment instead? Otherwise, you have to change the code or create your own emulator of that routine (might be one on the WWW somewhere, but I did not see one taking a quick glance).

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