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

Building libraries with multiple source files #27

Closed
jacobwilliams opened this issue Feb 10, 2015 · 2 comments
Closed

Building libraries with multiple source files #27

jacobwilliams opened this issue Feb 10, 2015 · 2 comments

Comments

@jacobwilliams
Copy link

Hey Stefano,

I think there is a bug when building a library that consists of more than one source file. If the library is only one file, then it works, but if there are multiple files then it doesn't. It seems like the object code for anything other than the main file is not getting archived in the library.

Example (for my fortran-astrodynamics-toolkit project):

FoBiS.py build -compiler gnu -colors -cflags "-c -O2" -dbld ./lib/ -s ./src/ -dmod ./ -dobj ./ -t fortran_astrodynamics_toolkit.f90 -o libfat.a -mklib static

All the modules are compiled, but the resulting .a file doesn't contain any of the code from any module other than the main one. What should happen is that all the .o files that were compiled should be added to the library (using something like ar -rcs libfat.a ./lib/*.o).

@szaghi
Copy link
Owner

szaghi commented Feb 10, 2015

Oh no! I have just realized that you are right. It was a known bug that I completely forget to fix! I will try to fix later in the morning. Thank you.

@szaghi
Copy link
Owner

szaghi commented Feb 10, 2015

It should be now fixed, but

  • there is no simple way to determinate the actual compiled objects that a library should contains, thus FoBiS.py simply puts into the library all the compiled objects built as a dependency or as non-module procedures files; obviously, eventual programs compiled are purged out and not included into the library; consequently it is a best practice to clean the project before building a library;
  • the argparse python module has a kwnon bug for quoted string arguments, see this; it is best practice when passing quoted string to FoBiS.py to start the string with a white space, e.g. FoBiS.py -cflags " -c -O2 -fPIC" -lflags " -shared"...

I have tried with your repo: I have cloned it and built with both static and shared formats and it seems to work correctly. Please, let me know if you find any bugs.

See you soon.

P.S. the bug fix is only into the GitHub repo: you have to clone it from github. I will push the new version on PyPi later, when your idea of recompiling on cflags changes will be ready...

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