Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

[linux-port] GCC compile fixes (#184) - #186

Merged
ehsannas merged 1 commit into
google:linuxfrom
pow2clk:pow2clk-fixup3
May 18, 2018
Merged

ehsannas merged 1 commit into
google:linuxfrom
pow2clk:pow2clk-fixup3

Conversation

@pow2clk

@pow2clk pow2clk commented May 17, 2018 •

Copy link
Copy Markdown

GCC doesn't care for calling convention attributes, particularly
the pervasive __cdecl. GCC has an __attribute __ equivalent,
but it doesn't even like its own replacement. So GCC gets nothing.
These are stubbed out in WinMacros.h which requires the inclusion
of that header in a few more places.

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly even if it is GCC being paranoid or buggy.

GCC insists on the stdarg.h header to use va_start and friends.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't exclude one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.
The referencing function is ifdefed here as it is elsewhere in the same file
and marked as an HLSL change since it should have been part of the original
HLSL work.

fixes #184

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk

pow2clk commented May 17, 2018 •

Copy link
Copy Markdown
Author

CompileWhenNoMemThenOOM failed again. I think it's an issue with ToT or the build system.

@ehsannas ehsannas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great work \o/ Overall, LGTM.

Just two improvements that I think would be nice:

It'd be exciting to see all Travis Linux bots passing.

You are right about the Windows test failure. It seems that the test is failing in ToT. Sadly I can't reproduce it locally... I'll try to take a closer look at the Windows test failure today.

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

I'm almost completely indifferent to where the changes are. I actually had them in WinSAL originally, but moved them out because they weren't strictly speaking part of SAL and there were other elements in WinMacros that just dummied out what they defined, but I'm equally happy to move them.

I'll uncomment the line you said. I had no idea how to change that.

Thanks for looking into the windows failure.

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

I'm seeing several GCC errors that I don't see locally. The version the test system is using seems to be 4.8.4 which is pretty old. I'll see if I can get that version locally so I can at least anticipate such things.

On an unrelated note, GCC can colorize output similarly to how clang does. It just doesn't when stdout is redirected as it is with the ninja build system. If there is no objection, I'd like to add the flag so that it will to CMakeLists.txt. That way I won't have to keep adding it locally and we'll get more helpful coloring in the github builds too.

@antiagainst

Copy link
Copy Markdown

SG to adding more color to the world! ;)

@ehsannas

Copy link
Copy Markdown

Let's see if we can use a newer GCC version on the bots.

@antiagainst

Copy link
Copy Markdown

Yeah, Travis CI uses pretty OLD infrastructure. They are still stuck with Ubuntu 14.04, which is 4 years old. Making older compilers happy is a nice thing to achieve, but there is always a line to draw. We cannot go back indefinitely. SO don't stretch yourself too much if using GCC 4.8.4 causing you too much pain.

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

@ehsannas has given me some things to try to use a newer compiler. It needn't be identical of course, but gcc is kind of notorious for producing a different set of errors with each major version.

@ehsannas

Copy link
Copy Markdown

sigh Looks like Travis doesn't like the new config file. It seems sane to me...
Reference is here: https://docs.travis-ci.com/user/languages/cpp/#GCC-on-Linux
@antiagainst do you have any recommendations?

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

It did install additional apt packages for later versions of GCC. So it's doing something different. I wonder if the order is a problem. Should the order in the config file matter? I think it should eval the MATRIX_EVAL sooner. I don't know what's going into DXC_BUILD_TYPE to make it fail like it does though.

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

Okay. Everything WRT gcc actually looks to be ready for success. The problem seems to be that it interprets each of the env settings as a call for a build with just that set and none of the others. Perhaps that's why the guide said to set CC and CXX in a second variable that's evaluated later.

I think if we do the same for the DXC_BUILD_TYPE, we'll be in business.

So MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && DXC_BUILD_TYPE=Debug" with 3 other variants that swap out the presence of the C* assignments for clang and DX_BUILD_TYPE. I don't know how that will play with the compiler settings though. I think I'm on the right track though.

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

