Author Topic: Custom make commands are never executed  (Read 20096 times)

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Custom make commands are never executed
« on: March 07, 2012, 05:33:37 pm »
I created a new project with an existing external makefile. I selected "This is a custom Makefile". I created a new target "all" to check if the external Makefile is triggered. It is.

So far, so good. Now I edited the first entry in the target's "Make commands" section. Unfortunately, this setting seems to be ignored. Whatever I write there, even something like "echo 'test'", is ignored. Pre- and post-commands are run, though.

I am a CB newbie, so maybe I am doing something wrong (if so, nothing obvious). If so, tell me what, please. Otherwise I guess this might be a bug.

I am on Ubuntu 11.10 64-bit and using the CB package which is part of the distribution.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom make commands are never executed
« Reply #1 on: March 07, 2012, 07:56:52 pm »
If the makefile is called, then it is either a bug of make, or a miswritten makefile.

If you turn on full commandline logging for the compiler you have chosen for your project/target, you should see all the output of the make command.
See http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F for an instruction how to do it.

Be aware, that just the make command of the compiler is used, not the compiler itself.

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #2 on: March 11, 2012, 01:30:19 pm »
Maybe we have a misunderstanding here: I am using a custom makefile. It is called, but not the way I specify in the command line editor (see attached image). As you can see, I even changed the command completely for testing so as not to call make at all, but echo some text to the console, but my command line is not used - against my expectation. CB always calls "make <target>" no matter what I specify in custom commands.

Edit: OMG, I guess CB is quite buggy in the version (svn 7671) offered by Ubuntu 11.10:
  • When I switch on "Compiler logging" - "Full command line", suddenly my custom command sudo -A $make -f $makefile $target is called and executed successfully. Besides, I have also specified a global variable SUDO_ASKPASS (with value /usr/lib/openssh/gnome-ssh-askpass) via "Settings" - "Global variables" so as to enable my make command to run in sudo environment and ask me for a password via GUI. But as soon as I set my logging options back to "task description" instead of "full command line", my commandline is completely ignored again! This is definitely a bug, and a big one.
  • When I re-enter "Settings" - "Global variables" to check my previous variable settings, suddenly SUDO_ASKPASS is printed in lower-case letters as sudo_askpass. It is still used correctly by the custom command line, though. Another bug.
  • My custom "make install" ends successfully with 1 warning and 0 errors, but CB prints the opposite: 0 warnings, 1 error, which is definitely wrong. The same false information is shown in "Build log" window and in "Build messages"

Guys, I have just created my first project and run my first make, but already discovered three easy to spot bugs at once. I must say, I am shocked. Anyway, I would like to continue testing CB because it starts up faster and seems leaner on my old machine than Eclipse, but I do hope you have some solutions or bugfixes for me. Are these known bugs which are fixed in newer versions? If so, please try to trigger the maintainers of the Ubuntu/Debian packages and urge them to upgrade to a newer release. The way it is now, the software is absolutely useless, not even able to run an external makefile with a custom command without a trick (turning on full command line logging).
« Last Edit: March 11, 2012, 02:02:51 pm by kriegaex »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Custom make commands are never executed
« Reply #3 on: March 11, 2012, 03:00:06 pm »
This is your first post...

Guys, I have just created my first project and run my first make, but already discovered three easy to spot bugs at once. I must say, I am shocked.
[...]
but I do hope you have some solutions or bugfixes for me.
I have to say you have a strange attitude.

Sure - all bugs must be on our side and surely we will serve you at will. What else can we do for you? Do you like a beer, an ice-cream and a massage, too?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #4 on: March 11, 2012, 04:35:35 pm »
Look, I am a user and a CB newbie, but not stupid and a computer scientist and developer like many of you here, too. CB is neither my first IDE nor is this my first Linux build. I usually use the command line, so I know how to call and debug make. I also know how to do what I want with Eclipse.

What I want is just to be taken seriously, not a beer and definitely not a massage. Would you not agree that the three issues I have mentioned are bugs? I have posted twice now, but my first post has not been taken seriously and not read thoroughly. I told you what was wrong and I got an irrelevant reply. No problem, misunderstandings happen every day. So I tried to make myself understood by posting a reply with more details and even a screenshot to clarify things. And what do I get as a reply now? A polemic, sarcastic comment and again no relevant answer.

