Home > OS >  Ant/Make Compilation Error with File Path Having Spaces
Ant/Make Compilation Error with File Path Having Spaces

Time:07-01

Unable to produce some MVC to reproduce the issue. So trying to be clear & concise.

  1. We utilize ant/make

  2. The include path to building the C portion utilizes a header (jni.h) from the java installed directory

Example Error (During Build Process)

3)

*File.h(2): fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
make: *** [File.obj] Error 2*

Another error also shown is:

cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include', object file assumed

cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include' ignored

cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include\win32', object file assumed

cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include\win32' ignored
  1. This is the include path as part of the compilation step (Yes this path exists) -IC:\Program Files\Java\jdk1.8.0_281\include

  2. Now when I copy the files necessary to a path that's called ProgramFiles\Java... (No spaces in ProgramFiles) it works fine.

  3. I have a variable retrieved from a .platform file which is utilized for the build, which defines JDK_HOME. I believe this file is utilized for ant/make builds and uses these defined variables in this file.

Any ideas/paths as to ant or make not liking spaces in the include paths, or anything along those lines? I've looked at many resources online, but very hard to describe the issue.

Problem clearly is the space in Program Files. Not sure what is so significant about this.

Hoping the bullet points help in any information needed with anyone who could be familiar with this issue or might have leads. Thank you.

CodePudding user response:

I'm not sure what ant has to do with this. But make recipes are just shell scripts (or, if you use Windows cmd.exe instead of a POSIX shell, batch files). Just like commands you'd write in a batch file or on the command line directly, you have to add quoting to paths that contain whitespace.

You don't actually show us either the make recipe or even the complete compile (cl) command line that make invokes so we can't give you precise advice, but basically if you cut and paste the command line make invoked into your terminal prompt you'd get exactly the same errors about whitespace. Make is not magic: it only runs the commands you tell it to run.

Just like you have to add quotes around paths containing whitespace when you run them from the terminal prompt, so too you need to add quotes to these paths when you run them from a makefile recipe.

  • Related