Skip to content

Conversation

@jasp00
Copy link
Member

@jasp00 jasp00 commented Jan 4, 2017

Closes #3073.
Several issues were present, most of them because of third-party projects. System header gig.h may need to be overridden. This request adds a Clang build to Travis CI.

fi

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_QT5=$QT5 -DUSE_WERROR=OFF ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_QT5=$QT5 -DUSE_WERROR=ON ..
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is off.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasp00 thanks I didn't realize this was our own flag. This was added and only ever enabled for Mac travis builds. My guess is @lukas-w did this just to get Travis to pass for the time being. If you've fixed all the clang warnings, is it needed anymore? 9cc1a59

Copy link
Member

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?

Copy link
Member Author

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.


sudo apt-get install -y $PACKAGES

# Fix header
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

@tresf tresf Jan 5, 2017

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

@jasp00
Copy link
Member Author

jasp00 commented Jan 5, 2017

Request for upstream at swh/ladspa#44.

@tresf
Copy link
Member

tresf commented Jan 5, 2017

@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?

@jasp00
Copy link
Member Author

jasp00 commented Jan 5, 2017

Are there advantages to keeping Clang + Qt4 that you can think of?

We can easily enable this combination if the advantage arises.

@jasp00
Copy link
Member Author

jasp00 commented Jan 24, 2017

Do you mind if I merge this one? It means an extra build for pull requests.

@tresf
Copy link
Member

tresf commented Jan 24, 2017

@jasp00 yes however can you explain the severity of items like re-writing headers on build, notably qvector?

@jasp00
Copy link
Member Author

jasp00 commented Jan 24, 2017

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:

  1. Build in a broken environment.
  2. Upgrade the environment.
  3. Rebuild.

I will add a parameter to enable the rewriting.

@tresf
Copy link
Member

tresf commented Jan 24, 2017

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?

@jasp00
Copy link
Member Author

jasp00 commented Jan 24, 2017

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.

@tresf
Copy link
Member

tresf commented Jan 24, 2017

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?

@jasp00
Copy link
Member Author

jasp00 commented Jan 24, 2017

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.

@lukas-w
Copy link
Member

lukas-w commented Jan 24, 2017

How about just using Qt 5.7.1 which includes the fix? Homebrew seems to provide 5.7.1.

@tresf
Copy link
Member

tresf commented Jan 24, 2017

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.

@jasp00
Copy link
Member Author

jasp00 commented Jan 24, 2017

How about just using Qt 5.7.1 which includes the fix?

Linux build runs on Trusty, so an older Qt 5 should be supported anyway.

@tresf
Copy link
Member

tresf commented Jan 27, 2017

It may be so. The errors could actually be warnings. I have not built with laxer settings.

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?

@jasp00
Copy link
Member Author

jasp00 commented Jan 27, 2017

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 -DFIX_SYSTEM_HEADERS=ON to enable the rewriting, so it is controlled. Besides, /usr/include/gig.h needs to be fixed too, the fix being in experimental packages on some distros.

@tresf
Copy link
Member

tresf commented Jan 27, 2017

needs to be fixed

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.

@lukas-w
Copy link
Member

lukas-w commented Jan 27, 2017

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 --system-header-prefix=/usr/ should silence them.

@tresf
Copy link
Member

tresf commented Jan 27, 2017

--system-header-prefix=/usr should silence them.

Thanks for sharing. FYI, we'll need to be careful to make this version dependant due a Clang 3.4 bug -isystem-prefix vs. --system-header-prefix (Edit: and yes, I believe we're affected when we build from macOS 10.8 ~= XCode 5.1.1 ~= Clang 3.4):

http://stackoverflow.com/a/23342233/3196753

@jasp00
Copy link
Member Author

jasp00 commented Jan 27, 2017

@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?

@tresf
Copy link
Member

tresf commented Jan 27, 2017

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 # TODO: Remove once Travis ships with Qt 5.7 then to patch source-code on the fly. Developers should see and report the errors (warnings) upstream. I think the patching is overestimating the importance of these warnings. If the argument is that a standard user wouldn't be using the rewrites, then the severity argument is flawed. Users will build and use the software they develop, no? If I'm wrong, please explain.

@jasp00
Copy link
Member Author

jasp00 commented Jan 27, 2017

# TODO: Remove once Travis ships with Qt 5.7

We can add comments about which versions are fixed. Travis is not the only affected environment.

Developers should see and report the errors (warnings) upstream.

