-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix build with Clang #3208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build with Clang #3208
Conversation
.travis/osx..script.sh
Outdated
| fi | ||
|
|
||
| cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_QT5=$QT5 -DUSE_WERROR=OFF .. | ||
| cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_QT5=$QT5 -DUSE_WERROR=ON .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simply remove this DUSE_WERROR now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more specific, couldn't we default it for DCMAKE_BUILD_TYPE=Debug like we do for stripping binaries, or is this flag a useful one to have around regardless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USE_WERROR is not strictly necessary because you can use CFLAGS=-Wno-error and CXXFLAGS=-Wno-error. USE_WERROR should be dropped if Clang warnings go away.
.travis/linux..install.sh
Outdated
|
|
||
| sudo apt-get install -y $PACKAGES | ||
|
|
||
| # Fix header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasp00 should this be a cmake task so that it doesn't show up for non-travis builds too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-Travis builds may not have sudo permission. We could add a task to warn about it and maybe fix it, but this is an issue that libgig upstream has dealt with and distros should handle their versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-Travis builds may not have sudo permission.
Can't we leverage a cmake task which places the custom header in user-space? Even if it's fixed upstream it will take a while for it to make it to the various -dev channels so it seems like we could hit two birds with one stone and it's not the only header we write at configure/compile time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we leverage a cmake task which places the custom header in user-space?
Yes, we can.
| float otm2 = plugin_data->otm2; | ||
| unsigned int rnda = plugin_data->rnda; | ||
| unsigned int rndb = plugin_data->rndb; | ||
| blo_h_tables * tables = plugin_data->tables; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once these swh issues are merged, we should issue a PR against https://github.com/swh/ladspa
|
Request for upstream at swh/ladspa#44. |
|
@jasp00 I see you added Clang + Qt5. I vote we make that the only Clang compiled build, since we're trying to move away from Qt4 anyway. Are there advantages to keeping Clang + Qt4 that you can think of? |
We can easily enable this combination if the advantage arises. |
|
Do you mind if I merge this one? It means an extra build for pull requests. |
|
@jasp00 yes however can you explain the severity of items like re-writing headers on build, notably qvector? |
The changes are harmless by themselves. The problem I see now is if a user does these steps:
I will add a parameter to enable the rewriting. |
I meant, what breaks in the build if we don't rewrite those headers? Is it only so that we can have stricter compiler warning settings? |
It may be so. The errors could actually be warnings. I have not built with laxer settings. |
I fit passes with laxer settings, can we consider removing it? What is the lesser of two evils here? |
Stricter settings are the best bet. Do not worry about rewriting, it is only meant for Travis CI. Users will not enable this option, unless they want to build with Clang, without warnings, and bad system headers. |
|
How about just using Qt 5.7.1 which includes the fix? Homebrew seems to provide 5.7.1. |
That works. Since Qt5.7 still breaks macdeployqt we should probably merge in tresf@f24f3d9 shortly afterward so that packaging isn't adversely affected. |
Linux build runs on Trusty, so an older Qt 5 should be supported anyway. |
Sure but if the problem has been fixed upstream, isn't this overkill? |
No. Trusty is not fixed. Some users build on Trusty. Travis builds on Trusty. As you can see, the builds are working. You need to configure with |
Mac builds with Clang on each release. I feel your use of the word "need" is unwarranted. If we need to rewrite headers, great. If you are just trying to avoid compilation warnings, I strongly feel this is overkill. |
|
I agree with Tres. Another option to easily silence the warnings is just telling Clang not to show any warnings for these files by registering them as system headers. Adding a command line argument like |
Thanks for sharing. FYI, we'll need to be careful to make this version dependant due a Clang 3.4 bug |
|
@tresf, you have asked what is worse, whether to build with laxer settings or to rewrite system headers. I have answered, stricter settings are better. Warnings in one system might become errors in another. Warnings are solved by fixing them, not by hiding them. You have asked for a header rewrite. I have given you that and it works. Could you tell me what is actually wrong with fixing system headers? Why a bad header is better than a good one? |
|
The advantage of keeping headers as-is is is simplicity, which the project needs more of. I feel that is easier to uncomment two lines of code prefixed with |
We can add comments about which versions are fixed. Travis is not the only affected environment.
They will see the errors, they may report the errors, and they will use
A standard user will not use the rewrite because she will not get the error (warning). The special user that builds with Clang, warning-clean, without sudo powers or the knowledge to fix a header, will use |
| #ifdef LMMS_DEBUG | ||
| #include <assert.h> | ||
| #else | ||
| // TODO: assert is a standard macro, we should choose another name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should choose another name
Isn't this quite common practice though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this quite common practice though?
Using assert for operations with side effects? Yes, it is a common error. We should not change the meaning of standard assert.
|
@jasp00 I'd like to merge this, but I think @lukas-w's proposal is cleaner for the headers. #3208 (comment) |
Please, let us not hide bugs. I do not understand your skepticism. If a user wants to rewrite her headers, she must say "I want to rewrite my headers, fix them for me". What is wrong with that? Do we not provide other workarounds? If we should not offer a rewriting option, then let me fix the Travis environment only. If fixing on setup is not acceptable, then let me add an extra repository so that fixed packages can be used. Let us build on a fixed environment. |
00a348a to
143370c
Compare
|
Since fixing |
There are objections, please don't merge. As far as I can see, both @tresf and I have objected to rewriting any of the two headers, and have also stated why we think so and have suggested multiple alternatives. Yet you write "No one is giving a justification not to rewrite headers". For the record, these are my reasons: In the Qt case, it's overkill to introduce this to merely fix a warning. Generally speaking, I strongly oppose fixing upstream bugs (let alone warnings) in our code, especially if upstream already fixed them. I don't like the complexity introduced with this kind of fixes, and I don't feel it's even our responsibility. As for As for |
|
Yes, before I showed there is no choice, @tresf and you did state an objection, overkill (excessive complexity), which is not a justification unless there is a simpler way to achieve the same result, and there is not. You have suggested several alternatives and I have tried them all. Without this solution, you are just banning environments.
And all of them could hide potential bugs.
Which means that we do not fix warnings in continuous integration.
You are forbidding any usable Debian system (and Ubuntu, of course) with Clang. Is requiring a full package any simpler than rewriting a header? I am repeating myself. This is an optional flag. Do we not have other workarounds? No one is giving a sensible justification. Please explain how to accomplish the same result in a simpler way. If you do not understand the code, then I add more comments. |
I'll reiterate the discussion...
On a side note... whether we use it or not, @jasp00 I have to thank you for the work that has gone into this header patching as well as the patience and time taken to justify the changes however stating that all of the points above are not "sensible justification[s]" is weighing this feature higher than simplicity itself, which we have a clear divide on. This divide is going to be recurring and this divide is one which we'll need to overcome -- at least for this PR -- to get this into Travis. :) |
|
Pending SWH fixes merged, swh/ladspa#47. |
|
I am all for simplicity, but I am running out of alternatives. My concern is the Travis environment. May I just copy the headers in the Travis scripts? |
Copy system headers and fix them Merge files from SWH upstream More Clang fixes
Fix sed expression
libgig's header uses non-C++11 standards. See also LMMS#3208
|
The decision was made not to rewrite system headers in this fashion, but mark the headers as There are several Clang fixes in here that haven't made it into the codebase, but many of them are for 3rd party LADSPA plugins and have since been moved to submodules. New PRs should be opened at the upstream homes, then we'll fast forward the submodules once accepted. |
Closes #3073.
Several issues were present, most of them because of third-party projects. System header
gig.hmay need to be overridden. This request adds a Clang build to Travis CI.