Skip to content
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

Parallel building 2.9 #2603

Merged
merged 4 commits into from
Sep 9, 2023
Merged

Conversation

The-going
Copy link
Contributor

Description

Add parallel assembly relying on the correct operation of automatic dh commands.

  • export all necessary variables and pass path to src dir
  • fix override_dh_auto_clean
  • PYTHON: Export a variable explicitly to access it
  • dh_auto_build: Provide the possibility of automatic operation

close #2579

… dir

After these changes, the dh_auto_XX commands will receive all
the necessary variables and parameters and pass the applicable
variables\parameters to the dh_XX commands. All dh commands
will be run in the src directory if they are not overridden.

That is, we need to write the override like this:
override_dh_auto_build-arch:
	dh_auto_build -- build-software

NOT so:
override_dh_auto_build-arch:
	dh_build -- build-software
The src/Makefile file has a check of variables at the very
beginning and exits by mistake if they are not initialized.
That is, if there is no src/Makefile.inc file, then the project
configuration was not performed and any other goals were not
fulfilled. It is not possible to complete any goal before
the initial configuration.
This check ensures that the source code is clean and there
is no need to clean it.
@The-going The-going mentioned this pull request Jul 30, 2023
debian/rules.in Outdated
--prefix=/usr --sysconfdir=/etc \
--libdir=/usr/lib \
--disable-multiarch \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we should avoid --disable-multiarch. Any idea how to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, this is the application of configuration parameters explicitly.
I just brought the problem to the surface.

We can go back to the beginning and write like this:

override_dh_auto_configure:
 	cd src && ./autogen.sh
	cd src && PYTHON=/usr/bin/python3 ./configure \

or so:

override_dh_auto_configure:
 	cd src && ./autogen.sh
	dh_configure -D$(SRCDIR) -- \

And these configuration parameters will be applied implicitly.

I have not found any description or reference on this issue in the linuxcnc documentation.
There is also no agreement or description about where which files should be located.
So just reading this: #multiarch and this: MultiarchSpec

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess my problem is that I do not understand how disabling multiarch improve parallelism in the build. can you explain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not affect the parallel build in any way.
This affects the parallel execution of the configuration script, but has a small effect.

I will formulate your question in a different way.
What should we additionally do to add support for multiarchitectural assembly?

When we write:

override_dh_auto_configure:
 	cd src && ./autogen.sh
	cd src && PYTHON=/usr/bin/python3 ./configure \

This means that the script needs to do literally what is written below and not apply any implicit rules, including parallel assembly and multiarchitecture support.
When we write:

override_dh_auto_configure:
 	cd src && ./autogen.sh
 	dh_auto_configure -- \
 	    --prefix=/usr --sysconfdir=/etc \
	    --libdir=/usr/lib \
	    --disable-multiarch \

This means dh_auto_XX to apply all implicit rules except those that are explicitly specified as not to apply.

In other words, before this PR there was no multiarchitectural support
and I just turned it off explicitly in order for the project to be assembled.

Copy link
Contributor Author

@The-going The-going Jul 31, 2023

Choose a reason for hiding this comment

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

Going back to that would be a compromise.

override_dh_auto_configure:
 	cd src && ./autogen.sh
	cd src &&  ./configure \

But you and I will remember the fact that in order to enable multiarchitectural support in this case,
we will have to explicitly specify the --enable-multiarch parameter to the configure script

@The-going
Copy link
Contributor Author

@petterreinholdtsen What should we additionally do to add support for multiarchitectural assembly?
This is an important issue for me and I will make this support in my repository.
In order for my work to return to the project, the linuxcnc developers need to discuss
and decide whether they will implement this support in the future.
And at least write about these plans in the TODO file.

If the variable is not explicitly exported or passed
to the configuration command, then it will be initialized
by the configure script as:
PYTHON=/usr/bin/python3.11 on bookworm
PYTHON=/usr/bin/python3.10 on jammi
@smoe
Copy link
Contributor

smoe commented Aug 7, 2023

I just googled a bit for LinuxCNC and multiarch and found this in the context of NVidia and Ethercat, without any deeper understanding, admittedly. Have not seen it discussed on the mailing list over the past years but if technically not completely off with all our kernel modules then this should be supported, indeed. How urgent is this? Could multiarch wait for 3.0? Somehow I expect that the compiler is hard-coded here or there or that some other flags are not passed right at some corner of the source tree. Since we all have some beef with our Makefiles at some corner, I suggest to elect a volunteer to revision the build process properly.

@smoe
Copy link
Contributor

smoe commented Aug 7, 2023

Have just reviewed it all - @petterreinholdtsen still any objections? This would pass me, I actually like it. @The-going, have many thanks! Nice work!

@The-going
Copy link
Contributor Author

I just googled a bit for LinuxCNC and multiarch

This has to do with the fact that when we have an application and a shared library and the library can be built
for both the i386 or x86_64 architecture and they can both work on the x86_64 architecture.
Similarly with arm, aarch64. Built for these two architectures can run on arm64. In this case,
the location of the shared library files should be in different places:
/usr/lib/${DEB_HOST_MULTIARCH}/
That is, replacing this path /usr/lib/linuxcnc with this one /usr/lib/aarch64-linux-gnu/linuxcnc

Here this question is covered a little: https://wiki.ubuntu.com/MultiarchSpec
I think it's too early to take care of it. I'd rather improve Makefile's a bit first so that the rules for building
a debian package look simple. It has a "mythical" sacred meaning.

@andypugh
Copy link
Collaborator

Where are we up to with this?

@smoe
Copy link
Contributor

smoe commented Aug 24, 2023

I would want to accept as it is and dealt with the exact multiarch bits when we need them.

@smoe
Copy link
Contributor

smoe commented Aug 24, 2023

@petterreinholdtsen , may we have your OK to have this merged?

@petterreinholdtsen
Copy link
Collaborator

I am fine with this change as it stands now.

@andypugh andypugh merged commit 5dbdddc into LinuxCNC:2.9 Sep 9, 2023
11 checks passed
@The-going The-going deleted the parallel-building-2.9 branch September 9, 2023 14:24
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.

4 participants