Waf throwing errors on c++ builds - c++

Our project contains a lot of c++ sources, up until now we were sing make to build everything, however this takes ages. So I stumbled upon waf, which works quite well and speeds up the build a lot. However everytime I do a full build I end up with a couple of build errors that make no sense. If I do an incremental build now, most of the time some of the sources that could not be build the first time around are build now, some others still fail. On another incremental build I will finally get a successful build.
I have tried building the separate libraries in separate steps, just in case any dependent libraries are attempted to build in parallel, but the errors still appear.
EDIT: The errors I keep getting do not seem to have anything to do with my code, e.g.
Build failed
-> task failed (exit status -1):
{task 10777520: c constr_SET.c -> constr_SET.c.1.o}
After another "waf build" I do not get this error anymore.
EDIT2: The build step for my libraries looks like this:
def build(bld):
bld.shlib(source="foo.cpp bar.cpp foobar.cpp constr_SET.c",
target="foobar",
includes= "../ifinc",
name="foobar",
use="MAIN RW HEADERS",
install_path = "lib/")
MAIN, RW, HEADERS are just some flags and external libraries we use.
Has anyone seen similar behaviour on their system? Or even a solution?

I'm suspecting multiple targets are building the same required object in parallel. Try
export JOBS=1
or
waf --jobs 1

Related

Buildroot does not re-build modified files

i am using external tree building for a linux kernel driver developement. I created a Config.in and a kernel_driver.mk, and everything seemed to work fine, while I still had compilation errors.
I iterated over and over "make driver-dirclean / make driver".
However, i have the impression (and now I verified this fact) that, once i could successfully build correctly once, then BR would NOT rebuild the files aagain, even if i introduce purposely errors in those files !!!
also the output shows:
CC [M] /home/adva/work/sfpnid-drv/buildroot/output/build/hal-1.0.0/kernel/helper.o
LD [M] /home/adva/work/sfpnid-drv/buildroot/output/build/hal-1.0.0/kernel/spidev.o
Building modules, stage 2.
MODPOST 1 modules
CC [M] /home/adva/work/sfpnid-drv/buildroot/output/build/hal-1.0.0/kernel/spidev.mod.o
LD [M] /home/adva/work/sfpnid-drv/buildroot/output/build/hal-1.0.0/kernel/spidev.ko
the compilation never fails where it should !
Is there a cache issue somehow ? rsync effect ?
Thanks,
Jacques
finally i traced down the source of the problem.
As I am using an off-tree build, I had a "make clean" issue. I realise that the dependencies are solved in the BR/output/build/.. environement, while my files are edited off tree.
So what happens is, once it has built successfully 1 time, then the .o are present in BR. The dependencies are satisfied, the "make -rebuild would just re-link the old .o.
I need to do a "make -dirclean" so the new files (with errors) are rsynced.
This is at least the way i understood it.
So for me, this is kinda solved. The fact is, BR is really an integration tool, and less a developement environement. So this behavior is understandable.
Jacques

Error LNK2038 : mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in XX.obj

I'm very new to c++ and was getting this error while trying to build Release versions of my c++ OpenGL project. After some googling I went ahead and changed the Runtime Library in the C/C++ > Code Generation menu to Multi-Threaded Debug GLL (/MDd), which then fixed the issue. I'm wondering if that's the right thing to do though.
I created a new empty project as a test, and the default Runtime Library setting in Release mode is Multi-Threaded (/MD). The default Runtime Library for Debug mode is Multi-Threaded Debug (/MDd). Despite having different Runtime Libraries, both configs build successfully, which makes me wonder if there's been a mess up in my project setup at some point.
Another detail that made me curious was the output log while trying to build in Release x64:
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\LoggerFactory.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\ConsoleAndFileLogger.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Component.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Physics.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Rotator.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\IEntitySpawnHandler.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\SpaceScene.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\ActionManager.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\DeviceManager.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Device.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Mouse.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\MouseAxis.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\MouseButton.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\InputAction.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\InputAxis.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Scene.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\GUI.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\GLFWKeyboardKeyData.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Keyboard.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\GLFWPCInputDeviceFactory.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Random.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\IndexBuffer.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Main.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Material.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Mesh.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\OpenGLUtilities.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Square.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Shader.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\ShaderManager.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\VertexArray.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\VertexBuffer.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\SceneManager.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Singleton.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\glm.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\imgui.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\imgui_demo.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\imgui_draw.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\imgui_impl_glfw_gl3.obj
**D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\x64\Release\Window.obj
**D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Camera.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Color.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Debug.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\ObjectRenderer.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Entity.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\SpaceShip.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Star.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Input.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\KeyboardKey.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Math.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Renderer.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Time.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Transform.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Vector2.obj
D:\Documents\_Projects_FAT\Gios_OpenGL\bin\intermediates\Win32\Debug\Vector3.obj
I've highlighted two lines where the intermediate file path changes from bin\x64\Release to bin\intermediates\Win32\Debug, and was wondering if this might help with the issue.
Though not a perfect solution, I ended up creating a new project and reimporting all dependencies one after another, compiling in between to try and find the issue. After importing all libraries, the new project just worked. I then copied all of my code and compiled it in the new solution, which worked, so the issue has been resolved.
I saved a diff between the two project files, but couldn't find the issue (they are too different for me to make sense out of). Maybe someone with more experience can figure it out.

Undefined reference compilation MITK/Qt

I need to compile the project of my teacher. This project use MITK, VTK, ITK, CTK and Qt. I had some errors which I managed to correct during compilation. Now, i have an error that I don’t understand and I don’t know how correct that to finish the compilation.
The problem is that I have :
undefined reference to « operator delete(void, unsigned long)#Qt_5 »* in the library libMitkAppUtil.so
We see also it is a link error. As it is a project of my teacher and others teachers I think it is a problem with a version of Qt or something in my computer no like the version of gcc or g++ ?
When I open Qt and i open many files there are three messages nearly of the toolbar :
the code model could not parse an included file, which might lead to incorrect completion and highlighting, for example.
Multiple parse contexts are available for this file. Choose the preferred one from the editor toolbar.
This file is not part of any project. The code model might have issues parsing this file properly.
Maybe there is a link with the error on the terminal ?
do you use cmake for the build process?
e.g.
cd MITK-build;
cmake ../MITK-source ./;
make -j1
Please start the build process in single-thread mode and then attach the standard output text to your reply so that we can look into the problem.
Sometimes problems occur with the /ep/ part of the build process (e.p. = external projects), there you could 'cd ep/xxx.../; cmake ./;make -j1' to start individual builds.
HTH,

How to solidify the order in which Bazel builds objects

I'm using Google Bazel to build a program. When I make a large change that affects multiple files, and rebuild, Bazel chooses one file at random to display the error message for. This causes a lot of editor churn, and I constantly lose my context. I fix one compilation error in one file, then rebuild, but I cannot see whether or not the fix worked because Bazel decides to fail on some other file.
Specifically if I have a target
cc_binary(name='foo',
srcs=['bar.cc', 'qux.cc'])
and I run $ bazel build :foo then I will get error messages for bar.cc. If I run again without making any changes, then I will get (maybe) error messages.for qux.cc. I don't know what governs the randomness. Perhaps it is not meant to be known by mere mortals such as my lowly self?
Is there a way to solidify the order in which Bazel builds files, so that I don't have to jump "physically" and mentally between files? Reorienting mental context takes time, and when fixing dumb typos, that time is totally wasted.
What I would love is something like make whereby you can say $ make foo.o. Then I can fix foo.cc, and only after it builds then move on to bar.cc. Does Alphabet Google support such an advanced method?
Try using --keep_going
That will tell bazel not to stop at the first error it finds, and instead try to build everything it can.

Tests won't run: "The executable for the test bundle at '../DerivedData/../*.xctest' could not be found"

I have a Xcode 5.1 project (projA) which included a private framework (frameworkB) via Cocoapods. Everything was working, building and testing and even the weather was nice. But, because the frameworkB is being developed in parallel with the projA, I decided to include the project of the frameworkB (proj B) in projA, again via Cocoapods but as a reference with :path ='path/to/projB'
In the result the projB compiles and builds and runs on device, the tests target also compiles and builds but doesn't run, the simulator start and this message is displayed:
2014-04-14 11:08:34.990 xctest[98973:303] The executable for the test bundle at
/Users/myNameHere/Library/Developer/Xcode/DerivedData/projB-manyLettersHere/Build
/Products/Debug-iphonesimulator/projB.xctest could not be found.
Program ended with exit code: 1
Also the weather is not so nice anymore.
Google didn't help. Other stackoverflow question are more about transition from Sentest cu XCTest.
Any hint that will put me on the right path will be greatly appreciated.
The cause and solution to this problem is (as usual) very simple:
The framework that was being built contained a bundle, which was required, but (of course) was not generated by the Pod project, even if in the podspec i specified the spec.resources pram. The solution was to create a spec.resource_bundle with the required name and resource files.
Why it would throw this error and not a compile-time or runtime error i still don't know :|
(the projB.xctest was present at the path in error)