They will see the errors, they may report the errors, and they will use -DFIX_SYSTEM_HEADERS=ON or fix the headers themselves.

If the argument is that a standard user wouldn't be using the rewrites, then the severity argument is flawed.

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 -DFIX_SYSTEM_HEADERS=ON.

#ifdef LMMS_DEBUG
#include <assert.h>
#else
// TODO: assert is a standard macro, we should choose another name
Copy link
Member

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?

Copy link
Member Author

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.

@tresf
Copy link
Member

tresf commented Feb 5, 2017

@jasp00 I'd like to merge this, but I think @lukas-w's proposal is cleaner for the headers. #3208 (comment)

@jasp00
Copy link
Member Author

jasp00 commented Feb 13, 2017

I think @lukas-w's proposal is cleaner for the headers.

Adding a command line argument like --system-header-prefix=/usr/ should silence them.

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.

@jasp00 jasp00 force-pushed the clang branch 2 times, most recently from 00a348a to 143370c Compare March 28, 2017 02:27
@jasp00
Copy link
Member Author

jasp00 commented Mar 28, 2017

Since fixing gig.h is required, I believe there are no objections to the rewrite option. I will merge later.

@lukas-w
Copy link
Member

lukas-w commented Mar 28, 2017

I believe there are no objections to the rewrite option

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 QVector: There are several methods of silencing the warning that don't involve regex-fixing a header. We can also just build with relaxed settings.

As for gig.h: Upstream has fixed this two years ago in version 4.0. We could just require that version for the GigPlayer plugin. Let's look into that option first.

@jasp00
Copy link
Member Author

jasp00 commented Mar 28, 2017

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.

There are several methods of silencing the warning that don't involve regex-fixing a header

And all of them could hide potential bugs.

We can also just build with relaxed settings.

Which means that we do not fix warnings in continuous integration.

We could just require that version for the GigPlayer plugin.

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.

@tresf
Copy link
Member

tresf commented Mar 28, 2017

excessive complexity [...] is not a justification unless there is a simpler way to achieve the same result

I'll reiterate the discussion...

qvector.h

  1. Qt ships with a header that barks with a warning on clang compiler. If we want to leverage strict Travis-CI compiler settings for the Clang environment (I think we all do) we need to find a way to get past this warning.

    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:767:21: warning: destination
          for this 'memmove' call is a pointer to class containing a dynamic class
          'QPixmap'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
    

    A proposal by @lukas-w is to instruct the compiler that this is a system header that we have no control over, either through an ifdef flag on each qvector.h include or alternately through a compile setting. @jasp00 is worried -Wno-dynamic-class-memaccess for the entire project is unsafe. @jasp00 also advises against --system-header-prefix=/foo/bar. I personally feel --system-header-prefix=/foo/bar is an adequate compromise.

gig.h

  1. Gig player simply won't work on Clang unless updated. Some repos already have the updated GigPlayer, but Travis-CI does not. This affects users on many popular distributions building LMMS using Clang using GigPlayer -- something LMMS has never really offered prior to this PR.
    /usr/include/gig.h:434:27: error: ISO C++11 does not allow access declarations;
       use using declarations instead
    
    A proposal by @lukas-w is to drop GigPlayer support < 4.0 as 4.0+ fixes this problem. @lukas-w did not specify if he meant drop it altogether or if he meant drop it only for Clang. @jasp00 has concerns that the entire feature shouldn't be dropped over a trivial header change. This concern has merit. I personally feel that GigPlayer is largely unused plugin which has never worked on these systems with Clang to begin with, so this is a few feature and CAN wait for upstream to fix it. For those rare occurrences that need GigPlayer without access to the newer version on the mentioned compiler, they can edit the header themselves, since the header is useless on Clang anyway. i.e. They're going to need it fixed for any other projects that use the header so why burden OUR project?

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. :)

@jasp00
Copy link
Member Author

jasp00 commented Mar 29, 2017

Pending SWH fixes merged, swh/ladspa#47.

@jasp00
Copy link
Member Author

jasp00 commented Mar 30, 2017

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? sha256sum plus cp, it is simple and we do more complex stuff.

tresf added a commit to tresf/lmms that referenced this pull request Jun 1, 2017
libgig's header uses non-C++11 standards.

See also LMMS#3208
@tresf tresf mentioned this pull request Jun 1, 2017
@tresf
Copy link
Member

tresf commented Nov 15, 2017

The decision was made not to rewrite system headers in this fashion, but mark the headers as SYSTEM headers and simplify the codebase.

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.

@tresf tresf closed this Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants