Linux generic x86 support

Creating a generic binary in linux for all x86 machines

Im trying to compile a binary of an open-source project so that our users do not have to compile it themselves. I’ve noticed that some binaries created on one 32-bit ubuntu machine «A» don’t work on 32-bit machine «B», with errors regarding missing .so files being reported. However, if I compile from scratch on machine «B», then all the errors are gone. Could there be any reason why compiling the code on the target machine makes these errors go away? I only ran «./configure» and «make» — not «make-install», So its not like I made these .so files available globally. Could it be that the compiler detects there are .so files missing from the system library and in this case links a static library into the executable? How does Ubuntu compile its packages so that an i386 package runs on all x86 machines?

4 Answers 4

I guess the issue is called «binary compatibility» (there’s a tag on stack overflow devoted to these problems). When you link a binary on a machine, the surrounding environment affects the binary, and, having been run on another machine, it still tries to find the environment similar to the one it was compiled in.

Tolerance to different environments in this case is called binary compatibility.

How does it work?

The key point here is that, even if you specify the same options to linker on different machines, you may still get different binaries. For example, if you link your binary against a shared library with -lfoo , the exact version of foo you have on the machine you build on (for example, libfoo.so.5 ) is hardcoded into the binary. When it’s run on machine B , it may only contain libfoo.so.4 , and the binary will refuse to run because it needs the missing libfoo.so.5 so file. That’s why recompilation helps, and without it it doesn’t work.

Читайте также:  Репозиторий oracle enterprise linux

Ubuntu packages—and these of any other distribution—are all compiled in the same environment (of each other). That’s why they install well. And distribution vendors watch that each next version is backwards-compatible with previous ones.

What should I do?

If you want to make your software compatible with different distributions, it’s easier than you thought. First, try to compile your application at the oldest distribution possible. Since, as I mentioned before, modern distributions are usually backwards compatible, your soft will, most likely, run on newer distros without problem.

To check the resultant package more thoroughly and get more advice about compatibility, you may from our free Linux Application Checker tool. You might also be interested in generic tips for packaging Linux soft.

Источник

Unofficial user repositories/Repo-ck

Repo-ck is an unofficial Arch Linux repository hosting generic and CPU-optimized kernels. It has been in operation since 2011 and is maintained by graysky.

Kernels package

Brand Group Alias Description Build flags enabled by patchset
Any ck-generic x86-64 generic kernel good for any supported CPU -march=x86-64
ck-generic-v2 x86-64-v2 generic kernel good for any supported CPU -march=x86-64-v2
ck-generic-v3 x86-64-v3 generic kernel good for any supported CPU -march=x86-64-v3
ck-generic-v4 x86-64-v4 generic kernel good for any supported CPU -march=x86-64-v4

Selecting the correct CPU optimized package

If a model specific kernel is not offered, users should select one of the three generic packages that is best matched to the specific hardware. To tell which generic package is best, simply run:

$ /lib/ld-linux-x86-64.so.2 --help | grep supported

If x86-64-v3 (supported, searched) is in the output, use the ck-generic-v3 group. If only x86-64-v2 (supported, searched) is in the output, use the ck-generic-v2 group. If neither are in the output, use the ck-generic group.

Читайте также:  Linux java vm memory

Those wanting CPU-specific optimized packages can run the following command (assuming that base-devel is installed):

$ gcc -c -Q -march=native --help=target | grep march

The resulting -march is what GCC would use natively. Refer to the table above for a mapping of this value to the correct group; again, not every possible value will have a specific group.

Warning: Intel CPU optimized packages support only full Core2 series and i3/i5/i7 series chips. Many Pentium/Celeron chips lack the full requisite instruction sets to make use of the optimized packages. Users of these chips should install the generic packages, even if GCC returns a value corresponding to full core i3/i5/i7 match such as haswell.

Speed benefits of CPU optimized packages

Extensive testing comparing the effect of GCC compile options show varying results, from no change to rather significant speed ups. [1] [2] [3]

This article or section needs expansion.

Reason: Add results to this section where appropriate. (Discuss in Talk:Unofficial user repositories/Repo-ck)

Setup

Add repository

Add the repository to /etc/pacman.conf under the Arch official repositories:

[repo-ck] Server = http://repo-ck.com/$arch
# pacman-key -r 5EE46C4C --keyserver keyserver.ubuntu.com && pacman-key --lsign-key 5EE46C4C

Additional mirror

aviallon hosts a mirror with better bandwidth and stability, synchronized every 6 hours. You can add it to your pacman.conf :

[repo-ck] Server = https://mirror.lesviallon.fr/$repo/os/$arch Server = http://repo-ck.com/$arch

Install kernel

Update your sync database and install the chosen kernel variant (see above for available variants):

Update boot loader configuration

If you are using GRUB with a common setup, then you can update its configuration by regenerating the main configuration file.

Troubleshooting

Support

Error: signature from graysky is unknown trust

Users must import and sign graysky’s gpg key. Instructions along with his key ID are located at repo-ck.com. See also Pacman/Package signing#Adding unofficial keys.

Читайте также:  Why linux is penguin

Источник

Linux generic x86 support

The Linux kernel configuration item CONFIG_X86_GENERIC has multiple definitions:

Generic x86 support found in arch/x86/Kconfig.cpu

The configuration item CONFIG_X86_GENERIC:

  • prompt: Generic x86 support
  • type: bool
  • depends on: CONFIG_X86_32
  • defined in arch/x86/Kconfig.cpu
  • found in Linux kernels: 2.6.24–2.6.39, 3.0–3.19, 4.0–4.20, 5.0–5.19, 6.0–6.4, 6.5-rc+HEAD

Help text

Instead of just including optimizations for the selected x86 variant (e.g. PII, Crusoe or Athlon), include some more generic optimizations as well. This will make the kernel perform better on x86 CPUs other than that selected.

This is really intended for distributors who need more generic optimizations.

Generic x86 support found in arch/i386/Kconfig.cpu

The configuration item CONFIG_X86_GENERIC:

  • prompt: Generic x86 support
  • type: bool
  • depends on: (none)
  • defined in arch/i386/Kconfig.cpu
  • found in Linux kernels: 2.6.15–2.6.23

Help text

Instead of just including optimizations for the selected x86 variant (e.g. PII, Crusoe or Athlon), include some more generic optimizations as well. This will make the kernel perform better on x86 CPUs other than that selected.

This is really intended for distributors who need more generic optimizations.

Generic x86 support found in arch/i386/Kconfig

The configuration item CONFIG_X86_GENERIC:

  • prompt: Generic x86 support
  • type: bool
  • depends on: (none)
  • defined in arch/i386/Kconfig
  • found in Linux kernels: 2.5.69–2.5.75, 2.6.0–2.6.14

Help text

Instead of just including optimizations for the selected x86 variant (e.g. PII, Crusoe or Athlon), include some more generic optimizations as well. This will make the kernel perform better on x86 CPUs other than that selected.

This is really intended for distributors who need more generic optimizations.

Hardware

LKDDb

Sources

This page is automaticly generated with free (libre, open) software lkddb(see lkddb-sources).

Источник

Оцените статью
Adblock
detector