p4c icon indicating copy to clipboard operation
p4c copied to clipboard

Remove unified build

Open fruffy opened this issue 3 years ago • 8 comments

The custom unified build code might actually not be needed anymore. CMAKE has added UNITY_BUILDS, which seem equivalent.

I left the library in the cmake folder, in case downstream repositories still needed. There is only one build testing that the non-unity build compiles, which reduces the amount of CI runs. I can also make unity builds the default if requested.

fruffy avatar Aug 18 '22 11:08 fruffy

This requires fixes on some downstream repositories but otherwise works well. We may even drop the CI option to simplify tests.

fruffy avatar Aug 18 '22 12:08 fruffy

Does this work with any version of cmake? Is it faster or comparable to the old unified build?

mihaibudiu avatar Aug 18 '22 21:08 mihaibudiu

It works with CMake 3.16+, wich is the default since Ubuntu 20.04. The build times are roughly the same, but can be tweaked with UNITY_BUILD_BATCH_SIZE.

fruffy avatar Aug 19 '22 07:08 fruffy

I personally don't have a problem with this, but I think this should work on as many platforms as possible. If this precludes people running older versions of the software from building, then it could be problematic.

mihaibudiu avatar Aug 19 '22 17:08 mihaibudiu

I guess it boils down how we want to maintain backwards compatibility. We dropped support for anything lower than Ubuntu 20.04 with this pull request. So it might make sense to use features that are provided by it.

The original unified_build library is still there. I can try to create a version that uses it depending on the CMake version. I was also hoping to simplify the CI with this PR. We do not need to test all combinations of unified and gmp builds.

fruffy avatar Aug 20 '22 12:08 fruffy

"We dropped support for anything lower than Ubuntu 20.04 with https://github.com/p4lang/third-party/issues/25 pull request."

Techically, we stopped doing automated CI testing for anything lower than Ubuntu 20.04 with that change.

There was a commit in the last month or two that broke the build for Ubuntu 18.04, which when pointed out later via an issue then caused someone to create another PR that restored a working build for Ubuntu 18.04.

jfingerh avatar Aug 20 '22 14:08 jfingerh

I agree that at some point it definitely makes sense not to support Ubuntu 18.04. A reasonable question is: when? One choice is right now. Another would be to wait until 5 years after Ubuntu 18.04 was released in April 2023, when Ubuntu discontinues free support for it.

jfingerh avatar Aug 20 '22 15:08 jfingerh

The problem is that without CI we can not make any guarantees for 18.04. It will be quite hard to respect 18.04 restrictions going forward. This is related to the discussion in https://github.com/p4lang/p4c/issues/3451. Iirc that change worked because there was a solution that works for both 18.04 and future systems. This might not always be possible.

For this particular PR, I can try to come up with a solution that can also work with older CMake systems.

fruffy avatar Aug 21 '22 11:08 fruffy

It works with CMake 3.16+, wich is the default since Ubuntu 20.04. The build times are roughly the same, but can be tweaked with UNITY_BUILD_BATCH_SIZE.

What is the plan now? Land this PR after April 2023? Or just land it now and one (on U18) can install newer cmake easily for example with pip install cmake==3.16.3.

davidbolvansky avatar Dec 11 '22 15:12 davidbolvansky

What is the plan now? Land this PR after April 2023? Or just land it now and one (on U18) can install newer cmake easily for example with pip install cmake==3.16.3.

I will have to revive this PR but I am not quite sure what to do with build_unified yet. I will have to implement an equivalent version so that downstream projects can still use it. It might be nicer if that explicit function were not necessary.

fruffy avatar Dec 11 '22 17:12 fruffy

I have no objections to merging updates that require specific later versions of cmake on Ubuntu 18.04, as long as there are clear README directions on building on Ubuntu 18.04 somewhere.

jfingerh avatar Dec 11 '22 22:12 jfingerh

build_unified

I would remove it.

Could you create new cmake option so we could try new cmake native unified build downstream and do necessary changes?

davidbolvansky avatar Dec 13 '22 01:12 davidbolvansky

For now please pip install cmake 3.16.3 here: https://github.com/p4lang/p4c/blob/main/tools/ci-build.sh#L98

davidbolvansky avatar Dec 17 '22 13:12 davidbolvansky

Please fix failing CI - otherwise I see no blockers to proceed with this PR, do you?

davidbolvansky avatar Jan 30 '23 14:01 davidbolvansky

@mbudiu-vmw @vhavel This PR needs authorized approval because it touches some Testgen code.

fruffy avatar Feb 17 '23 15:02 fruffy

CI and cmake are not my speciality, so I'd rather have someone else comment.

mihaibudiu avatar Feb 17 '23 17:02 mihaibudiu

CI and cmake are not my speciality, so I'd rather have someone else comment.

The issue is that this PR can not be merged unless someone of the code owners approves. It is a little unfortunate.

fruffy avatar Feb 17 '23 18:02 fruffy

@vhavel @pkotikal This PR is stuck because of the reviewer lock we have on testgen files. If you have some time could you give this a review? This PR deprecates our homecooked unified build in favor of CMake's unity builds.

fruffy avatar Feb 21 '23 14:02 fruffy

This looks fine, but I really don't know whether the new requirements will prevent people with older software from building the compiler.

We do have a CI run for Ubuntu 18, which already requires some workarounds. Ubuntu 16.04 we dropped support a long time ago. I do not know about other systems.

fruffy avatar Feb 21 '23 21:02 fruffy

@mbudiu-vmw @vlstill and @davidbolvansky both approved but I can not merge this PR since it is missing an authoritative approval.

fruffy avatar Feb 23 '23 15:02 fruffy

I believe I have the power. Done.

jnfoster avatar Feb 23 '23 15:02 jnfoster

Thank you!

fruffy avatar Feb 23 '23 15:02 fruffy