-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists
Description
Description
fpm test
generates a link-time error when a test-directory submodule exists in a file other than the file containing its parent module.
Expected Behaviour
I expected fpm test
to build and run the test(s).
Version of fpm
0.6.0
Platform and Architecture
macOS/Intel
Additional Information
To reproduce the error this issue, execute the following in a Linux or MacOS shell:
% fpm new foo
% cat > foo/test/check.f90
program check
use foo_m
implicit none
call say_something
end program
<Ctrl-D>
% cat > foo/test/foo_m.f90
module foo_m
implicit none
interface
module subroutine say_something
end subroutine
end interface
end module
<Ctrl-D>
% cat foo/test/foo_s.f90
submodule(foo_m) foo_s
implicit none
contains
module procedure say_something
print *,"something"
end procedure
end submodule
<Ctrl-D>
% cd foo
% fpm test
+ mkdir -p build/dependencies
foo_m.f90 done.
foo.f90 done.
libfoo.a done.
main.f90 done.
check.f90 done.
foo_s.f90 done.
foo done.
check failed.
[ 100%]Compiling...
Undefined symbols for architecture x86_64:
"___foo_m_MOD_say_something", referenced from:
_MAIN__ in test_check.f90.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
<ERROR> Compilation failed for object " check "
<ERROR>stopping due to failed compilation
STOP 1
When using gfortran
or the Intel ifort
, the following workaround enables successful execution of fpm test
:
echo 'include "foo_s.f90"' >> test/foo_m.f90
With the NAG nagfor
compiler, the above workaround fails so the submodule must be in the same file as the module.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists