Author Topic: CB suddenly will not compile any f90 module  (Read 6313 times)

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
CB suddenly will not compile any f90 module
« on: April 02, 2015, 07:53:12 pm »
First, I have read the 'read this first', Mr. Mcfly. thank you for the information.

However, what I have is not a coding error, as NONE of my  (correctly compiled for years, not changed) modules will compile; they did until this week. BUT there has always, always been a warning message, whether compiling or linking, about 'cannot open file (or folder) for output...' usually something like, '..[progname].os_output_dir..' on the end. I have never consciously specified anything of the sort. I think there is something about CB settings that I do not understand here.

I have a CB v 13.12 with gfortran installation from a well-known vendor, been using it for about a month. The warnings were there from a pristine installation.
Until this week (4/1) it was a warning only. Now, it has become a full 'fatal error', and the (very simple) source code does not compile.
These modules compile (and link, and work in executables) when I use them with gfortran in Linux; they also do the same in my Windows 7 64 bit command line. But not in CB IDE, when I select 'compile current file' (ONLY file in the IDE).

To answer some obvious questions: 1) I run these as an administrator, there should be no 'permissions' errors; 2) I have tried it again while disabling antivirus (Kaspersky) completely, rebooting, checking to ensure K is disabled: same error. 3) the 'build logs' always contain, as a first step, " -J(and the strange output path/file I have not consciously requested)". I believe this is a build target of some kind. 4) There are no projects running. 5) I have removed the CB/gfortran installation and rebooted, checked for its absence on the path, etc, and reinstalled: compiling again fails with same error. 6) I have searched the CB 'settings' without any luck looking for anything relevant to 'build target (while compiling)'. 7) All the 'build target' options in the IDE are greyed-out since I am not working with a project. Finally, I have no other compilers on my system, other than python and pythonxy. Surely that is not a problem?

Here is an abbreviated first few lines from a 'build log':

"gfortran.exe -JD:\Work\F90\mods\source\jrtypes.os_output_dir   -IC:\FortranTools\lib -c D:\Work\F90\mods\source\jrtypes.f90 -o D:\Work\F90\mods\source\jrtypes.o
gfortran.exe  -o D:\Work\F90\mods\source\jrtypes.exe D:\Work\F90\mods\source\jrtypes.o   C:\FortranTools\lib\libfortrantools.a ..."...followed by other info, finally ending in a red 'error' and 'build failed.'

You can see the " -J(path is D drive to a working directory, but with a filename I do not recognize)"

I hope someone can suggest something, I am not getting any where with this problem.

Many thanks in advance,

franko

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CB suddenly will not compile any f90 module
« Reply #1 on: April 02, 2015, 08:01:59 pm »
Wow. I am here about 5 minutes later to admit I forgot about 'another' compiler I have - Atmel C.

BUT this EXACT problem is happening on my laptop with an EXACT same installation, same win7 64, with NO Atmel, NO python, etc.
SAME errors, same messages.

I don't think these are the problem since they are not present on the other machine which throws the exact same error.

franko

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CB suddenly will not compile any f90 module
« Reply #2 on: April 03, 2015, 03:14:51 pm »
Just for info, I have removed all of those other possible 'compilers:' - the Atmel (Norwegian makers of small 8-bit processors), and all python.
I have removed CB fortran and everything I can find about it on my machine; rebooted, reinstalled CB/gfortran, problem remains unchanged.

I notice quite a few other instances of this problem online with CB : appearance of an unknown target, "...os_output_dir", but no solutions.
Perhaps it is time to register a valid bug.

franko

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6984
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CB suddenly will not compile any f90 module
« Reply #4 on: April 03, 2015, 05:51:39 pm »
@stahta01
I think my first post contains everything in the 'template' you linked to,
except the build log which I will post.
As far as the steps to analyze the problem, I've pretty much done all that
a non-expert could do.
franko
« Last Edit: April 03, 2015, 05:59:35 pm by franko »

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CB suddenly will not compile any f90 module
« Reply #5 on: April 03, 2015, 06:28:10 pm »
OK the template is below. First, I've posted all the steps I've taken,
mostly in the first post. They are quite thorough, I think.
Secondly, the problem is 'compiling current file', not 'building a project'.
In fact, I cannot compile a .f90 module that has stood the test of time
(I have used 'nrtype.f90' since about 1996 in various Fortran90 compilers).
Third, via the command line, the module compiles and produces both .mod and
 .o files. Fourth, the module contains no 'use' statements to other modules,
or include files, or any other references.

Here is the template, filled in:

I am running Code::Blocks version 13.12 on Windows 7 64-bit.

The compiler I use is gfortran. I cannot find the gfortran version,
but it appears to have been built with gcc 4.9.2 in 11/2014. The
included 'build-info.txt' is several pages of MingGw...so forth, does
not mention gfortran itself specifically.

When I load the file 'nrtype.f90' into CB, no project open, and select
'Build / compile current file', I get a warning and a related fatal error
about nonexistent '..os_output.dir', which seems to be connected to the
'-J' switch (see build log below). NO output '.o' or '.mod' files are
produced.

I have the source file in directory 'D:\Work', and opened it there with
CB/gfortran. That is where the CB tried to create some default output.

Note that this happens with ANY of my other modules as well,
including valid commercial modules that have been around awhile.

Steps to reproduce problem: As above.

Description of problem.
As described above.

