LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-18-2022, 03:03 PM   #1
fredmyra
Member
 
Registered: Dec 2019
Location: Sweden
Posts: 295

Rep: Reputation: Disabled
Is it possible to compile once and then install to different hardware configurations ?


0TB (Old Tech Bloke) says in his EXCELLENT video Slackware 15: Easy Slackbuild Management With Helper Applications:
Quote:
”...compiling once, install multiple times and what I mean by that is once I have built a Slack Build package, I will tend to save it, upload it to a git lab repo and when I come to installing on another system - and I have got multiple ThinkPads as many of you know - I will simply pull down the git repo and in a single command –< uppgrade package install-new > I will install all of my compiled Slack Builds”.
I have been using Linux for more than 10 years,Slackware regularly for at least 3 years, but I am a true distro-hopper so I haven’ t gone deep anywhere. My understanding of the underlying logic of systems is extremely limited.

In this case I was surprised by OTB’s comment because I felt it challenged (demolished ?) one of the few understandings I believed I had, namely that when one compiles a package it is compiled in a somehow optimal way to some architecture/hardware configuration.

This has been my motivation to try to learn about compiling, as I can not afford modern powerful machines. I always hope to extract best performance by choice of software and optimization of its installation.

I am hoping that OTB has many ThinkPads of the same model and that that is why he can install multiple times from one compilation. But my instinct which is far superior to my logic suggests that I may be in for some sad news which is why I am posting this here so that I may get some final understanding with your kind help.
 
Old 11-18-2022, 03:22 PM   #2
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 795

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
I run Slackware64-15.0 on 3 different machines, all x86_64 architecture, and keep them up-to-date so the package base is the same across those. When I build custom/third party software, I build it on my fastest machine and then installpkg there and on the other machines. This works fine because its built/linked against the same libraries on any of these machines. Perhaps this is what "OTB" meant?

I try to be careful and use a clean/up-to-date slackware chroot when building packages to distribute across multiple machines so I can avoid linking against differing third party libraries, since my build machine has more custom software on it than the others. However, if they are all the same then it shouldn't matter.

If you build on something like slackware-current and then install that package on slackware-15.0, then you will run into problems from being built against different libraries.

If you build and install on different architectures then things dont work at all. E.g. Building a x86_64 package and installing it on aarch64 will fail.

HTH

Edit: Perhaps you are thinking of kernels? Those can be optimized for differing hardware configurations. However, the generic and huge kernels are designed to work across a wide variety of configurations and work for most cases.

Last edited by 0XBF; 11-18-2022 at 03:28 PM.
 
2 members found this post helpful.
Old 11-18-2022, 03:30 PM   #3
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 907

Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
When you compile a program you tell the compiler how much to optimize. Slackware’s packages are compiled once but can run on all x86_64 computers (speaking of Slackware 64, obviously). This is because the optimization flags used when compiling tell the compiler to target all x86_64 CPUs (basically target the lowest/oldest x86_64 CPU). For 32-bit Slackware you’ll see lots of packages with i686 in the name - meaning they won’t run on i386 - i586 CPUs.

If you want, you can use the -march=native flag to tell the compiler to target the CPU of the computer doing the compiling. Such a program compiled this way will most likely not run on older CPUs. I think Gentoo does this for lots of packages in an attempt to eek out as much performance as possible.

Roughly speaking newer CPUs only add features (instruction sets), not take them away. So programs compiled for older CPUs should run on newer CPUs.
 
2 members found this post helpful.
Old 11-18-2022, 03:42 PM   #4
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 907

Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
Spend some time studying the -march and -mtune options and it should all become clear

https://gcc.gnu.org/onlinedocs/gcc/x...ml#x86-Options
 
1 members found this post helpful.
Old 11-18-2022, 05:39 PM   #5
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,464
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by fredmyra View Post
In this case I was surprised by OTB’s comment because I felt it challenged (demolished ?) one of the few understandings I believed I had, namely that when one compiles a package it is compiled in a somehow optimal way to some architecture/hardware configuration.
Officially, Slackware is built to run on ia-32 and x86_64 based processors.

Any binaries compiled by you on a particular version/edition of Slackware will be compatible with any other computer running the same version/edition of Slackware.

That is to say, for example: Any program compiled using Slackware64-15.0 will run on any other computer running Slackware64-15.0.

This is part of the reason that a full installation of Slackware is (highly!) recommended. It ensures that you're using the same libraries as everyone else, and on all of your machines. If you want to "compile once and use everywhere," then you can... just like OTB does.

It's also a major point of difference between Slackware and most other distributions... in that most other distributions don't have a standardised set of packages, so you can't be sure that the same libraries exist on all of your machines.

Slackware comes with everything that was used to build it. Nothing is kept from you.

EDIT: This is also the reason why I prefer to run the stable release and not 'current'... the libraries in 'current' can be "shifting sands."

Last edited by rkelsen; 11-18-2022 at 06:31 PM.
 
2 members found this post helpful.
Old 11-19-2022, 01:08 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,675
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
If you want to run highly optimized code, then you should be using Gentoo, not Slackware. Gentoo was named after the fastest-swimming penguin in the world! Not only is all code compiled locally, but you can set all kinds of flags for the compilations to ensure that you are getting the last drop out of your system. Me, I can't be arsed. I use Slackware because Slackware just works.
 
2 members found this post helpful.
Old 11-19-2022, 09:40 AM   #7
fredmyra
Member
 
Registered: Dec 2019
Location: Sweden
Posts: 295

Original Poster
Rep: Reputation: Disabled
I am so glad I came here for help!

Quote:
oxbf wrote:
Perhaps you are thinking of kernels? Those can be optimized for differing hardware configurations.
Quote:
drumz wrote:
If you want, you can use the -march=native flag to tell the compiler to target the CPU of the computer doing the compiling. Such a program compiled this way will most likely not run on older CPUs. I think Gentoo does this for lots of packages in an attempt to eek out as much performance as possible.
Quote:
hazel wrote:
If you want to run highly optimized code, then you should be using Gentoo, not Slackware. Gentoo was named after the fastest-swimming penguin in the world! Not only is all code compiled locally, but you can set all kinds of flags for the compilations to ensure that you are getting the last drop out of your system.
It feels like my problem has been through (a successfull) psychanalysis.

You went all on spot. I guess Gentoo was close to come to my mind, but I was so focused on my questions that I never allowed it.

I explain: I had a swift and happy introduction into Linux through Mint which remained my only distro for about 4 years.

I was then mentored by the IT-administrator at the school I worked who gave me an old i-mac G3 with 346Mb ram and an outdated macOS, and told me about Gentoo and the possibility of trimming it.

And that was really the ultimate cause for my questiom.

I spent three years reading and trying to install Gentoo on that machine, successfully and easily installed Lubuntu and Debian, but could not use them - too slow.

I did install Gentoo on an old HP but after I accidentally nuked it I could not install the newer versions, concluded that the machine was possibly too old and at the same time realized I am not smart enough to work with Gentoo. I do not have the patience and discipline to go through an n-curse configuration with over 6000 items.

Then I found Sabayon which became my favorite until its tragic end. After that I tried many different distros but kept coming back to the Slackware website because I was fascinated with the little I understood of it. Took me one or two years before I dared trying it. It has not been easy, but it sure feels way more comfortable than Gentoo, and I have had fantastic support all the way.

So Hazel is right, I should use Gentoo. But I simply can’t. And Slackware has been working fine for me.

I still don’t really fully understand most of what I read about operational systems, I just have some fuzzy intuitive understanding, but it has worked so far even if it could become much better.

So your answers have helped me understand Slackware better. I had been missing many interesting points. Like :

Quote:
oxbe wrote :
When I build custom/third party software, I build it on my fastest machine and then installpkg there and on the other machines. This works fine because its built/linked against the same libraries on any of these machines.
I had never imagined this would be possible.

Quote:
rkelsen wrote:
Any binaries compiled by you on a particular version/edition of Slackware will be compatible with any other computer running the same version/edition of Slackware.
I was also totally unaware of this.

I am now wondering if there is any sense in compiling packages for which there are binaires available in BobAlien’s repo. Will be thankful for opinions on this.


Quote:
drumz wrote:
Spend some time studying the -march and -mtune options and it should all become clear.
https://gcc.gnu.org/onlinedocs/gcc/x...ml#x86-Options
I am pretty sure I won’t resist taking a look at that sooner or later. I know it means trouble, but thanks for the link.

Last edited by fredmyra; 11-19-2022 at 10:36 AM. Reason: Unwillingly posted an early part
 
1 members found this post helpful.
Old 11-19-2022, 10:57 AM   #8
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 795

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
Quote:
Originally Posted by fredmyra View Post
I am now wondering if there is any sense in compiling packages for which there are binaires available in BobAlien’s repo. Will be thankful for opinions on this.
The convenience of AlienBob's repo is the fact that he compiles all these programs already. If you have an x86_64 machine, then install from his x86_64 repo. This particularly nice for something like his DAW suite of software; it would take quite a while to compile all the parts manually. Same thing for his massive VLC build.

You should be leery of installing prebuilt packages from random places on the internet, but AlienBob has an excellent reputation and maintains an open dialog with users so I trust his packages (my opinion, of course).

Last edited by 0XBF; 11-19-2022 at 11:00 AM.
 
2 members found this post helpful.
Old 11-19-2022, 01:41 PM   #9
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
I am still using Gentoo and I can tell that hardware optimizations mattered more few years ago than they matter now. Compilers are just smarter so actual gains aren't as big as few years ago.
However unless all your boxes are almost identical optimization gain will be negligible.
Gentoo is very nice though and might be more popular this days if not for the hurdle with system installation (of course one can accept defaults but what's point of it?).

If you want speed then compile RT kernel. It will cut compile time 50% - 75% percent.
 
2 members found this post helpful.
Old 11-19-2022, 03:27 PM   #10
henca
Senior Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 1,009

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
Quote:
Originally Posted by rkelsen View Post
Any program compiled using Slackware64-15.0 will run on any other computer running Slackware64-15.0.
This is true for 99% of all software out there. However, some software, during the configuration step, might check the features of your current CPU and optimize its configuration against that CPU. Then you might end up with binaries requiring specific instructions like SSE4 or avx2 and end up with "illegal instruction" when trying to run on an older CPU lacking those instructions.

The architecture part of the Slackware package name (like i586 or x86_64) is not very specific when it comes to details about different generations of CPU architectures.

regards Henrik
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
suddenly vlc audio chunky. got sound then no sound then got sound then no sound.. andrewysk Linux - Newbie 4 04-21-2021 08:19 PM
Is it possible to install software, then burn it on CD, and then run it from the CD? Bronzu Linux - Software 8 02-06-2019 04:00 PM
Different configurations from the same home directory, is it possible? Blackened Justice Linux - Newbie 4 02-09-2012 05:03 PM
crontab once per week and once per month? qwertyjjj Linux - Newbie 3 12-15-2011 04:54 AM
Knoppix booted once, and only once... abowling Debian 7 02-29-2004 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration