Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open module file ‘zofu.mod’ #1

Closed
vincentmr opened this issue Sep 26, 2019 · 2 comments
Closed

Can't open module file ‘zofu.mod’ #1

vincentmr opened this issue Sep 26, 2019 · 2 comments

Comments

@vincentmr
Copy link

I am trying to setup the "adder_tests" example. I created a module which defines the adder_type in ./src and the following meson.build file, which is a bit different than the one in the repo because of the zofu library location.

project('adder', ['fortran'])

# find zofu library: https://github.com/mesonbuild/meson/issues/3926
cmplr = meson.get_compiler('fortran')  
local_lib_dir = '/home/vince/.local/lib'
deps = []
foreach libname : ['zofu']
    deps += [cmplr.find_library(libname, dirs : local_lib_dir)]
endforeach

src_dir = join_paths(meson.current_source_dir(), 'src')
adder = shared_library('adder', join_paths(src_dir, 'adder_module.F90'))

test_dir = join_paths(meson.current_source_dir(), 'test')
test_name = 'adder_tests'
test = join_paths(meson.current_source_dir(),
                      'tests', test_name + '.F90')
driver_src_name = test_name + '_driver.F90'

test_driver_src = configure_file(
  output: driver_src_name,
  command: ['zofu-driver', test, driver_src_name])
test_exe = executable('adder_tests',
                      [test_driver_src, test],
                      link_with: adder,
                      dependencies: deps)
test('adder_tests', test_exe)

I then call

meson --wipe build && ninja -C build

The first command succeeds, but ninja fails as follows

Fatal Error: Can't open module file ‘zofu.mod’ for reading at (1): No such file or directory
compilation terminated.

I am wondering what is the correct way to solve this.

@acroucher
Copy link
Owner

It looks like the main thing you are doing differently is locating the Zofu library, using cmplr.find_library() instead of declaring Zofu as a dependency using zofu = dependency('zofu'). And the fact that it is complaining about not finding the Zofu module suggests that the way you're trying to do it isn't working.

I don't quite understand what is preventing you from using dependency(). Can pkg-config not find Zofu if you do it that way? If so is that just a matter of setting $PKG_CONFIG_PATH so it can find the Zofu pkg-config file?

@vincentmr
Copy link
Author

Setting PKG_CONFIG_PATH solved the problem indeed. I must have made a mistake in the path originally and then got carried away. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants