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

problem using -cflags … and -mklib #59

Closed
zbeekman opened this issue Jun 11, 2015 · 4 comments
Closed

problem using -cflags … and -mklib #59

zbeekman opened this issue Jun 11, 2015 · 4 comments

Comments

@zbeekman
Copy link
Contributor

It seems that using cflags '...' together with -mklib causes the -c flag that -mklib inserts to evaporate.

For example:

FoBiS.py build -ch -cflags '-O0' -mklib static -s src -o libjsonfortran.a -t src/json_module.F90 -colors
The present cflags are different from the heritages one: forcing to (re-)compile all
Builder options
  Directories
    Building directory: "."
    Compiled-objects .o   directory: "obj"
    Compiled-objects .mod directory: "mod"
  Compiler options
    Vendor: "intel"
    Compiler command: "ifort"
    Module directory switch: "-module"
    Compiling flags: "-O0"
    Linking flags: ""
    Preprocessing flags: ""
    Coverage: False
    Profile: False
  PreForM.py used: False
  PreForM.py output directory: None
  PreForM.py extensions processed: []

Building src/json_module.F90
Compiling src/json_module.F90 serially
Undefined symbols for architecture x86_64:
  "_MAIN__", referenced from:
      _main in for_main.o
ld: symbol(s) not found for architecture x86_64

A work around is to manually add the -c to the -cflags but this should be done automatically whenever -mklib is used, even when adding custom flags.

Also, one still needs to put a space in the front of the flags string passed to the -cflags switch, otherwise a usage message appears.

@szaghi
Copy link
Owner

szaghi commented Jun 11, 2015

Interesting the mklib issue. Tomorrow I wil try fix.

As the space necessary into the arguments this is a bug of python moduld argparse that I am using... maybe I will switch off argparse and try to use other cli module, but not tomorrow :-)

Thank you again

@szaghi
Copy link
Owner

szaghi commented Jun 15, 2015

Dear @zbeekman,

I just look with more attention to this issue. I am a bit confused.

In my original intention -mklib should not add -c: it is indented to check some other building stuffs specific of library creation, e.g. running ar. The -c flag is the default setting of all supported compilers expect the custom one where must set all. Into your invocation you explicitly pass a value for cflags, i.e. -cflags ' -O0' that override the default one, purging out the default -c. This should be happen also for building a program.

Now I have some possibilities:

  1. leave this behavior as it is now, maybe improving the documentation pointing out that specifying a user cflags override the default value purging out the -c if not directly inserted into the user value;
  2. let the user to add his/her own value to the default one (that I guess it is the behavior you was expecting), thus in an invocation like your the resulting cflags value is cflags = -c -O0 where -c is the default value and -O0 is the addition of the users;
  3. explicitly check/parse the final cflags for the presence of -c; this should result the final value of the approach 2. until the default value is always -c.

Let me know what you prefer.

See you soon.

@zbeekman
Copy link
Contributor Author

Ah I see. It sounds like this is not a bug at all, and that I just
misunderstood what cflags does. I'm happy with option 1, leave this as is.
On Mon, Jun 15, 2015 at 4:51 AM Stefano Zaghi notifications@github.com
wrote:

Dear @zbeekman https://github.com/zbeekman,

I just look with more attention to this issue. I am a bit confused.

In my original intention -mklib should not add -c: it is indented to
check some other building stuffs specific of library creation, e.g. running
ar. The -c flag is the default setting of all supported compilers expect
the custom one where must set all. Into your invocation you explicitly pass
a value for cflags, i.e. -cflags ' -O0' that override the default one,
purging out the default -c. This should be happen also for building a
program.

Now I have some possibilities:

leave this behavior as it is now, maybe improving the documentation
pointing out that specifying a user cflags override the default value
purging out the -c if not directly inserted into the user value;
2.

let the user to add his/her own value to the default one (that I guess
it is the behavior you was expecting), thus in an invocation like your the
resulting cflags value is cflags = -c -O0 where -c is the default
value and -O0 is the addition of the users;

3- explicitly check/parse the final cflags for the presence of -c; this
should result the final value of the approach 2. until the default value is
always -c.

Let me know what you prefer.

See you soon.


Reply to this email directly or view it on GitHub
#59 (comment).

@szaghi
Copy link
Owner

szaghi commented Jun 15, 2015

OK, for the moment I close the issue, but I you feel this behavior is not adequate/best for your usage, please let me know.

See you soon.

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