Author Topic: Building after svn export  (Read 9151 times)

php-coder

  • Guest
Building after svn export
« on: January 04, 2006, 01:42:27 am »
Why C::B from SVN (1651 revision) after export cannot compilling ?

C::B from SVN compiles successfully, but i cannot compile his after svn export trunk codeblocks

I see that error:

g++ -g -O2 -O2 -ffast-math -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -o auto_revision autorevision.o -pthread  -lpthread -ldl -lpangox-1.0 -L/usr/X11R6/lib -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 -lwx_gtk2u_html-2.6 -lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6
./auto_revision +int +wx +t ../../.. ./../../sdk/autorevision.h
Error: could not open input file
make[3]: *** [all-local] Ошибка 255
make[3]: Leaving directory `/home/coder/RPM/BUILD/codeblocks-1.0/src/tools/autorevision'
make[2]: *** [all-recursive] Ошибка 1
make[2]: Leaving directory `/home/coder/RPM/BUILD/codeblocks-1.0/src/tools'
make[1]: *** [all-recursive] Ошибка 1
make[1]: Leaving directory `/home/coder/RPM/BUILD/codeblocks-1.0/src'
make: *** [all-recursive] Ошибка 1
[c2der@mycomp ~/RPM/BUILD/codeblocks-1.0]$

php-coder

  • Guest
Re: Building after svn export
« Reply #1 on: January 04, 2006, 01:53:21 am »
./auto_revision +int +wx +t ../../.. ./../../sdk/autorevision.h
Error: could not open input file

Problem in that file! autoversion.h does not exist :(

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Building after svn export
« Reply #2 on: January 04, 2006, 02:34:08 am »
./auto_revision +int +wx +t ../../.. ./../../sdk/autorevision.h
Error: could not open input file

Problem in that file! autoversion.h does not exist :(

No, that's not the problem (close though). Autorevision is told to generate it, not use it. However, it attempts to inspects the SVN metadata to do so (to insert the SVN revision into the file) which it can't do after an export.
If you really want to build after exporting, be sure to run that command before exporting and remove it from the makefile so it doesn't give that error.

Maybe one of the devs can patch autorevision to emit something like "N/A" or just 0/-1/whatever instead of the revision number if such an error occurs?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Building after svn export
« Reply #3 on: January 04, 2006, 08:51:21 am »
Heh, interesting :)
Thomas, will you fix this?
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Building after svn export
« Reply #4 on: January 04, 2006, 10:24:17 am »
Heh, interesting :)
Thomas, will you fix this?
Although I disagree on the term "fix", I've changed it. Actually, the program was doing exactly what it should ;)

autorevision will now silently continue in absence of revision information and output "0" as the revision number.

EDIT:
Hmmm... something else just comes to my mind:
How can you actually get an error about a missing file? autorevision used to exit with status -1 on error, so should the build not abort at that point, and you would never see the message about a missing file?
« Last Edit: January 04, 2006, 10:31:24 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Building after svn export
« Reply #5 on: January 04, 2006, 11:34:31 am »
Heh, interesting :)
Thomas, will you fix this?
Although I disagree on the term "fix", I've changed it. Actually, the program was doing exactly what it should ;)

Well yes, but it also aborted the build process. If you could alter the makefiles to not run the autorevision target if not in a working copy but just supply a default autorevision.h stored elsewhere in the source tree that might be a "cleaner" solution. Or just patch autorevision to do that of course. A new command-line parameter "-d[efault]" maybe?
EDIT: And maybe just quit if the output file already exists to not overwrite revision information already present?

Quote
autorevision will now silently continue in absence of revision information and output "0" as the revision number.

EDIT:
Hmmm... something else just comes to my mind:
How can you actually get an error about a missing file? autorevision used to exit with status -1 on error, so should the build not abort at that point, and you would never see the message about a missing file?

How do you mean the build shoundn't abort? AFAIK both the C::B build system and make abort when a non-zero exit code is returned by any program (make can be explicitly told to ignore it by a '-' at the beginning of the line).

And why would not aborting the build cause the error message to be hidden?
From the autorevision sources:
Code
    ifstream inFile(docFile.c_str());
    if (!inFile)
    {
        puts("Error: could not open input file");
        return -1;
    }
It first outputs the error and then returns -1, so the message would show up anyway if the build continued.
« Last Edit: January 04, 2006, 11:36:45 am by Urxae »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5503
Re: Building after svn export
« Reply #6 on: January 04, 2006, 11:48:58 am »
Quote
EDIT: And maybe just quit if the output file already exists to not overwrite revision information already present?

That would be interesting, then 2 files don't have to recompile each time when you build some or your own modified sources (though you can see this also as a revision, but it won't make it to svn).

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Building after svn export
« Reply #7 on: January 04, 2006, 11:56:56 am »
Quote
EDIT: And maybe just quit if the output file already exists to not overwrite revision information already present?

That would be interesting, then 2 files don't have to recompile each time when you build some or your own modified sources (though you can see this also as a revision, but it won't make it to svn).

Actually, I meant only if the input file (.svn/entries) couldn't be opened. So this wouldn't change anything when rebuilding in an SVN working copy.

php-coder

  • Guest
Re: Building after svn export
« Reply #8 on: January 04, 2006, 12:12:18 pm »
autorevision will now silently continue in absence of revision information and output "0" as the revision number.

Hmmm.. C::B build successfully but revision 0 (see http://img461.imageshack.us/my.php?image=codeblocks5cr.png) not right IMHO. Thnx to quick fix! Now i try hint from Urxae...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Building after svn export
« Reply #9 on: January 04, 2006, 12:17:35 pm »
Well yes, but it also aborted the build process.
That was intended, even though it really did not.

Quote
EDIT: And maybe just quit if the output file already exists to not overwrite revision information already present?
In that case, your revision will never change, no matter to what revision you update. This defeats the purpose of autorevision, you could just as well hardcode a revision number into your sources then. The purpose of this tool is to update the revision number that is visible in the application every time the revision of the source files has changed, without any interaction from the user.

Quote
How do you mean the build shoundn't abort?
It should. That's my point. As you can see from the source which you posted yourself, the exit code was -1. Therefore, the error "missing file autorevision.h" should be entirely impossible because the build process should immediately break after autorevision exits.

...then 2 files don't have to recompile each time when you build some or your own modified sources (though you can see this also as a revision, but it won't make it to svn).
This is not the case anyway. The tool itself is never compiled, except if you run "rebuild all" (and it only takes one second to compile, anyway).
The header file is modified if and only if the revision in the header file is different from the revision of the working copy, and there are no exceptions to that rule.
Any "improvements" on that behaviour render the tool entirely useless. The revision number is something you have to be able to rely on, as it is used to track down bugs in the application. If there are exceptions to whether or not the revision is updated, then you are off better to not use it at all.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Building after svn export
« Reply #10 on: January 04, 2006, 12:22:45 pm »
Hmmm.. C::B build successfully but revision 0 (see http://img461.imageshack.us/my.php?image=codeblocks5cr.png) not right IMHO.
It is perfectly right. You compile from sources which are not under revision control, so the revision number is zero. There is no way for the tool to determine the revision of these sources.
Even if you sent me a tarball of all the sources, it would not be trivial to find out which revision you use.

If you use checkout instead of export (which you really should) then you will see the revision number of your checked out version.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5503
Re: Building after svn export
« Reply #11 on: January 04, 2006, 01:58:55 pm »
@thomas : I was not talking about the tool source, but the two files that include the generated header. But as you desrcibe it should be ok, i'll have a closer watch on this when i do my builds.

php-coder

  • Guest
Re: Building after svn export
« Reply #12 on: January 04, 2006, 02:21:22 pm »
If you really want to build after exporting, be sure to run that command before exporting and remove it from the makefile so it doesn't give that error.

Thnx a lot! It's work and satisfyed my wishes !
« Last Edit: January 04, 2006, 02:24:50 pm by php-coder »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Building after svn export
« Reply #13 on: January 04, 2006, 02:41:46 pm »
Quote
EDIT: And maybe just quit if the output file already exists to not overwrite revision information already present?
In that case, your revision will never change, no matter to what revision you update. This defeats the purpose of autorevision, you could just as well hardcode a revision number into your sources then. The purpose of this tool is to update the revision number that is visible in the application every time the revision of the source files has changed, without any interaction from the user.

As I explained in my reply to killerbot, I meant only to do this if revision information wasn't available. I agree it's not perfect though, updating without building before an export will have it report the wrong revision number.

Quote
Quote
How do you mean the build shoundn't abort?
It should. That's my point. As you can see from the source which you posted yourself, the exit code was -1. Therefore, the error "missing file autorevision.h" should be entirely impossible because the build process should immediately break after autorevision exits.

Ah, that's the misunderstanding. That wasn't the error message given:
./auto_revision +int +wx +t ../../.. ./../../sdk/autorevision.h
Error: could not open input file
It couldn't open the input file, it didn't mention autorevision.h. The input file is .svn/entries IIRC, which would indeed not be present after an export.