jacobwilliams / Fortran-Astrodynamics-Toolkit

A Modern Fortran Library for Astrodynamics 🚀
Other
175 stars 50 forks source link

Problem trying to build tests #2

Closed astrojuanlu closed 8 years ago

astrojuanlu commented 8 years ago

I built https://github.com/jacobwilliams/pyplot-fortran, put libpyplot.a, pyplot_module.mod and pyplot-fortran/lib/pyplot_module.o under lib and tried to run ./build.sh, but I am having what I think are linking errors at the end:

Building tests/dro/dro_test.f90
Nothing to compile, all objects are up-to-date
Linking bin/dro_test
bin/dro_test.o: In function `MAIN__':
dro_test.f90:(.text+0xebb): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0xf17): undefined reference to `__pyplot_module_MOD_initialize'
dro_test.f90:(.text+0xf23): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0xf6c): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0xf89): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1072): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0x108f): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x117b): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0x1198): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x123e): undefined reference to `__pyplot_module_MOD_add_contour'
dro_test.f90:(.text+0x124a): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1271): undefined reference to `__pyplot_module_MOD_savefig'
dro_test.f90:(.text+0x1280): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1291): undefined reference to `__pyplot_module_MOD_destroy'
dro_test.f90:(.text+0x138d): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x13e9): undefined reference to `__pyplot_module_MOD_initialize'
dro_test.f90:(.text+0x1a6e): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1aec): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0x1b10): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1bf0): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0x1c0d): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1ce8): undefined reference to `__pyplot_module_MOD_add_plot'
dro_test.f90:(.text+0x1cf4): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1d1b): undefined reference to `__pyplot_module_MOD_savefig'
dro_test.f90:(.text+0x1d2a): undefined reference to `__pyplot_module_MOD___vtab_pyplot_module_Pyplot'
dro_test.f90:(.text+0x1d3b): undefined reference to `__pyplot_module_MOD_destroy'
collect2: error: ld returned 1 exit status
jacobwilliams commented 8 years ago

The way I do it is to copy the pyplot_module.f90 file into the tests directory, and FoBiS will find it and compile it for you when you run build.sh. That should work. I don't have it set up to look for the .a file.

Note: I should set up a submodule to pyplot, but haven't gotten around to it yet.

astrojuanlu commented 8 years ago

You are right, this fixed it :) Perhaps this is worth including in the README?

szaghi commented 8 years ago

Dear @jacobwilliams and @Juanlu001

if you like, it is very trivial (I hope) to extend the current behavior of FoBiS allowing list of source directories rather than the single one that presently is allowed. This alleviate you to manual copy modules, e.g.

FoBiS.py build --src path_to_other_sources this_sources another_sources ...

Let me know if you like such a feature.

See you soon.

szaghi commented 8 years ago

@jacobwilliams and @Juanlu001

I like to let you know that you are not been required to manual copy pyplot, the src FoBiS option can now handle also list of directories, thus you can do something like:

git clone https://github.com/jacobwilliams/Fortran-Astrodynamics-Toolkit
git clone https://github.com/jacobwilliams/pyplot-fortran
cd Fortran-Astrodynamics-Toolkit
FoBiS.py build --src src tests ../pyplot-fortran/src ...

so that the pyplot module is reached without to explicitly copy it.

See you soon.

P.S. in this way, namely without specify a target, also the tests of pyplot-fortran are built. If you like you can tell to FoBiS to ignore pyplot-fortran/src/tests/ sources using the exclude directories option.