Hey, bugs are a normal thing, but would you not be shocked if at first contact with a new IDE with an everyday core task (building a program) you would not just bump into one, but into three errors at once? Many people would immediately give up and go back to what they know is working, never touching the software again, free or not. I am different and stated clearly that I want to keep testing, I just needed help and was even suggesting the bugs might be old and already fixed, blaming Ubuntu package maintainers for not upgrading their package.

Sure, to say that I am shocked is a personal statement, but one backed by facts (three reproduceable bugs, I can create a screen cam for you if you like). I insulted noone and said clearly what I want from you: hints, bugfixes, help. And you just insult me personally instead of offering help. Is this how you welcome new users?

Edit and P.S.: I am not just demanding something, I am not a leecher. I took the time to report three errors. So first I was giving away something: my time and devotion as a free tester for your project. I have led an OSS project long enough to know that this is important. Software development is for users, but also the developers cannot improve a lot without feedback. I just gave feedback, and this is what I get in return. Thank you so much.
« Last Edit: March 11, 2012, 04:41:38 pm by kriegaex »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom make commands are never executed
« Reply #5 on: March 11, 2012, 04:57:31 pm »
I have no such errors here.

Can you create a sample project, where this error occurs, pack and attach it here.
Please attach also C::B's conf-file (default.conf in ~/.codeblocks).

Calling gui elements from inside C::B (like askpass dialog) will mot likely not work, because the commands are executed through wxWidgets wxExecute, abd not through a shell.

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #6 on: March 11, 2012, 05:12:54 pm »
Sorry Jens, I do not want to seem lecturing, being a smart-ass or something, but please read my inquiry a bit more thoroughly, then you can by deduction (because I mentioned it) conclude that
  • CB "calls" the external sudo GUI tool just fine, but I need to activate full command line logging for it,
  • not CB calls the GUI tool, but sudo does (see man sudo, check out -A option),
  • even without calling the tool, just doing "echo test", custom commands are never called, so the GUI tool is not a relevant part of the problem.

Anyway, here are my CB configuration and my project file. It has two targets "all" and "install" by which it builds an external software package (mc-4.8.1, the well known Midnight Commander). I just wanted to test a bit to see how CB works and then use it as a GUI front-end for debugging mc later, just in case you are interested in my use case and motivation. You might notice that the project base directory is not equal to the source code directory, but this is not a problem because I could "add files recursively" from the directory easily.

Edit: In the project I uploaded, you first need to deactivate full command line logging in order to see the problem. As a workaround I have activated it because then at least my custom commands are executed.
« Last Edit: March 11, 2012, 05:35:13 pm by kriegaex »

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #7 on: March 11, 2012, 06:02:07 pm »
Sorry for replying several times in a row (and I will need yet another post after this one), but there is a limit to attachments. I am attaching more screenshots for the bugs described in post #3. I know I could upload an archive full of pics, but this is inconvenient for viewing.

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #8 on: March 11, 2012, 06:02:42 pm »
More screenshots

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom make commands are never executed
« Reply #9 on: March 11, 2012, 06:12:04 pm »
Please don't use local attachments.
Storage for the forum is limited and attachments get removed at random!

It seems that I can reproduce your bug.

Set the build command to 'xmessage -buttons "test" -center " tead" ' (build options->target->make commands->build project/target)
and then switching the log mode to something different than full log.

This is pretty strange, but calling it "quite buggy" is harsh, in fact this could be regarded as feature, because using anything that full log is asking for trouble. In fact I'll be ok/happy if we just remove the other two modes :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom make commands are never executed
« Reply #10 on: March 11, 2012, 06:14:44 pm »
Good to hear that calling sudo works, but what I wanted to say, is that it is not guaranteed to work in any cases.

The other thing (not using the correct make-command if not full commandline logging is set) is definitely a bug and will be fixed as soon as possible.

When a fix will make it into ubuntu's repo is their (the ubuntu maintainer's) decision.

Alternatively you can use my repo (see my sig), if the bug is fixed and I uploaded a new version.

The counting of warnings and errors works here in all cases.
A warning can be treated as error in some cases, because we use regexes to parse the output.

If you can copy the warning-message treated as error, it might be able to fix this.

If you use localized versions of gcc, it might break the regexes, in this case you have to fix it yourself, because we can not provide regexes for each and any probable localization. Or switch to engish, while compiling ( I have set LC_ALL to en_US.UTF-8 in my environment variables inside C::B).

[...]
I must say, I am shocked.
[...]
The way it is now, the software is absolutely useless, not even able to run an external makefile with a custom command without a trick (turning on full command line logging).
If you post such statements, you have to live with answers like the ones from MortenMacFly.

It's not very professional and to say C::B is absolutely useless is (sorry to say it that way) bullshit.
C::B has it's own very powerful build-system.
Using custom makefiles is not the normal usecase and it uses nearly nothing of the possibilities of C::B .

Nevertheless it should work without such bugs, but as you should know, there is not much software without bugs, so we are glad if a user finds and reports iussues.

And as the forum-rules clearly state:

Quote from: http://forums.codeblocks.org/index.php/topic,9996.0.html
6. Bug reports belong in the BerliOS project page. Don't expect the devs to crawl in the forums for a bug - we're NOT Google! The bug report webpage was made for a reason.

No need to do it in this case, I will fix it anyway.
But when you have registered here, you accpeted to follow these rules, so please calm down and be patient.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom make commands are never executed
« Reply #11 on: March 11, 2012, 06:18:03 pm »
Our posts have crossed.
Please use LC_ALL=en_US.UTF-8 (or something similar) in envvar-plugin.
German messages can not be paresed correctly.

That does not guarantee your message to be parsed correctly, if it is not a message from compiler/linker, but from the make-command.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom make commands are never executed
« Reply #12 on: March 11, 2012, 06:30:36 pm »
about the lower- and upper case-stuff:
environment-variables and user-defined fields in global variables are totally different. The later are not case-sensitive.

Offline kriegaex

  • Multiple posting newcomer
  • *
  • Posts: 13
    • Scrum-Master.de - Agile Project Management
Re: Custom make commands are never executed
« Reply #13 on: March 11, 2012, 09:00:19 pm »
Quote
Please don't use local attachments. Storage for the forum is limited and attachments get removed at random!

I am sorry, I was not aware of that fact. Maybe you better deactivate uploads if you prefer your users not to upload anything. (I mean it literally, ironic as it may sound - no misunderstandings again just because I use explicit instead of euphemistic language, please.) I have no intention of spamming your forum. As you can see I did not post full-sized screenshots but cut out the relevant parts and decreased the colour depth to 8 bit. The files are numerous, but really small.

Quote
It seems that I can reproduce your bug.

Cool, thank you. I will wait for the fix and then be happy to test it for you with my setup. :-)

Quote
Set the build command to 'xmessage -buttons "test" -center " tead" ' (build options->target->make commands->build project/target)
and then switching the log mode to something different than full log.

No change in behaviour: The command is only called for full log.

Quote
This is pretty strange, but calling it "quite buggy" is harsh, in fact this could be regarded as feature, because using anything that full log is asking for trouble. In fact I'll be ok/happy if we just remove the other two modes

I guess that is a matter of perspective. I wonder how anyone could regard it a feature that custom commands are not executed with the default log options, but are with another setting. Please do not be angry at me if I say that, but if your default mode - which I think is really nice and useful except for the fact that it does not work at the moment (but this can easily be fixed, no problem) - does not work and you think it calls for trouble, why does that mode (a) exist at all and why is it (b) the default? No, please do not remove something useful, just do not be annoyed if your users find bugs and try to help you spot and fix them. This is part of the normal software lifecycle. I was just wondering why I was the first user finding that bug because it is so obvious. I guess that 99% of your users do not use external makefiles, but the internal build system, which makes sense for self-developed software. But as I said, I just want to patch and debug a piece of standard software with a set of existing, complex makefiles which I have no intention of changing. I was just adding a new MC featue (ash/dash subshell support + two bugfixes for existing subshells) and thought it would be a nice test for C::B's debugging front-end to test MC in C::B. Actually, I have not gotten that far just yet because I am discussing this issue here with you, but I think it is well worth the time to improve a product which obviously many other users are satisfied with.

When I was calling C::B useless, I meant it was useless for my specific use case, not all in all and for many other use cases. My remark had a context. So no, I will not accept answers like the one by MortenMacFly. There is no reason to feel insulted just because a user puts his finger into a wound, i.e. he reports bugs.

An IDE has three main use cases: edit code, build, debug. The second one was not working for me, so maybe you understand that in this context the program was useless for me. But now I know a workaround and am confident that the bug(s) will soon be fixed, so I will hang on and continue using C::B. Quality of software is one criterion for me to use software, quality of customer service another one. We had a bad start, but I guess now we are getting closer to finding a solution for the technical problems I detected in your product. This is fine with me.

Quote
Good to hear that calling sudo works, but what I wanted to say, is that it is not guaranteed to work in any cases.

Why should it not? It is a subprocess like any other, too. The GUI dialog is the only way to enter the password because your console is not a real tty. This is exactly what SUDO_ASKPASS was invented for and it works with each editor or IDE I know. As I said, it is independent from or orthogonal to C::B.

Quote
Alternatively you can use my repo (see my sig), if the bug is fixed and I uploaded a new version.

Thanks for your kind invitation, I am going to accept it. If you help me by fixing a bug, I will help you with testing and feedback. That's the deal. As we say in Germany: One hand washes the other one.

Quote
The counting of warnings and errors works here in all cases. (...) If you use localized versions of gcc, it might break the regexes, in this case you have to fix it yourself, because we can not provide regexes for each and any probable localization. Or switch to engish, while compiling ( I have set LC_ALL to en_US.UTF-8 in my environment variables inside C::B).

Yes, that must be it. I did not know that English was the only language supported by C::B, but on second thought, the menu is in English, so I could have concluded from that. I will just use LANG=C (I am on ISO-8859-15 here, not UTF-8, because I often develop for an embedded system with a cross-compiler, and the target system only supports latin1 character set). A quick test shows that the warning is interpreted correctly then.

Some ideas for improvement:
  • If make returns with exit code 0 (zero), it would be smart to assume that there were warnings, but no errors, otherwise the exit code would be !=0.
  • If you know that you only support the English version of make, maybe you could set the environment (LC_ALL or whatever is appropriate) as necessary by yourself , so you are in control of how you parse make's output. This is what my shell scripts with regexes do if I know they only work for English.

As for your suggestion to post bug reports at BerliOS, you can be sure I will do that next time. You are 100% right that if there is a ticket system, it should be used. When I was first posting here I was just not sure if as a newbie I should ring the alarm right away or first try to get some feedback in a user forum. I decided to do the latter and am sorry if this was the wrong place. I usually (not always) try first to ask experienced co-users before I consume precious developer time. But when I am sure that what I consider a bug really is one, I create tickets. If you like to have one for reference, I can do that anyway.

Quote
about the lower- and upper case-stuff: environment-variables and user-defined fields in global variables are totally different. The later are not case-sensitive.

Sorry to say that, but if a menu option is called "Global variables" and the dialogue title is "Global variable editor" and it even works to use a global variable as an environment variable (no matter if it is printed in lower-case when I re-open the dialogue), it is kind of counter-intuitive to assume there is a difference. I have to admit though, that if I had RTFM I probably should have known. Mea culpa. So now that I know it, I will use "Build options" - "Custom variables" which hopefully is the right place. But as it is project-specific and I wanted to set the variable for all projects once and for all, I (falsely) figured that "Global variables" was the right place. BTW, is there a way to set my variable globally for C::B (other than doing it before calling C::B, I mean).
« Last Edit: March 11, 2012, 09:09:11 pm by kriegaex »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom make commands are never executed
« Reply #14 on: March 11, 2012, 09:12:07 pm »
...I wonder how anyone could regard it a feature that custom commands are not executed with the default log options, but are with another setting...
It stimulates people to use the full log. :)
In fact using anything other than the full log in custom make file project is asking for trouble. :)
As I said, I'd prefer there were no other options.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]