Build log:
gfortran.exe -JD:\Work\nrtype.os_output_dir   -IC:\FortranTools\lib -c D:\Work\nrtype.f90 -o D:\Work\nrtype.o
gfortran.exe  -o D:\Work\nrtype.exe D:\Work\nrtype.o   C:\FortranTools\lib\libfortrantools.a
Warning: Nonexistent include directory "D:\Work\nrtype.os_output_dir"
D:\Work\nrtype.f90:30.17:
END MODULE nrtype
                 1
Fatal Error: Can't open module file 'D:\Work\nrtype.os_output_dir/nrtype.mod0'
for writing at (1): No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))
 
Crash report:  Code::Blocks does not crash on this error.

I have already tried ...the things listed in first post
... but none of them worked.

Additionally, it appears that
the '-J' switch is set in the compiler settings / other settings / Advanced Options..
dialog, which comes with a big warning about not doing anything if you
'do not know exactly what you are doing". I do not.

My CB has, in this dialog, as a command line macro,
 "$compiler -J$objects_output_dir $options $includes -c $file -o $object,
in the space under the drop-down 'command', which has selected,
'compile single file to object file'.
Since I have no idea how to fix this, I'm really stuck. I notice that
similar problems with this 'os_output_dir' thing have occurred in
the past, at least once reported on this forum, with no solution listed.

Thanks for any help.
franko
« Last Edit: April 03, 2015, 06:32:59 pm by franko »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2814
Re: CB suddenly will not compile any f90 module
« Reply #6 on: April 03, 2015, 10:28:15 pm »
it seems that there is a mixing with the path separators (D:\Work\nrtype.os_output_dir/nrtype.mod0)
i have never used fortran, so i can't tell you if this is a problem, but i would look up, if you can fix this path to pure windows style...

the second thing is:
use projets... c::b is not meant to use it without projects

From the fortran documentation:
Quote
-Jdir
    This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to searched by an USE statement.

    The default is the current directory.
so this -J command is needed, and as you are using a windows 7 machine, i think you don't have the right to write on your c: drive.
Use a folder within your "Documents" for your project

greetings

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CB suddenly will not compile any f90 module
« Reply #7 on: April 04, 2015, 05:42:18 pm »
Thank you Blue Hazzard,

I'm not sure what you mean about the path, it is perfectly valid pure windows style, points to the directory "D:\Work", which is the folder 'Work' on the 'D' drive, and is where the source code is and was loaded from. It is certainly valid for CB to try to put the output there. It would be the default. BUT, 'os_output_dir' is nothing I ever entered, nor does it make any sense. It was added by CB alone, has nothing to do with fortran. That is why I am asking on the CB forum.

I do this on 'D' because my 'C' drive is a Solid State Drive, with limited size; it is almost full, but that is where the program files must be located by Windows 7. Part of my space problem is that is where 'windows' puts the 'documents' and other 'libraries' which really eat up space (I'm trying to move them all to D). But, I don't think that is related to the problem, because:

When I run this on my laptop I run with full admin authority, and everything is on the C: drive, I have write permission in the program files. Exactly the same problem occurs, even tho I have erased rebooted and reinstalled CB. There, of course, I am using the path "C:\Work" instead of "D:\Work".

As I said, I am not the only person to have this problem, there was a lady who posted here a year or two ago and got no answers for the same problem with 'os_output_dir'. I have seen this problem reported (no solutions) elsewhere online as well.

Finally, whether I include the compiling in a project or not, the same problem happens - no compiling of the module, with same fatal error. Besides, why does the IDE have the 'Build/Compile current file' command, if not to compile a specific file? In addition, it used to work without fatal errors, albeit with the warning of the same 'unknown' output directory I did not request, '...os_output_dir'. Also, I know of one other capable programmer whose installation of the same system works with 'compile current file' on the same source file, putting out the '*.o' file and '*.mod' files without reporting any error or warning.

As you may see, this strange problem has been a real headache. Of course, I can do the whole thing from command line with no problems . However, if I cannot use the IDE to compile files, it is really not much more that a fancy 'notepad' editor with color., is it?

I am not an accomplished system-level programmer, and have no interest in becoming one. However, I am wondering if CB has created some 'startup script' which has become altered - and perhaps stays on the machine even when CB is removed.

I hope I can find out where that bogus 'os_output_dir' came from. But I am beginning to believe it is a real 'bug' and needs to be reported as such, since I can find no place where solutions are posted.

Thanks again,

Franko

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: CB suddenly will not compile any f90 module
« Reply #8 on: April 04, 2015, 08:08:41 pm »
Code: [Select]
Build log:
gfortran.exe -JD:\Work\nrtype.os_output_dir   -IC:\FortranTools\lib -c D:\Work\nrtype.f90 -o D:\Work\nrtype.o
...
...
My CB has, in this dialog, as a command line macro,
"$compiler -J$objects_output_dir $options $includes -c $file -o $object"
...

It looks like the macro $objects_output_dir is invalid without a project.

Try to create an empty project, choose GNU Fortran as compiler, add the sourcefile, build it.

Offline franko

  • Multiple posting newcomer
  • *
  • Posts: 10
Solution - I was wrong (CB suddenly will not compile any f90 module)
« Reply #9 on: April 06, 2015, 02:54:59 pm »
Well, you all have zeroed in on what I could not seem to grasp; it appears a project is required to compile, even a single file.

When I did that, the compiles go off without an error. My mistake: I had *tried* to do that, I thought, but in my absent-mindedness I forgot to 'include' the single file in the project. No wonder it did not
compile. Well, Duh.  (<- American slang for 'my bad', or worse)

To me, it appears to be a bit counterintuitive; far easier (for a single file) to just use the command line. But for a larger project, possibly with newly-written source-code modules in place, it makes sense.

Sorry to have wasted bandwidth; thanks very much for the help.

franko