Skip to content

GH-46338: [C++] Add compile step for Meson in cpp_build.sh #46339

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

WillAyd
Copy link
Contributor

@WillAyd WillAyd commented May 6, 2025

Rationale for this change

This makes it possible to control the number of jobs used with Meson in the cpp_build.sh script

What changes are included in this PR?

Updates to cpp_build.sh

Are these changes tested?

Yes

Are there any user-facing changes?

No

Copy link

github-actions bot commented May 6, 2025

⚠️ GitHub issue #46338 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions bot added the awaiting review Awaiting review label May 6, 2025
@WillAyd
Copy link
Contributor Author

WillAyd commented May 6, 2025

@raulcd if I understand correctly, the CMake configuration can read the CMAKE_BUILD_PARALLEL_LEVEL environment variable. Are you looking to recreate that here? Should we use a different name?

@WillAyd
Copy link
Contributor Author

WillAyd commented May 6, 2025

@github-actions crossbow submit *meson

Copy link

github-actions bot commented May 6, 2025

Revision: 6b788ef

Submitted crossbow builds: ursacomputing/crossbow @ actions-a671c6cb33

Task Status
test-conda-cpp-meson GitHub Actions

@WillAyd WillAyd force-pushed the meson-add-compile-step branch from 6b788ef to ef09ed6 Compare May 6, 2025 20:36
@WillAyd
Copy link
Contributor Author

WillAyd commented May 6, 2025

@github-actions crossbow submit *meson

Copy link

github-actions bot commented May 6, 2025

Revision: ef09ed6

Submitted crossbow builds: ursacomputing/crossbow @ actions-098f7bf390

Task Status
test-conda-cpp-meson GitHub Actions

Comment on lines 286 to 289
time {
meson compile -j $[${n_jobs} + 1];
meson install;
}
Copy link
Member

Choose a reason for hiding this comment

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

We need only compile time because install time will not be slow:

Suggested change
time {
meson compile -j $[${n_jobs} + 1];
meson install;
}
time meson compile -j $[${n_jobs} + 1]
meson install

Comment on lines 286 to 291
time {
meson compile -j $[${n_jobs} + 1];
meson install;
}
else
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-$[${n_jobs} + 1]}
Copy link
Member

Choose a reason for hiding this comment

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

How about defining ARROW_BUILD_PARALLEL or something and use it as the default for Meson and CMake?

: ${ARROW_BUILD_PARALLEL:=$[${n_jobs} + 1]}
if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
  meson compile -j ${ARROW_BUILD_PARALLEL}
else
  export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL}
fi

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels May 7, 2025
@WillAyd
Copy link
Contributor Author

WillAyd commented May 7, 2025

@github-actions crossbow submit *meson

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 7, 2025
Copy link

github-actions bot commented May 7, 2025

Revision: f471fe1

Submitted crossbow builds: ursacomputing/crossbow @ actions-db63e10f79

Task Status
test-conda-cpp-meson GitHub Actions

Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @WillAyd

else
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-$[${n_jobs} + 1]}
export ARROW_BUILD_PARALLEL=${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}
Copy link
Member

Choose a reason for hiding this comment

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

CMake doesn't know what ARROW_BUILD_PARALLEL is, we should still use CMAKE_BUILD_PARALLEL_LEVEL which we can define outside of the if : ${ARROW_BUILD_PARALLEL:=$[${n_jobs} + 1]}

Suggested change
export ARROW_BUILD_PARALLEL=${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}
export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch - done!

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels May 7, 2025
@WillAyd WillAyd force-pushed the meson-add-compile-step branch from f471fe1 to 180ad7a Compare May 7, 2025 14:12
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 7, 2025
@WillAyd
Copy link
Contributor Author

WillAyd commented May 7, 2025

@github-actions crossbow submit *meson

Copy link

github-actions bot commented May 7, 2025

Revision: 180ad7a

Submitted crossbow builds: ursacomputing/crossbow @ actions-d3f9e22713

Task Status
test-conda-cpp-meson GitHub Actions

@@ -283,9 +283,10 @@ else
fi

if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
time meson install
time meson compile -j ${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}
Copy link
Member

Choose a reason for hiding this comment

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

Could you define ARROW_BUILD_PARALLEL out of this if to avoid the default value duplication?

export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-${NPROC}}
export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL:-${NPROC}}
Copy link
Member

@kou kou May 8, 2025

Choose a reason for hiding this comment

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

Hmm. I think that we don't need this because we always use CMake in this script.
If we want this, could you use ARROW_BUILD_PARALLEL only if CMAKE_BUILD_PARALLEL isn't defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point - for now I have just reverted this

else
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-$[${n_jobs} + 1]}
export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}
Copy link
Member

Choose a reason for hiding this comment

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

Could you use ARROW_BUILD_PARALLEL only if CMAKE_BUILD_PARALLEL_LEVEL? (If both of CMAKE_BUILD_PARALLEL_LEVEL and ARROW_BUILD_PARALLEL, CMAKE_BUILD_PARALLEL_LEVEL should be used.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks a bit more complicated but let me know if the current iteration is now inline with your expectations or not

@github-actions github-actions bot removed the awaiting change review Awaiting change review label May 8, 2025
@github-actions github-actions bot added the awaiting changes Awaiting changes label May 8, 2025
@WillAyd WillAyd force-pushed the meson-add-compile-step branch from 180ad7a to 80d8d0c Compare May 8, 2025 13:48
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 8, 2025
Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

👍 LGTM now

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels May 8, 2025
@@ -282,10 +282,12 @@ else
${source_dir}
fi

ARROW_BUILD_PARALLEL=${CMAKE_BUILD_PARALLEL_LEVEL:-${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ARROW_BUILD_PARALLEL=${CMAKE_BUILD_PARALLEL_LEVEL:-${ARROW_BUILD_PARALLEL:-$[${n_jobs} + 1]}}
: ${ARROW_BUILD_PARALLEL:=$[${n_jobs} + 1]}

else
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-$[${n_jobs} + 1]}
export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export CMAKE_BUILD_PARALLEL_LEVEL=${ARROW_BUILD_PARALLEL}
: ${CMAKE_BUILD_PARALLEL_LEVEL:=${ARROW_BUILD_PARALLEL}}
export CMAKE_BUILD_PARALLEL_LEVEL

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting merge Awaiting merge labels May 9, 2025
@WillAyd WillAyd force-pushed the meson-add-compile-step branch from 80d8d0c to fb1d52b Compare May 9, 2025 01:17
@WillAyd
Copy link
Contributor Author

WillAyd commented May 9, 2025

@github-actions crossbow submit *meson

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 9, 2025
Copy link

github-actions bot commented May 9, 2025

Revision: fb1d52b

Submitted crossbow builds: ursacomputing/crossbow @ actions-770b1544a4

Task Status
test-conda-cpp-meson GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting change review Awaiting change review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants