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

compile_args in _build.cfg does not seem to work #5

Closed
ericbmerritt opened this issue Apr 2, 2010 · 2 comments
Closed

compile_args in _build.cfg does not seem to work #5

ericbmerritt opened this issue Apr 2, 2010 · 2 comments

Comments

@ericbmerritt
Copy link
Contributor

What steps will reproduce the problem?

  1. Add compile_args to _build.cfg as shown below (or any similar macro).
  2. The option does not make it to the compiler command. It is not in the
    beam file either.

task : {
build : {
compile_args : "+debug_info -DDEBUG_LOGGING"
}
}

In fact I added code to sinan (patch forthcoming) to show the compiler args
and the above seems to be ignored.

=INFO REPORT==== 17-Sep-2008::20:49:03 ===
[RUN:"1771b9f2-804f-48ea-aa7a-982435b2288e"] build:compile_options
generated event:Compile Options: [{warn_format,1},
debug_info,

{outdir,"/home/efine/work/blah/otp/_build/development/apps/yaws-1.77/ebin"},
strict_record_tests,return_errors,return_warnings,
{i,"/home/efine/work/blah/otp/lib/yaws/include"},
{i,"/home/efine/.sinan/repo/stdlib-1.15.3/include"},
{i,"/home/efine/.sinan/repo/kernel-2.12.3/include"},
{i,"/home/efine/.sinan/repo/eunit-2.0/include"}]

@ericbmerritt
Copy link
Contributor Author

I have found the reason for this. It's complicated.

The bottom line is that Sinan is using the flavors.development.build.compile_args
that are defined in Sinan's priv/default_build file, and ignoring the one in the
user's _build.cfg.

sinan:do_task/4 calls sin_build_config:start_config/4. In the init([BuildId,
ProjectDir, Config, Override]), the key "tasks.build.compile_args" is merged from
"flavors.development.build.compile_args", but never overridden by the user's
task.build.compile_args.

Here's an extract from the config dict (converted to_list).

[{"task.build.compile_args","-DFOOBAR +debug_info"},
{"flavors.release.build.compile_args","-DNOTEST=1 -W1"},
{"flavors.development.build.compile_args","+debug_info -W1"},
{"default_flavor","development"}
]

The compile_args I want is the one in task.build.compile_args. But the
flavors.development.build.compile_args is the one that is used. It looks as if the
merging of the dictionaries is not quite right.

A workaround is to edit the priv/default_build file and out in the args you like
(which will apply to all projects, so it's not necessarily a good workaround).

I don't have a patch to correct this at this time. I'm hoping you will know exactly
how to fix this in 10 seconds :)

Also, there is a bug in sin_build_arg_parser.erl. In an attempt to remove spaces,
certain "whitespace" characters are defined, such as $\r, $\n, $\s, $\t and so on.
Unfortunately, in a number of places, one of the characters used to define "space" is
$\l. This is the lowercase "L" character. I think what was meant was $\f for formfeed
or maybe $\v for vertical tab.

The effect of this is that any compile_args identifiers that are parsed will lose all
lowercase "l" characters, so that "feel_the_love" will become "fee_the_ove". This is
easy to reproduce and verify.

Delete comment Comment 2 by emofine, Oct 18, 2008
I sent a patch that fixes this problem, as well as the bug in
sin_build_arg_parser.erl. The patch is based on the head branch, so it might not work
that well with your dev branch.

It must be noted that the _build.cfg file needs to include a section named "tasks"
(NOT "task"). Now I don't know if this was always the intention (to use "tasks"
instead of "task") so please take a look and see if I did this the right way.

Example _build.cfg tasks section:

tasks : {
build : {
compile_args : "+debug_info -Dwhatever"
}
}

I also put back the display of the compile flags, which seemed to have disappeared in
the meanwhile from the head.
Delete comment Comment 3 by emofine, Jan 06, 2009
This bug is still present as of version 0.12.0.6 of sinan. I am therefore unable to
use needed include directories outside of the actual Sinan application. This is a
showstopper that forces me to copy the include files into the application's include
directory to get it to compile.
Delete comment Comment 4 by emofine, Jan 06, 2009
Ok, I found that somehow, when sinan was upgraded from 0.11.0.1 to 0.12.0.6, the
bin/sinan and bin/sinserv scripts were not changed and still referred to the old
0.11.0.1 release. The problem is in fact solved in 0.12.0.6.
There is another issue to do with default_build config compile_args having arguments
in common with build.cfg, but it can be worked around (don't have common args) and
probably won't affect most people.

@ericbmerritt
Copy link
Contributor Author

This is resolved in the current sinan

This issue was closed.
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

1 participant