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

Functions/routines outside module are ignored in the makefile => missing reference error #64

Closed
perrette opened this issue Jun 14, 2015 · 3 comments

Comments

@perrette
Copy link

Functions outside modules are handled just fine by normal FoBiS.py, but not in the generated Makefile.

Minimal example:

  • mymod.f90
program main
  call print_outside_module()
end program
  • outside.f90
subroutine print_outside_module
    print*, 'outside module'
end subroutine

Compiling the code works just fine:

FoBiS.py build -compiler gnu
./myprog

  outside module

But not in the makefile...

FoBiS.py build -compiler gnu -m Makefile
make clean
make 
Compiling myprog.f90
Assembling MYPROG
obj/myprog.o: In function `MAIN__':
myprog.f90:(.text+0xa): undefined reference to `print_outside_module_'
collect2: error: ld returned 1 exit status
make: *** [MYPROG] Error 1

I admit this is not a very clean coding style (maybe the compiler should have thrown an error in the first place...) but when working with legacy code there is not always a choice...

@szaghi
Copy link
Owner

szaghi commented Jun 15, 2015

Hi @perrette

This is not a problem of coding style, the problem is that the makefile generation of FoBiS.py is probably bugged.

As I said in your issue#63, I will try to improve/fix makefile generation asap, but not very quickly (maybe the next week).

See you soon.

@perrette
Copy link
Author

If "not in your priorities" means next week, that is not too bad :-)

@szaghi
Copy link
Owner

szaghi commented Jun 16, 2015

@perrette

I should have fixed this. Now, if you have non-module-libraries into your project, the make rules for compiling them are added as dependency for the linking rule of the target(s), thus the generated makefile works exactly as FoBiS.py.

Disclaimer

FoBiS.py, having implemented your feature for relax your building man... if something goes wrong keep going further..., can handle non-module-library in testing-dirty state, but the generated makefile not: if a compiling rule of a non-module-library fails, the linking rule of the target fails also. FoBiS.py 1 / Make 0 :-)

@szaghi szaghi closed this as completed Jun 16, 2015
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