diff mbox

[gomp4,committed] Fix "Can't rename module file openacc_internal.mod0" error

Message ID 546628D4.8060901@mentor.com
State New
Headers show

Commit Message

Tom de Vries Nov. 14, 2014, 4:07 p.m. UTC
Thomas,

while bootstrapping the gomp-4_0-branch, I ran into this error:
...
libtool: compile: build/./gcc/gfortran -Bbuild/./gcc/ 
-Binstall/x86_64-unknown-linux-gnu/bin/ -Binstall/x86_64-unknown-linux-gnu/lib/ 
-isystem install/x86_64-unknown-linux-gnu/include -isystem 
install/x86_64-unknown-linux-gnu/sys-include -m32 -L. -Wall -L../libgfortran 
-m32 -c src/libgomp/openacc.f90 -fPIC -o .libs/openacc.o
build/./gcc/gfortran -Bbuild/./gcc/ -Binstall/x86_64-unknown-linux-gnu/bin/ 
-Binstall/x86_64-unknown-linux-gnu/lib/ -isystem 
install/x86_64-unknown-linux-gnu/include -isystem 
install/x86_64-unknown-linux-gnu/sys-include  -m32 -L. -Wall -L../libgfortran 
-m32 -fsyntax-only src/libgomp/openacc.f90
Fatal Error: Can't rename module file 'openacc_internal.mod0' to 
'openacc_internal.mod': No such file or directory
make[9]: *** [openacc.mod] Error 1
make[9]: *** Waiting for unfinished jobs....
src/libgomp/openacc.f90:621.6:

   use openacc_internal, only: acc_get_num_devices_l
       1
Fatal Error: Can't open module file 'openacc_internal.mod' for reading at (1): 
No such file or directory
make[9]: *** [openacc.lo] Error 1
...

AFAIU, we compile fopenacc.f90 twice in the same working directory, once using 
this rule to obtain openacc.mod:
...
%.mod: %.f90
         $(FC) $(FCFLAGS) -fsyntax-only $<
...
And once more to obtain openacc.lo.

AFAIU, given the absence of -J, both will use temporary file fopenacc.mod0, 
which explains the error.

If we first build fopenacc.mod, we'll produce openacc.mod file, which is then 
overwritten by building fopenacc.lo. If we first build fopenacc.lo, we already 
have fopenacc.mod, and we'll not build another openacc.mod. So in both cases, we 
use the fopenacc.mod produced by building openacc.lo.

It's only when we try to build both simultaneously that we can run into his error.

And, we don't need to build both, since building fopenacc.lo already produces 
fopenacc.mod.

This patch tells make that building fopenacc.lo produces fopenacc.mod, and that 
fixes the error.

Committed as obvious.

Thanks,
- Tom
diff mbox

Patch

2014-11-14  Tom de Vries  <tom@codesourcery.com>

	* Makefile.am: Add missing dependency "openacc.mod: openacc.lo".
	* Makefile.in: Regenerate.
---
 libgomp/ChangeLog.gomp | 5 +++++
 libgomp/Makefile.am    | 2 ++
 libgomp/Makefile.in    | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp
index abceb62..b2c2526 100644
--- a/libgomp/ChangeLog.gomp
+++ b/libgomp/ChangeLog.gomp
@@ -1,5 +1,10 @@ 
 2014-11-14  Tom de Vries  <tom@codesourcery.com>
 
+	* Makefile.am: Add missing dependency "openacc.mod: openacc.lo".
+	* Makefile.in: Regenerate.
+
+2014-11-14  Tom de Vries  <tom@codesourcery.com>
+
 	* configure.tgt: Handle case that $enable_linux_futex is empty.
 
 2014-11-14  Thomas Schwinge  <thomas@codesourcery.com>
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index f265c5d..e5411ff 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -85,6 +85,8 @@  omp_lib_kinds.mod: omp_lib.mod
 	:
 openacc_kinds.mod: openacc.mod
 	:
+openacc.mod: openacc.lo
+	:
 %.mod: %.f90
 	$(FC) $(FCFLAGS) -fsyntax-only $<
 fortran.lo: libgomp_f.h
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index ea3e1ca..9a46373 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -1122,6 +1122,8 @@  omp_lib_kinds.mod: omp_lib.mod
 	:
 openacc_kinds.mod: openacc.mod
 	:
+openacc.mod: openacc.lo
+	:
 %.mod: %.f90
 	$(FC) $(FCFLAGS) -fsyntax-only $<
 fortran.lo: libgomp_f.h
-- 
1.9.1