You are not logged in.

#1 2021-09-30 19:47:06

Florian Ehrhardt
Registered: 2021-09-30
Posts: 2

[SOLVED] How does this seemingly circular dependency not break Pacman?

I was doing research on building toolchains for cross compilation and stumbled upon what in my newbie eyes seems to be a circular dependency in the PKGBUILD files for arm-none-eabi-gcc and arm-none-eabi-newlib (It isn't a problem because the packages build just fine, I just don't understand how).

The PKGBUILD file for arm-none-eabi-gcc specifies arm-none-eabi-newlib as a make-dependency on line 15:
makedepends=(gmp mpfr $_target-newlib)
And it is also marked as an optional dependency on line 16.

So in my understanding pacman will now build newlib before it builds gcc (which already doesn't make sense to me because newlib needs to be compiled by a cross compiler that doesn't exist yet. But that's besides the point).

Now, the PKGBUILD file for arm-none-eabi-newlib specifies arm-none-eabi-gcc as a make-dependency on line 12:
which make sense, but also confuses me because arm-none-eabi-gcc's build depends on newlib according to it's PKGBUILD (As stated above).

So A depends on B which depends on A. I know this is a typical problem when building cross-toolchains but it's unclear to me how pacman handles this, because to me it looks like it should just break. Maybe someone can give me some insights

Sorry if this post is on the wrong forum and/or stupid

Last edited by Florian Ehrhardt (2021-10-01 17:17:42)


#2 2021-09-30 19:55:35

Inspector Parrot
Registered: 2011-11-29
Posts: 25,759

Re: [SOLVED] How does this seemingly circular dependency not break Pacman?

They don't appear to be versioned dependencies, so what should be the problem?  I'd gather version N of arm-none-eabi-newlib can be build with version N-1 of  arm-none-eabi-gcc, then version N of arm-none-eabi-gcc is rebuilt against arm-none-eabi-newlib.

So rebuilds would be no problem at all.  The only questions is how was it built the very first time.  But this bootstrapping problem is not at all unique to these packages - it's the same question one could ask about a single package, gcc, as it depends on itself to build itself.

Makepkg / pacman cannot / do not bootstrap this process on their own (with the current PKGBUILDs as written).  But once it has started, there's no problem at all rebuilding packages with makepkg.

Also note that you are asking about pacman.  Pacman doesn't care at all about makedepends when you are installing built packages.  So it certainly wouldn't "break" pacman.  Even in the N=1 case, pacman would not have any challenges, only building the first version(s) with makepkg would take some tweaking.

Last edited by Trilby (2021-09-30 19:58:14)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#3 2021-10-01 08:05:35

Florian Ehrhardt
Registered: 2021-09-30
Posts: 2

Re: [SOLVED] How does this seemingly circular dependency not break Pacman?

Ah yes. My sleep deprived self has been so focused on figuring out the logic and workings behind bootstrapping a cross compiler that i somehow managed to disregard the fact that pacman doesn't compile these packages. Sorry and thanks


#4 2021-10-01 12:35:20

Forum Moderator
Registered: 2012-01-15
Posts: 3,726

Re: [SOLVED] How does this seemingly circular dependency not break Pacman?

Please remember to mark your thread [SOLVED] (edit the title of your first post).


Board footer

Powered by FluxBB