PDA

View Full Version : Linux from Linux...


felix
08-05-2004, 10:27 PM
Hi,

Recentily i had downloaded to read several codes to linux, related with lkm, file-system, etc, and i noted that several (more than 60%) doesn't compile well. For example, the author say tested in Slackware 8. I tryed to compile it in several machines, and some give much errors, others say less errors, others compile. :(

Resume: Linux have a BAD compatibility! :(

What do you generally do to compile this code at your machine ?

Thkz

Nope
08-06-2004, 05:12 AM
You have to understand a few things to work around such problems. Just like a game won't run in Windows if you don't have the right DirectX installed, code might not compile on a computer if you don't have the right libraries installed. Then there is the difference in the compiler version as well as differences in the kernel versions. The change in kernel versions is much like a change from Win98 to WinXP and those don't have much in commen either. Just as an example, multi-threading was not supported before kernel 2.0 at all, with kernel 2.6 there is a major change from the old LinuxThreads to the new NPTL. So programs that rely on some odd Linux thread behaviour will no longer work now. Just like a program that's written with NPTL in mind won't work on 2.4 or older. Or if you try to compile a web server with build in encryption you will get errors if you didn't install the openssl library. Or the library itself was changed. That's hardly the fault of Linux. You can compare that to the change from VisualC++ 5 to 6, don't believe to be able to compile all code written for 5.0 on a 6.0 one. You can't compile OpenGL code unless you have the libraries. You can't compile code written for OpenGL 1.5 with a 1.1 version of the library and so on.

As a simple rule: The less ANSI standard libraries you use, the less the chance to compile it on a different machine. If it doesn't compile, install the libraries that are missing, they are often not installed on distros like SuSE, those are meant for work, not development after all. If it still doesn't work check the compiler and the kernel versions for critical changes.

RobSeace
08-06-2004, 01:06 PM
Yeah, what Nope said... And, especially since you mention
trying to compile LKMs and deep kernel-related things... The
core kernel hackers have always said they have absolutely NO
qualms about completely changing kernel-level APIs on a whim,
and have no sympathy for those who can't keep up, because in
their mind, if you can't keep up, you should stick to user-land, and
leave the kernel to those who can... Leaving old backward-compatible
APIs in place promotes bit-rot... They may have changed some
critical functionality; breaking the API forces everyone that uses
it to take a look at what has changed, and re-evaluate their usage
of it; leaving a backwards-compatible wrapper in place around it
lets the old users blindly ignore the changes, which may lead to
very undesirable behavior... In user-space, in general, stability
and backwards-compatiblity are very good things; in kernel-space,
not so much...

Oh, and even if it were a user-space app that wouldn't compile
on some particular Linux distro, why don't you go and blame it on
the distro, rather than blaming it on Linux as a whole?? Just
because one particular distro fails to ship some lib, or ships some
version of it that's incompatible with whatever you're trying to do,
isn't the fault of "Linux" (as if there's some central "Linux, Inc. HQ"
somewhere, or something ;-))... No one can control what any
particular distro does or doesn't ship... So, of course it's possible
(and, even extremely likely) that you'll need to do a bit of work to
get things ported between different distros... Just as you would
if porting to another OS; because, really, that's essentially what
you ARE doing! Yes, it's Linux, but every distro is basically a
separate, and not necessarily compatible, incarnation of the OS...

felix
08-09-2004, 09:00 PM
Hi,

Thkz for reply!

Well, about the distros i really have the some lib required, but depending of version that it was contructed structures changed, functions, etc. For example in e2fslibs-dev! :(

About Kernel, i understand that backward compatible can improve slow, but this missing of organization (standard) in the Linux Kernel really is very bad. If it was standar doesn't need spend so much times porting LKM for new versions of kernel...

For example, several codes work perectily, only generate hundred of errors because redefinitions of structures, etc. It a standar was used it will not happen! ;-)

Anyway, i'm not blameing a special distro or linux, because i tested the codes in 3 different distros. ;)

Thkz for help.

Regards