BTW, the issue with the compilation failures is be that GCC4 only supports C++11 if you ask for it nicely. We aren't asking for it nicely. It was said to be "experimental" anyway. So we probably don't want that.

@ehsannas

Copy link
Copy Markdown

Yeah, getting the Travis config right is a bit of a trial and error process... Keep throwing different things at it. Thanks 👍

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

Tested the bash code with single quotes, as it should be, then I implemented it with double. SMH

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk

pow2clk commented May 17, 2018

Copy link
Copy Markdown
Author

Well. The good news is that GCC-6 is being used. The bad news is that it's somehow coming up with a new link error I've not seen involving vtables. The clang eval is failing and I understand why. The early out that prevents the compilers from being misassigned also makes it look like a failure. The debug GCC build is bailing out because the log got too long, but I think that's expected. The log is quite long. Mostly unknown pragma warnings. I think they can be suppressed and I've already added a GCC-specific set of flags to the cmake config file. So I can tack that on.

The only mystery is the link error. Don't know why I didn't see it on my machine and I don't know what's causing it. . . .yet.

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk

pow2clk commented May 18, 2018

Copy link
Copy Markdown
Author

GCC Release is completing the test successfully. GCC Debug is still producing too much spew and failing solely for that reason. Clang builds are succeeding as well. Just have to cull down the spew a bit. I'll double check to make sure that locally I'm getting that much from a clean build in case something is awry with the build system.

@ehsannas

Copy link
Copy Markdown

LGTM. I think you just need to rebase.

@pow2clk

pow2clk commented May 18, 2018

Copy link
Copy Markdown
Author

Well It's not good really. The spew is too long on one of the GCC builds so it's being marked as a failure. I'm working on that now.

@ehsannas

Copy link
Copy Markdown

SG. FYI, I just merged #190 , so that should help. Thanks.

@pow2clk

pow2clk commented May 18, 2018

Copy link
Copy Markdown
Author

It helps, but not enough. I did the same for the last run. Still around 700k over. I have some changes that get it down to 3 megs nearly ready to go.

@antiagainst

Copy link
Copy Markdown

Feel free to turn of LLVM_ENABLE_WARNINGS in linuxBuild.py if it helps. We can revisit all the warnings later.

@pow2clk

pow2clk commented May 18, 2018

Copy link
Copy Markdown
Author

I'll keep that in arrow in the quiver, but I think I'll have enough by fixing 4 or 5 warnings in popular headers. I measured my own output and found it to be 4.7 MB with only unknown pragmas disabled. With these, it gets down to 2.9

GCC doesn't care for calling convention attributes particularly
the pervasive __cdecl. GCC has an __attribute__ equivalent,
but it doesn't even like its own replacement. So GCC gets nothing.
These are stubbed out in WinMacros.h which requires the inclusion
of that header in a few more places.

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly even if it is GCC being paranoid or buggy.

GCC insists on the stdarg.h header to use va_start and friends.

HLSL changes excluded Trasnforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references ther missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC sometimes.

Adds color to GCC output even when redirected as is done with ninja.

Additional settings in .travis.yml are to induce it to install and
use gcc-6. Because the system multiplies the number of compiler
variants by the number of env variants and kicks off that many
builds and because we only want Debug and Release variants of
clang and gcc builds, we have to pack a lot into a deferred eval
variable that sets the build type and then changes the compiler
variables only if they are GCC types.

fixes google#184
@pow2clk

pow2clk commented May 18, 2018

Copy link
Copy Markdown
Author

Travis succeeded across the board. I guess it's still waiting for appveyor? They say "queued". 😞 I think I've addressed @ehsannas earlier comments?

@AppVeyorBot

Copy link
Copy Markdown

@ehsannas

Copy link
Copy Markdown

Nice! Thanks Greg.

@ehsannas
ehsannas merged commit d95429e into google:linux May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants