Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.12) Gecko/2009072219 Iceweasel/3.0.12 (Debian-3.0.12-1) Build Identifier: 20090920-1017 I have a tool that compiles XML Schema file to C++. It takes the schema file (say hello.xsd) as input and outputs a pair of C++ files, header and source (say hello.hxx and hello.cxx). I also have other, hand-written, C++ source files (say, driver.cxx) that include the generated C++ headers. The goal is to make it work with CDT GCC managed projects. I set up a custom build step for hello.xsd. It describes the output files and provides a command to generate hello.hxx and hello.cxx from hello.xsd. Now the problem is CDT cannot figure out the order in which it should build things. It tries to build driver.cxx first and fails because there is no hello.hxx. The underlying reason for this is the automatic dependency tracking employed by CDT GCC toolchain. That is, it tries to *both* compile driver.cxx and generate driver.d at the same time which fails. If dependency generation was a separate step, GCC has an option to treat all missing headers as generated code (though the fact that everything is compiled from Debug as ../driver.cxx, etc, will probably break things; in other words driver.d will contain hello.hxx instead of ../hello.hxx). Other potential solutions: 1. Allow the user to specify some additional dependencies manually (e.g., I could say that driver.cxx depends on ../hello.hxx). 2. Allow the user to say that this build step should always be run before other steps (e.g., I could say that hello.xsd should be compiled before anything else). This is the approach selected by automake. A more general version would be to have priorities for build steps. Boris Reproducible: Always Steps to Reproduce: Could produce a test project but I think the description above is enough.
(In reply to comment #0) > That is, it tries to *both* compile driver.cxx and generate > driver.d at the same time which fails. I remember somebody mentioned that before - suggesting as workaround building second time after failure. The second attempt would pick the new *.d file generated by the first one.
Nope, in my case the dependency file (driver.d) is empty and any subsequent rebuild attempt fails the same way as the first. In case others are struggling with this, the work around I used was to "bootstrap" the project by explicitly compiling the generated C++ files. Once the they are generated, Eclipse will figure out all the dependencies and everything will work as expected (that is, if I modify hello.xsd, Eclipse will know to first recompile hello.xsd and only then recompile driver.cxx). Here are the complete instructions: http://www.codesynthesis.com/pipermail/xsde-users/2009-October/000153.html
I'm trying to do this same thing (as per instructions at http://wiki.codesynthesis.com/Using_XSD_with_Eclipse_CDT) and keep getting a null pointer exception. I can successfully get through step 5 where I have in my project directory: driver.cxx hello.xsd hello.xml and hello.xsd has a special build step in place to compile it (eg. generate hello.hxx and hello.cxx). If I have NOT tried to do a full GCC compile on the project, then following the "bootstrap"ing instructions to generate the hello.?xx files works. 17:07:48 **** Build of configuration Debug for project hello2 **** make ../hello.cxx Building file: ../hello.xsd Compiling hello.xsd /apps/powerstream/pdev/jwinn/xsd-4.0.0-x86_64-linux-gnu/bin/xsd cxx-tree --generate-inline --output-dir .. ../hello.xsd Finished building: ../hello.xsd 17:07:48 Build Finished (took 265ms) However, if I then try to do a full GCC build, I get the NP exception. From there on out both the XSD build via the "Project->Make Target" and normal GCC build result in the NP exception. I also tried doing the GCC build before the bootstrap/XSD build and I get build results, but they obviously have errors as hello.?xx are missing. make all Building file: ../driver.cxx Invoking: GCC C++ Compiler g++ -I/apps/powerstream/pdev/jwinn/xsd-4.0.0-x86_64-linux-gnu/libxsd -I/home/lpjkw1/xerces-c-3.1/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"driver.d" -MT"driver.d" -o "driver.o" "../driver.cxx" ../driver.cxx:7:21: error: hello.hxx: No such file or directory If I then do the XSD build I get the same NP error. Here's the full content of the NP error: Errors occurred during the build. Errors running builder 'CDT Builder' on project 'hello'. java.lang.NullPointerException I'm running the following: Centos 6.4 (Linux <hostname> 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux) g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) Eclipse CDT Luna Service Release 1a (4.4.1) / Build id: 20150109-0600 I can provide my .project files if desired.