Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
16 Views

Error while trying to use an alternate preprocessor

Jump to solution

Hello,

I have tried unsuccessfully to use an alternate preprocessor (which I wrote myself) with Intel Visual Fortran. With the version 16.0.2.280 or the 2017 beta version it fails with the same error.

Basically I activated the preprocessor in the project settings (option /fpp) and I use /Qlocation,fpp to define my preprocessor:

/watch:all /Qlocation,fpp,"C:\Work\Studies\20. FPP\FortranPP\FortranPP\bin\Debug\zfpp.exe"  /fpp

However my preprocessor fails because it has as only argument the path of a file in the temp folder which does not exist. Using the option /watch:all to get a dump of the build process, I get the following:

1>------ Build started: Project: TestTemplate, Configuration: Debug Win32 ------
1>Compiling with Intel(R) Visual Fortran Compiler 17.0.0.072 [IA-32]...
1>A.f90
1>echo A.f90
1>C:\Work\Studies\20. FPP\FortranPP\FortranPP\bin\Debug\zfpp.exe  \
1>    -D__INTEL_COMPILER=1700 \
1>    -D__INTEL_COMPILER_UPDATE=0 \
1>    -D_WIN32 \
1>    -D_M_IX86=700 \
1>    -D_MSC_VER=1900 \
1>    -D_MSC_FULL_VER=190024210 \
1>    -D_MSC_EXTENSIONS \
1>    -D_DEBUG \
1>    -D_MT \
1>    -D__INTEL_COMPILER_BUILD_DATE=20160517 \
1>    -D__MSVC_RUNTIME_CHECKS \
1>    -D__INTEL_OFFLOAD \
1>    -D__SSE2__ \
1>    -D__SSE2_MATH__ \
1>    -D__SSE__ \
1>    -D__SSE_MATH__ \
1>    -D__MMX__ \
1>    -DDEBUG \
1>    -I. \
1>    "-IC:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.072\windows\compiler\include" \
1>    "-IC:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.072\windows\compiler\include\ia32" \
1>    "-IC:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.072\windows\mkl\include" \
1>    "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include" \
1>    -IC:\PROGRA~2\INTELS~1\COMPIL~1.072\windows\compiler\include\ia32 \
1>    -IC:\PROGRA~2\INTELS~1\COMPIL~1.072\windows\compiler\include \
1>    "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" \
1>    "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" \
1>    "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" \
1>    "-IC:\Program Files (x86)\Windows Kits\8.1\include" \
1>    -free \
1>    -4Ycpp \
1>    -4Ncvf \
1>    -f_com=yes \
1>    -MX \
1>    "C:\Work\Studies\20. FPP\TestTemplate\TestTemplate\A.f90" \
1>    C:\Users\chhemar2\AppData\Local\Temp\3741213.i90
1>A.f90
1>Starting zfpp:
1>  args[0]: C:\Work\Studies\20. FPP\FortranPP\FortranPP\bin\Debug\zfpp.exe
1>  args[1]: @C:\Users\chhemar2\AppData\Local\Temp\374122arg2
1>  Error: File "@C:\Users\chhemar2\AppData\Local\Temp\374122arg2" not existing!

At first the command which is printed seems to be correct, but when my preprocessor starts, it prints the list of actual arguments which is much shorter and exits with an error. 

Am I doing something wrong in calling an alternate preprocessor? Note that I also tried various combinations with the option /fpp-name, always without success (anyway the difference between /fpp-name and /qlocation,fpp is not clear to me) I also tried to directly replace the fpp.exe in Intel folder by my tool, to the same results. What works is specifying as alternate preprocessor the original Intel one! This tells me that maybe there is some trick in how to write the interface of the alternate preprocessor. My understanding was that it receives as arguments options and the name of the file to preprocess, and print the preprocessed file on standard output. Can the problem bethat my preprocessor is written in C#? (and if yes, why?) Using a batch file instead of a C# program does not work either...

I would be grateful for any help!

0 Kudos

Accepted Solutions
Highlighted
16 Views

The first argument to the preprocessor is the path to a file with the rest of the command arguments, which is what the leading @ indicates. My experiments (and looking at the fpp source) tell me that fpp opens this file itself and reads the arguments, building up its own command line. So in your case, C:\Users\chhemar2\AppData\Local\Temp\374122arg2 contains all of those command arguments which your program will then have to read and parse. Keep in mind that there will be trailing backslashes for continuation and newlines in the file.

I note that the documentation suggests that the options are passed directly, which does not seem to be the case. I will ask that this be corrected.

/Qlocation,fpp is used to give the path to the folder containing the preprocessor. On Windows you can also give the executable name here, but on Linux and OS X you can't. /fpp-name just lets you change the name of the preprocessor from "fpp" and the other rules apply for how the command driver finds it. 

View solution in original post

0 Kudos
2 Replies
Highlighted
17 Views

The first argument to the preprocessor is the path to a file with the rest of the command arguments, which is what the leading @ indicates. My experiments (and looking at the fpp source) tell me that fpp opens this file itself and reads the arguments, building up its own command line. So in your case, C:\Users\chhemar2\AppData\Local\Temp\374122arg2 contains all of those command arguments which your program will then have to read and parse. Keep in mind that there will be trailing backslashes for continuation and newlines in the file.

I note that the documentation suggests that the options are passed directly, which does not seem to be the case. I will ask that this be corrected.

/Qlocation,fpp is used to give the path to the folder containing the preprocessor. On Windows you can also give the executable name here, but on Linux and OS X you can't. /fpp-name just lets you change the name of the preprocessor from "fpp" and the other rules apply for how the command driver finds it. 

View solution in original post

0 Kudos
Highlighted
Beginner
16 Views

Thanks a lot Steve!

Now it works.I was trying to open directly the file with the prefix @, which did not work. I was thinking it was part of the path because .NET uses it to escape all backslashes in a string. Removing this character, I can open the file and read the arguments for the preprocessor.

If you correct the documentation regarding the options, I would suggest that you also add a few lines explaining the meaning of this special temporary file. It could save others some headaches in the future...

Best regards

Hervé

0 Kudos