--Cheers, Abou Al Montacir
# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/6/32
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/6
#endif
On Fri, Dec 9, 2016 at 1:46 PM, Paul Gevers <elb...@debian.org> wrote:I am trying to understand you shell scrip
You may find it easier to just run it and inspect the resulting `.deb`s, then refer to the script only when you want to see where a specific path/package is handled.
Background: managing /etc/fpc.cfg via update-alternatives is fundamentally wrong, because it is the file read by *all* installedNote that the new /etc/fpc/debian.cfg must be installed from the *unversioned* package - which will require a "backwards" dependency (fp-compiler-config-3.0.0 depends on fp-compiler-config-common).Can you explain where this requirement comes from? If really required, then we'll have to figure out an other solution, because circular dependencies are a problem.
versions of fpc. In order for each FPC to use its *own* fpc.cfg, they all need to be conditionally included from a *single* fpc.cfg. Since
jessie shipped with packages that manage /etc/fpc.cfg via update-alternatives, the symlink must still be managed by it for the stretch upgrade (for the stretch -> buster upgrade this will no longer be the case).
Fix: Regardless of version, make /etc/fpc.cfg a symlink to /etc/fpc/debian.cfg file, which then includes the files specific to the arch and version.
So the hard dependencies will be:
fp-compiler:$a -> fp-compiler-$v:$a
fp-compiler-$v:$a -> fp-compiler-config-$v:all,
fp-compiler-driver-$v(:$a, but Multi-Arch:foreign)
fp-compiler-config-$v:all -> fp-compiler-config-common:all
(Additionally, fp-compiler-driver-$v should have a backwards
Recommends: fp-compiler-$v:$a and a Description to match, so that
people finding it via `apt-file` (including `command-not-found`) will
get the right thing.)
There is no circular dependency - only the -common package has a
versioned -> nonversioned dependency. And the contents will be:
fp-compiler:$a : empty
fp-compiler-$v:$a : executable /usr/lib/fpc/$v/ppc$a
fp-compiler-driver-$v:$a : executable /usr/lib/fpc/$v/fpc, symlink
/usr/bin/fpc-$v and sometimes (via update-alternatives) /usr/bin/fpc
fp-compiler-config-$v:all : /etc/fpc/$v/{mkcfg,local}.cfg
fp-compiler-config-common:all : /etc/fpc/{debian,local}.cfg, *all*
/etc/fpc/$a/{target,local}.cfg and (via update-alternatives)
/etc/fpc.cfg
It would be possible to put the /etc/fpc/$a/{target,local}.cfg files
in yet *another* package, but IMO there's no value in it. (They are
unversioned so that can't go in fp-compiler:$a which might not be
installed if just fp-compiler-$v:$a is).
While it would *currently* be possible to make fp-compiler-config-$v architecture-specific (since multi-arch allows overwriting files as long as they are identical), that would prove to be a mistake once "real" cross-compiler packages are added. By avoiding relying on this, it becomes easier to transition from *:$a to *-$a packages in future.
All `Architecture: all` packages should be `Multi-Arch: foreign`.
All `Architecture: $a` packages should be `Multi-Arch: same` *except*
`fp-compiler-driver{,-$v}`, `fp-utils{,-$v}`, and `fp-ide{,-$v}` which
should be `Multi-Arch: foreign` since they only make sense on the
host. (The future fp-compiler{,-$v}-$a packages will also be
`Multi-Arch: foreign`).
Control: tags 845504 pending patch Hi, On 29-11-16 20:55, Abou Al Montacir wrote:The dependency on linker package could be fixed easily as you said.But how should we do this in reality? Depends: binutils | binutils-aarch64-linux-gnu | binutils-alpha-linux-gnu | .... etc?
#ifdef cpui386-Fl/usr/lib/gcc/x86_64-linux-gnu/6/32 #endif #ifdef cpux86_64 -Fl/usr/lib/gcc/x86_64-linux-gnu/6 #endifIs this instead of what we now add in fp-compiler.postinst? (By the way, shouldn't we be using ucf for that there?)
# Third party units should be installe in a, multi-arch compatible location.# Units should be installed in /usr/lib/$fpctarget-gnu/fp-units-2.6.2/$pkg/.# Ech fp-units package should install a configuration file called $pkg.cfg in#CFGDIR /etc/fpc-$fpcversion.cfg.d/$fpctarget
The file itself is installed by an arch independent package polled by all fp-compiler packages. This way we have a platform config fileYou mean arch-dependent, right? fp-compiler-3.0.0 is now creating and installing that. Should we revise this then?
Instead of writing a tool to hack all this, I'd propose you submit patches and join the maintain team.Yes, you are welcome. @Ben, do you think the multi-arch hinter on the tracker is correct (action needed section of: https://tracker.debian.org/pkg/fpc) Paul PS: I'll upload soon for the other bug and stuff that is already pending. Would be nice if we could get further on this bug as well.
Going to experimental before unstable with aggressive changes certainly makes sense. IIRC experimental buildds only use build-depends from experimental when required to satisfy version constraints, so by changing version constraints one can choose whether to build a new version in experimental with the previous version from experimental or with the known-good version from unstable.
However I am skeptical as to whether such an aggressive change is really needed. IMO given the relatively small scale of this problem it makes more sense to leave most architectures alone and only deviate from upstream where we actually need to do so.
I just ran a quick check and currently the only architectures with a conflict are armel and armhf. It seems likely ppc64el would also have a conflict but IMO we can cross that bridge when we come to it.
/usr/lib/${DEB_PACKAGE_NAME}/${DEB_UPSTREAM_MAIN_VERSION}by/usr/lib/${FPCTARGET}-${FPCARCH}/${DEB_PACKAGE_NAME}/${DEB_UPSTREAM_MAIN_VERSION}This is probably less intrusive, but have 2 levels of ${FPCTARGET}
I am perfectly fine with you experimenting in experimental. I have a question regarding the patch, as you change generated *.inc files, can't you generate those in the rules file instead of in the patch?
My experience is that if upstream isn't going to carry the patch it is hard to update the patch for files like for that every new upstream release.
Also, I am not sure if we aren't already rebuilding all generated *.inc files in our current build process. I have stripped major blocks for our patches in the past, because they were totally unneeded as the file was (or could be) regenerated.
Paul PS: I would have appreciated it when you would have committed this on a separate (experimental) branch.
Upstream solves this by using a different base dir. We can for instance replace/usr/lib/${DEB_PACKAGE_NAME}/${DEB_UPSTREAM_MAIN_VERSION}by/usr/lib/${FPCTARGET}-${FPCARCH}/${DEB_PACKAGE_NAME}/${DEB_UPSTREAM_MAIN_VERSION}This is probably less intrusive, but have 2 levels of ${FPCTARGET}
Just curious, why did you upload to unstable without fixing these issues
first?
On top of this, the autopkgtest now seems broken (both in Debian and Ubuntu): https://ci.debian.net/packages/f/fpc/unstable/amd64/ http://autopkgtest.ubuntu.com/packages/f/fpc (they were green in bionic)
# Make files are now generated. touch makefiles-stamp make: Entering directory '/tmp/autopkgtest-lxc.tockqviv/downtmp/build.dcy/src/fpcsrc/tests' make: *** No rule to make target 'create_c_objects'. Stop. make: Leaving directory '/tmp/autopkgtest-lxc.tockqviv/downtmp/build.dcy/src/fpcsrc/tests'
Hi,I'm coming late to the party and I only understand a fraction of whatyou wrote, but the parts I do understand make a lot of sense.
On Mon, Nov 28, 2016 at 05:25:14PM -0800, Ben Longbons wrote:On Mon, Nov 28, 2016 at 12:19 AM, Abou Al Montacir<abou.al...@sfr.fr> wrote:For now you can use multi-arch to install fp-compilerNo, you can't (that was the first thing I thought of):fp-compiler:i386 depends on binutils:i386 rather thanbinutils-i586-linux-gnu, and binutils:i386 isn't multiarchinstallable. You'd have to do a full cross chroot, currently.I've read the whole discussion and I'm getting the impression that thereare two distinct issues that are conflated inside this bug.
One one hand, it would be nice to be able to install a foreignfp-compiler to be able to call an emulated (via qemu) compiler. On the
other hand it would be nice to be able to install a cross compiler. And
then there is a third issue not otherwise mentioned, which is crossbuilding the compiler itself.
All of them are nice and they interact somewhat with one another, but ithelps to tell these issues apart.
But once the dependency part is fixed, /etc/fpc.cfg can `#INCLUDE/etc/fpc/$FPCTARGET.cfg` and put `-e/usr/i586-linux-gnu/bin-Fl/usr/lib/i386-linux-gnu -Fl/lib/i386-linux-gnu -Fl /usr/lib32-Fl/lib32` in there (each of those .cfg files will have to be manuallywritten/installed based on the Debian arch (of the fp-compilerpackage), the Debian triple (subdir of /usr/lib), the legacy libdir(/lib32 - actually not sure if this is necessary or not anymore), theGNU triple (of binutils), and the FPC target (for choice of thefilename)). Incidentally, managing /etc/fpc.cfg throughupdate-alternatives is a waste since it could be implemented as just`#INCLUDE /etc/fpc-$fpcversion.cfg` (though since jessie has 2.6.4, anappropriate upgrade path would need to be written).This is the part where I only understand very little. The thing I dounderstand is that there is a fpc.cfg that influences how the compilerbehaves and given the "right" fpc.cfg it can mostly act as a crosscompiler.
As far as I understand though, there is a major piece missing in theDebian package to make this reality. I've run fpc hello.pas under straceand I observe that it calls out to ppcx64. If I were to cross compilefor armel, it would likely call into ppcarm, but there is no ppcarmbinary in any :amd64 package. So regardles how we configure it, we'llneed more binaries to make this happen. Please tell if you think this iswrong.
The above is fairly trivial and will get you a multiarch "cross"compiler, with /etc/ ready for real (non-multiarch fp-compiler (I*think* the libc6-*-cross packages are only needed because of ld.soconflicting. but fp-units-* are actually multiarch safe already,they're just not marked as such - they put all their files in/usr/lib/fpc/$fpcversion/{units,fpmkinst}/$FPCTARGET/ already)) ones.Then it's just a SMOC to actually build real cross-compilers binarypackages from the Debian source package.I'm not sure yet how you solve the missing binaries, but I'm all forhaving cross compilers in the archive.
The initial point was switching the binutils dependency tobinutils-$triplet. Since binutils 2.30-6, we have binutils-for-host andthat means that we always have a binutils-$triplet:$arch where arch andtriplet match. So if you are ok with ignoring oldstable, you can nowdepend on the triplet variant without issues.
However, I think that doing so is technically wrong. When I straced fpc,I saw that it calls into ld.bfd. binutils-x86-64-linux-gnu does notcontain ld.bfd, so the dependency is too weak for what fpc uses. Inorder for a binutils-$triplet to be a correct dependency, we'd have tosomehow tell fpc to always invoke triplet-prefixed tools such asx86_64-linux-gnu-ld.bfd.
And given the pointer to fpc.cfg, I looked into it and stumbled into the-XP option. It is conditional to cross compiling, but given Debian'spackaging of binutils, it is also relevant to foreign installation.We'll need to teach fpc to always use the -XP option even natively. Oncethat is done, we can replace the binutils dependency with"binutils-$triplet" or if you require backwards compatibility withstretch "binutils-$triplet | binutils". Once doing these two bits,foreign installation should become possible.
The next part was fpc as a cross compiler. I think that one of the firstpieces to getting there is ensuring that all the compiler backendbinaries (e.g. ppcx86 or ppcarm) are built for all architectures. Thisdoes not happen today. Any ideas on how to get there?
A separate problem (at least for me) is figuring out what the API tocross building with fpc is. What is a builder expected to do to buildnatively or to cross build?How to build sources for some architecture that can be run (aka buildarchtecture)?* fpc answer: Run plain fpc.* gcc answer: Run plain gcc. In future, this requires a dependency ongcc-for-build.* clang answer: Run plain clang.How to build sources for architecture $x with triplet $y?* fpc answer: ???* gcc answer: Run $y-gcc. This requires a dependency ongcc-$y. In future, a dependency on gcc-for-host:$x will also suffice.* clang answer: Run clang -target $y.Can someone fill in the fpc answer? I kinda suspect that it is "fpc-P$z" for some $z that can be computed from $x or $y and the o11c gisthas such a mapping.
Depending on the answer, the packaging layout may need to change. SoI'll stop here.Hope this helpsHelmut
We already patch the compiler to call ld.bfd instead of ld, so we can change thename as you wish.Can you implement just this part and poke me once that has hit unstable?I can send a patch for the next step then.
fpc -XPx86_64-linux-gnu- myprogram
fpc -Pi386 -XPi386-linux-gnu- myprogram