[aur-general] Conventions on packages for cross-compiling
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers. The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better? Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'? I already created/uploaded cross-compiling tools for MIPS (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) before I realized that they might be wrong. I would be thankful for any hints on these as well. Thanks for any suggestions! Regards - Vojta
On Wed 07 Oct 2009 20:13 +0200, Vojtech Horky wrote:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
I would prefer opt for this, and keeping the cross compiler files separate from the main system.
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
I already created/uploaded cross-compiling tools for MIPS (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) before I realized that they might be wrong. I would be thankful for any hints on these as well.
I don't think there is any standard for packages for cross-compiling. You can be the one to do it. Hah. Make a wiki page and ask that it be linked from: http://wiki.archlinux.org/index.php/Arch_Packaging_Standards Cheers!
Loui Chang wrote:
On Wed 07 Oct 2009 20:13 +0200, Vojtech Horky wrote:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
I would prefer opt for this, and keeping the cross compiler files separate from the main system.
I put the cross-compilers I am working on in /usr/lib/<arch>, or even /usr/lib/cross/<arch>. Personally, I think both mingw32 and cegcc file placement are wrong (esp. mingw32) Allan
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you: http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =) Corrado
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you: http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links. I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines... I and would be really glad if someone would find some time to read it and express his opinion. Thanks! Regards - Vojta
Vojtech Horky wrote:
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you: http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links.
I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines... I and would be really glad if someone would find some time to read it and express his opinion.
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one. Does your proposed build process lead to any "interesting" directories in /usr? I am currently rebuilding the mingw32 packages to check if I can get this working properly and will add comments to the wiki page in the coming days. Allan
2009/10/13 Allan McRae <allan@archlinux.org>:
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one. Does your proposed build process lead to any "interesting" directories in /usr?
I am currently rebuilding the mingw32 packages to check if I can get this working properly and will add comments to the wiki page in the coming days.
Nice to see some discussion on this issue, once a standard is agreed I'll update my avr toolchain. Anyway, IIRC the FHS doesn't state anything cross-arch specific, but your proposal is surely cleaner (and more self-explanatory). Corrado
Vojtech Horky wrote:
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you:
http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links.
I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on
http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines... I and would be really glad if someone would find some time to read it and express his opinion.
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one. I agree that it is more FHS compliant but I would prefer to have files
Does your proposed build process lead to any "interesting" directories in /usr? No. But sometimes a small hack is needed (e.g. the tooldir settings for binutils). Possible conflicts are solved by adding architecture
2009/10/13 Allan McRae <allan@archlinux.org>: directly (i.e. no symlinks) where they are supposed to be (e.g. put executables into /usr/bin rather than symlinking them from /usr/lib/cross*). prefix and duplicate files are not installed at all (e.g. man pages or READMEs). BTW, the MIPS cross-compilers (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) now follow the proposed guidelines from the wiki.
I am currently rebuilding the mingw32 packages to check if I can get this working properly and will add comments to the wiki page in the coming days.
Thanks.
Allan
- Vojta
Vojtech Horky wrote:
2009/10/13 Allan McRae <allan@archlinux.org>:
Vojtech Horky wrote:
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you:
http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links.
I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on
http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines... I and would be really glad if someone would find some time to read it and express his opinion.
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one.
I agree that it is more FHS compliant but I would prefer to have files directly (i.e. no symlinks) where they are supposed to be (e.g. put executables into /usr/bin rather than symlinking them from /usr/lib/cross*).
I found an issue with just using /usr directly... see below.
Does your proposed build process lead to any "interesting" directories in /usr?
No. But sometimes a small hack is needed (e.g. the tooldir settings for binutils). Possible conflicts are solved by adding architecture prefix and duplicate files are not installed at all (e.g. man pages or READMEs). BTW, the MIPS cross-compilers (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) now follow the proposed guidelines from the wiki.
Are there no headers needed for mips? Seems weird... and this may be an issue with other cross compilers. If the mingw headers go in /usr/include there will be lots of conflicts. Allan
Allan McRae napsal(a):
Vojtech Horky wrote:
2009/10/13 Allan McRae <allan@archlinux.org>:
Vojtech Horky wrote:
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
Hi all, I am seeking advice how to write correct PKGBUILDs for cross-compilers.
The thing I am not sure about is where to install them. Trouble is that even the binary packages use different locations and I haven't found any other source where to get information from (for example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ while mingw32-gcc uses /usr). So, which location would you recommend/is better?
Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you:
http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
Another thing - is the correct naming convention 'cross-<arch>-<pkgname>'?
As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links.
I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on
http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines...
I and would be really glad if someone would find some time to read it and express his opinion.
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one.
I agree that it is more FHS compliant but I would prefer to have files directly (i.e. no symlinks) where they are supposed to be (e.g. put executables into /usr/bin rather than symlinking them from /usr/lib/cross*).
I found an issue with just using /usr directly... see below.
Does your proposed build process lead to any "interesting" directories in /usr?
No. But sometimes a small hack is needed (e.g. the tooldir settings for binutils). Possible conflicts are solved by adding architecture prefix and duplicate files are not installed at all (e.g. man pages or READMEs). BTW, the MIPS cross-compilers (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) now follow the proposed guidelines from the wiki.
Are there no headers needed for mips? Seems weird... Some headers are installed into /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include/ and these are found correctly and do not interfere with the native gcc: ~$mipsel-linux-gnu-cpp -v ... #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include-fixed End of search list. ~$cpp -v ... #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.1/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.1/include-fixed /usr/include End of search list.
and this may be an issue with other cross compilers. If the mingw headers go in /usr/include there will be lots of conflicts. Probably I am completely wrong, but won't the headers be the same for all architectures? Of course, except for the very low-level macros that are stored outside /usr/include anyway (I mean those files in /usr/lib/gcc/<arch>/include/). Allan
- Vojta
Vojtech Horky wrote:
Allan McRae napsal(a):
Vojtech Horky wrote:
2009/10/13 Allan McRae <allan@archlinux.org>:
Vojtech Horky wrote:
2009/10/8 bardo <ilbardo@gmail.com>:
2009/10/7 Vojtech Horky <vojta.horky@seznam.cz>:
> Hi all, > I am seeking advice how to write correct PKGBUILDs for > cross-compilers. > > The thing I am not sure about is where to install them. > Trouble is that even the binary packages use different locations > and I > haven't found any other source where to get information from (for > example, cross-arm-wince-cegcc-binutils uses prefix /opt/cegcc/ > while > mingw32-gcc uses /usr). > So, which location would you recommend/is better? > > Some time ago I asked the same question about my AVR toolchain, which is now in [community]. I think the original thread can be interesting to you:
http://mailman.archlinux.org/pipermail/aur-general/2008-January/thread.html#...
> Another thing - is the correct naming convention > 'cross-<arch>-<pkgname>'? > > As you see, I just stuck with the '-arch' postfix =)
Corrado
Hi, first of all - thanks everybody for the suggestions and the links.
I read them through, (again and again) looked around how others do it and finally decided to really write that wiki page as Loui proposed. I put the guidelines proposal on
http://wiki.archlinux.org/index.php/Cross_Compiling_Tools_Package_Guidelines...
I and would be really glad if someone would find some time to read it and express his opinion.
I have been looking into cross-compilers a lot lately, and I think the best place to put _all_ their files is /usr/lib/cross-*-*-* and then symlink needed stuff or add wrapper scripts in /usr/bin/. This is more FHS compliant than the /usr/i486-mingw32 that is used in mingw32 and /usr/avr in the avr one.
I agree that it is more FHS compliant but I would prefer to have files directly (i.e. no symlinks) where they are supposed to be (e.g. put executables into /usr/bin rather than symlinking them from /usr/lib/cross*).
I found an issue with just using /usr directly... see below.
Does your proposed build process lead to any "interesting" directories in /usr?
No. But sometimes a small hack is needed (e.g. the tooldir settings for binutils). Possible conflicts are solved by adding architecture prefix and duplicate files are not installed at all (e.g. man pages or READMEs). BTW, the MIPS cross-compilers (http://aur.archlinux.org/packages.php?O=0&K=cross-mips) now follow the proposed guidelines from the wiki.
Are there no headers needed for mips? Seems weird... Some headers are installed into /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include/ and these are found correctly and do not interfere with the native gcc: ~$mipsel-linux-gnu-cpp -v ... #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include /usr/lib/gcc/mipsel-linux-gnu/4.3.2/include-fixed End of search list. ~$cpp -v ... #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.1/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.1/include-fixed /usr/include End of search list.
and this may be an issue with other cross compilers. If the mingw headers go in /usr/include there will be lots of conflicts. Probably I am completely wrong, but won't the headers be the same for all architectures? Of course, except for the very low-level macros that are stored outside /usr/include anyway (I mean those files in /usr/lib/gcc/<arch>/include/).
You are assuming that the same C library is being used. For example, the mingw32 library include files are very different. Allan
Hi, I have spent the last couple of days looking into what should be a reasonably general method for packaging cross compilers. You can get my PKGBUILDs for a i686-pc-mingw32 cross-compiler from http://allanmcrae.com/packages/cross-i686-pc-mingw32.tar.gz . They can probably use more work, but the general idea is there. The basic principles I came up with are: 1) define these variables _target=i686-pc-mingw32 _sysroot=/usr/lib/${_target} pkgname=cross-${_target}-<program> 2) build most stuff using: --prefix=${_sysroot} --sysroot=${_sysroot} 3) add symlinks for all ${_sysroot}/bin/${_target}-* to /usr/bin An amusing anecdote... the result from building "Hello World!" for Windows using this cross compiler resulted in binary which AntiVir said had a virus. Strip that binary and all was OK! Allan
Hi, 2009/10/14 Allan McRae <allan@archlinux.org>:
Hi,
I have spent the last couple of days looking into what should be a reasonably general method for packaging cross compilers. You can get my PKGBUILDs for a i686-pc-mingw32 cross-compiler from http://allanmcrae.com/packages/cross-i686-pc-mingw32.tar.gz . They can probably use more work, but the general idea is there. They look great - I admit defeat :-) - putting files to /usr/lib/cross-<arch>/ is cleaner than trying to put them to their normal locations and dealing with possible conflicts. Moreover, it does not break FHS.
The basic principles I came up with are:
1) define these variables _target=i686-pc-mingw32 _sysroot=/usr/lib/${_target} pkgname=cross-${_target}-<program>
2) build most stuff using: --prefix=${_sysroot} --sysroot=${_sysroot}
3) add symlinks for all ${_sysroot}/bin/${_target}-* to /usr/bin Is there any special reason why not to use directly --bindir=/usr/bin?
An amusing anecdote... the result from building "Hello World!" for Windows using this cross compiler resulted in binary which AntiVir said had a virus. Strip that binary and all was OK!
Allan
If there aren't any objections to this file placement, will you update the wiki proposal or shall I do it? - Vojta
Vojtech Horky wrote:
Hi, 2009/10/14 Allan McRae <allan@archlinux.org>:
3) add symlinks for all ${_sysroot}/bin/${_target}-* to /usr/bin
Is there any special reason why not to use directly --bindir=/usr/bin?
Um... no reason.... just never thought of that. I will adjust my packages today to give that a spin but I can not see any reason why that will not work.
If there aren't any objections to this file placement, will you update the wiki proposal or shall I do it?
Either. I can make a first pass if you would like. Writing documentation is not my strong point :) Allan
2009/10/15 Allan McRae <allan@archlinux.org>:
Vojtech Horky wrote:
Hi, 2009/10/14 Allan McRae <allan@archlinux.org>:
3) add symlinks for all ${_sysroot}/bin/${_target}-* to /usr/bin
Is there any special reason why not to use directly --bindir=/usr/bin?
Um... no reason.... just never thought of that. I will adjust my packages today to give that a spin but I can not see any reason why that will not work.
If there aren't any objections to this file placement, will you update the wiki proposal or shall I do it?
Either. I can make a first pass if you would like. Writing documentation is not my strong point :) I rewrote it a bit to describe using the /usr/lib/cross-* directory. Feel free to update it if something looks too confusing or wrong. BTW, I am not very good at writing such things either :).
Allan
And one more thing. It is just an idea: shall we create that "out-of-path" thing that I wrote about at the end of the wiki? [In brief: create symlinks with normal (i.e. without architecture prefix) names to the executables and put them into directory outside of path. If there are scripts using directly 'gcc', adding this directory to $PATH would force their usage when cross-compiling.] Any comments/thoughts on this? - Vojta
Vojtech Horky wrote:
2009/10/15 Allan McRae <allan@archlinux.org>:
Vojtech Horky wrote:
Hi, 2009/10/14 Allan McRae <allan@archlinux.org>:
3) add symlinks for all ${_sysroot}/bin/${_target}-* to /usr/bin
Is there any special reason why not to use directly --bindir=/usr/bin?
Um... no reason.... just never thought of that. I will adjust my packages today to give that a spin but I can not see any reason why that will not work.
If there aren't any objections to this file placement, will you update the wiki proposal or shall I do it?
Either. I can make a first pass if you would like. Writing documentation is not my strong point :)
I rewrote it a bit to describe using the /usr/lib/cross-* directory. Feel free to update it if something looks too confusing or wrong. BTW, I am not very good at writing such things either :).
Great. I think we can take the discussion to the talk page on the wiki to try and keep it all in one place.
And one more thing. It is just an idea: shall we create that "out-of-path" thing that I wrote about at the end of the wiki? [In brief: create symlinks with normal (i.e. without architecture prefix) names to the executables and put them into directory outside of path. If there are scripts using directly 'gcc', adding this directory to $PATH would force their usage when cross-compiling.] Any comments/thoughts on this?
I see binutils puts its binaries (without target name) in /usr/lib/cross-i686-pc-mingw32/i686-pc-mingw32/bin. It is a bit of a mouthful though... anyway - discussion on wiki. Allan
participants (4)
-
Allan McRae
-
bardo
-
Loui Chang
-
Vojtech Horky