[SOLVED] How to ignore 'errors' in Qt Creator 2.6.1 on OS X (10.8.2)
-
Hi,
I use Qt Creator 2.6.1 on OS X (10.8.2), and I am able to build and run my project without any problem. However, sometimes, Qt Creator reports 'errors' which clearly are false positives since everything is actually fine. Some 'errors' I sometimes get are:
ERROR: "install_name_tool: object: /Users/Me/MyProject/build/MyProject.app/Contents/PlugIns/MyProject/libSomePlugin.dylib truncated or malformed object (LC_SEGMENT_64 command 2 fileoff field plus filesize field extends past the end of the file)
ERROR: no file at "/Users/Me/MyProject/lib/libSomePlugin.dylib"
I must confess that I am not clear about the first type of 'error' while as for the second type, I certainly don't have a lib folder, so I am confused as why Qt Creator reports that error.
This aside, and maybe more importantly for my productivity, is there any way to automatically ignore those errors? Right now, whenever I get an 'error' like above, Qt Creator tells me that it "found some build errors in [the] current task" and asks me whether "[I] want to ignore them" which I due indeed.
So, ideally, Qt Creator wouldn't report the above 'errors', but worst case scenario there would be a way to always ignore those 'errors'.
Anyone?...
Cheers, Alan.
-
Creator just catches errors thrown by your build system, it does report very few of its own:-) So you should be getting those while building on the command line, too.
Since there is no way creator can know whether an error thrown by the build system is critical or not, it can not proceed to ignore them. Instead you can try to fix your build system to raise these as a warning or ignore them completely.
-
Hi Tobias,
I would have agreed with you, had it not been for the fact that I have experienced slightly different behaviours between Qt Creator and the command line. (E.g. on Ubuntu 12.04, Qt Creator doesn't retrieve all of my environment's settings. My project uses CMake, and I use a more recent version of CMake (2.8.9+ so that I can take advantage of CMake's Qt 5 related features) compared to the stock CMake (2.8.7). So, from the command line, my build environment uses CMake 2.8.9+ while Qt Creator uses CMake 2.8.7, unless I manually set the path to CMake in which case it can indeed use CMake 2.8.9+. Now, I wish I didn't have to do that in Qt Creator, but... I have no other choice or have I?)
As I said, Qt Creator reports false positives while if I build my project on the command line, no errors whatsoever are generated. So, unfortunately, it's not a 'simple' case of me having to fix my build system. As far as I can tell, my build environment is fine, just not from within Qt Creator...
Alan
-
All creator does is call the commands shown in "Projects>Kit-Name>Build", there is no magic whatsoever happening there. If the results are different inside creator from running it outside, then there is something fishy. Most likely you need to set some environment variables for the project.
Like all processes creator runs in the environment you start it in. If you start it from the command line you get exactly the environment set up in that command line, if you start it from the UI it might get a different one, depending on how you set up your system.
Creator will also change the environment slightly for the processes it runs, mostly by adding some directories to the PATH/LD_LIBRARY_PATH. It will do the same independent of how you start it, so that should not be an issue.
You are also free to modify the projects environment in Projects>Kit-Name>Build>Environment and add/remove/change anything you need there.
Creator will run the CMake set up in Tools>Options>Build & Run>CMake. It tries to auto-detect something, so that is where the PATH comes into play, but you can just set the right cmake and all should be well.
-
[quote author="Tobias Hunger" date="1358331096"]All creator does is call the commands shown in "Projects>Kit-Name>Build", there is no magic whatsoever happening there. If the results are different inside creator from running it outside, then there is something fishy. Most likely you need to set some environment variables for the project.[/quote]I have 3 build steps: a call to cmake, a call to make itself, and then a call to run some tests. The call to cmake (on my Ubuntu box), will call the stock cmake rather than my 'preferred' cake which is installed under /usr/local/bin and is before /usr/bin (for the stock cmake) in my PATH. So, if I want to get my first build step to work, I must (for the command field) have /usr/local/bin/cmake rather than cmake only.
[quote author="Tobias Hunger" date="1358331096"]Like all processes creator runs in the environment you start it in. If you start it from the command line you get exactly the environment set up in that command line, if you start it from the UI it might get a different one, depending on how you set up your system.[/quote]And I clearly get a different one (on my Ubuntu box) and I would be happy to fix it. I just don't know what could be causing Qt Creator to get a different environment than the one I have on the command line.
[quote author="Tobias Hunger" date="1358331096"]You are also free to modify the projects environment in Projects>Kit-Name>Build>Environment and add/remove/change anything you need there.
Creator will run the CMake set up in Tools>Options>Build & Run>CMake. It tries to auto-detect something, so that is where the PATH comes into play, but you can just set the right cmake and all should be well.[/quote]I have tried to manually set the path for cmake in Tools>Options>Build & Run>CMake, but I would still need to set the command of my first build step to /usr/local/bin/cmake. To manually set Tools>Options>Build & Run>CMake will only have an effect when I click the "Run cmake" button under Projects.
Otherwise, I have to take back what I said earlier about the 'errors' in Qt Creator 2.6.1 on OS X (10.8.2). When I compared building my project in Qt Creator vs. on the command line, the latter was done when doing a clean build and in that case, I don't indeed get any 'error' whatsoever. However, if I modify some of my code and rebuild my project, I may end up with the same kind of 'errors' as in Qt Creator. Yet, my project still builds and works fine!
Anyway, this is mind puzzling to me, but at least, and as expected and as you said in your original reply, Qt Creator "just catches errors thrown by [my] build system". Now, the question for me is indeed why my build system generates those 'errors'...!?
-
First things first: How did you set up this project of yours? Did you set it up using "new project" and then opened the CMakeLists.txt?
bq. I have 3 build steps: a call to cmake, a call to make itself, and then a call to run some tests. The call to cmake (on my Ubuntu box), will call the stock cmake rather than my ‘preferred’ cake which is installed under /usr/local/bin and is before /usr/bin (for the stock cmake) in my PATH.
What kind of step is that first one? A custom process one?
Why did you add it? It should not be necessary.
bq. And I clearly get a different one (on my Ubuntu box) and I would be happy to fix it. I just don’t know what could be causing Qt Creator to get a different environment than the one I have on the command line.
Hmmm... as I said before: Creator does change the environment a bit. It adds the compiler path to PATH and does some more tweaks. Maybe that is what is causing this.
bq. I have tried to manually set the path for cmake in Tools>Options>Build & Run>CMake, but I would still need to set the command of my first build step to /usr/local/bin/cmake. To manually set Tools>Options>Build & Run>CMake will only have an effect when I click the “Run cmake” button under Projects.
When else do you want to run CMake?
-
Hi Tobias,
I 'set up' my project in Qt Creator by simply dragging and dropping my main CMakeLists.txt file onto it.
As for my first step, I just call CMake with a couple of options (to 'force' a debug build and to enable tests in my build). With regards to 'forcing' a debug build, I imagine there must be a better way of doing this, but I must confess I haven't had time to look into it which means that I would indeed be interested in some 'proper' CMake file which would allow, when opened in Qt Creator, to select whether we want a 'Release' or a 'Debug' build from the GUI (i.e. as can be seen when opening one of Qt's examples).
Otherwise, the reason I added that step is that whenever I modify my CMake files and/or update my translations (yes, my application is internationalised), then I don't have to remember about calling CMake 'manually'. It's automatically done for me. Now, I know that it adds a bit of time for the build, but I am fine with it.
Regarding my Ubuntu issue, it's certainly annoying, but not a show stopper since I was able to find a way around my problem.
Finally, and regarding the original issue at hand, I believe I have found the culprit: macdeployqt... Indeed, I used to use it to build my project on OS X and I had to remove some files/directories for it to work properly. Then, I guess there must have been some other things (in macdeployqt) which made my build environment generate some illegitimate errors. Indeed, I have reworked my deployment code and so far so good, I am not getting any illegitimate errors from my build environment. I have always had some problems with macdeployqt and now I am glad I am not relying on it anymore. It's too unreliable for my use.