SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to create slackware packages so I looked through some tutorials. The filename convention has some architecture included, such as i386, i486, etc. How do I find out what to put here?
Actually, it depends if you supplied parameters to obtain a CPU-specific optimization during the compilation of the program.
For instance, if you use a Pentium, but do not use any optimization, your final package should be able to run even on a 386. Therefore, you should use the CPU name 'i386' in your package name, such as 'foobar-1.0.142-i386-1.tgz'.
On the other hand, if you use CPU-specific optimization, this means that your package needs, at least the CPU you optimized for. So, if you compile on a Pentium with 486 optimization, the package will only work with a 486 or higher. Your package should now be named: 'foobar-1.0.142-i486-1.tgz'.
And so on and so forth with the Pentium (586), Pentium II (686), etc...
I ran these commands to compile, so I don't think I applied any optimizations. If I understand correctly, these commands would be for an i386 architecture or greater?
./configure --prefix=/usr --sysconfdir=/etc
make
make install prefix=/foo/usr
uname -m gives 'i686' on my machine. How do I optimize the compilation?
Some time ago it was here a topic concerning on compilation optimization. Generally, you have to set your CFLAGS and CXXFLAGS variables to proper values during ./configure (or set constantly in your /etc/profile). Try "search" to find thread mentioned above.
If I set -march=pentium4 and -mcpu=pentium4, will all programs be able to compile normally? Is there any case where I would need to set these to a lower value such as i686 or i386? I only plan on using the binaries on one machine and shouldn't need anything lower than pentium4.
Is there a way to tell which arch that any binary has been optimized for?
I don't know a way to tell with which optimisation and machine binary a program is compiled, but I guess with a good knowledge on many arch platform one can decompile program and when seeing the code (in assembly) he can get informations (but tedious work lol).
For my part (with an athlon CPU, I edited my ~/.bashrc file and added these lines :
My experience has been that if you leave those flags alone gcc will compile for the architecture the compiler is running on, by default, am I wrong in that assumption? Just going by what Ive seen.But you would have to set the flags to compile for something else.
but they aren't getting loaded, even after a restart, so I have to type them in manually. Only then does "echo $CFLAGS" and the others return anything.
After doing this, I tried compiling grub-0.94 but there's no difference in the files it creates. md5sum gives the same result on the files everytime. I even tried setting the above to i686 instead of pentium4, with no change.
Next I read a thread on optimizing binaries, and it recommended adding the -s option to the above lines to strip the binaries. That also did nothing to the output files.
I then downloaded all six gcc-3.3.4 packages from slackware-current and used pkgtool to remove those that came with the 9.1 iso (version 3.2.3?? I don't remember) then installed the new ones. Now I get this error when trying to compile:
root@slackbox:/usr/src/grub-0.94# ./configure --prefix=/usr --sysconfdir=/etc
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for C compiler default output... configure: error: C compiler
cannot create executables
See onfig.log' for more details
I got the compiler working again by getting the latest version of binutils from slackware-current, but the compiler flags aren't doing anything. They won't even load on startup from ~/.bashrc.
I compiled without any flags, then with -march=pentium4 and -mcpu=pentium4, then I compiled with those flags plus -O2, which should make some difference, but the ELF binaries are exactly the same.
Is the syntax correct? Does the .bashrc file need any special permissions?
keefaz, what is the significance of the CHOST="i686-pc-linux-gnu" line? What does it do, and could I have something such as CHOST="pentium4-pc-linux-gnu"? Would that produce some optimization for the P4?
Sorry for all of the questions, I'm just a noob with a lot of experience
I looked over the config.log file and some lines stand out:
I noticed you don't set your CFLAGS like me (you don't put the parameter -O2, O like Optimize not 0 like 0+0=0, this parameter enable optimisation level 2)
I did compile grub 0.94 but from a RPM source from redhat, the reason ? It comport patch to suit 2.6 kernel and add graphical splashscreen as boot.
-I downoaded grub-0.94.src.rpm
-I installed rpm package for slackware
-I installed the grub rpm (rpm -ivh grub-0.94.src.rpm --no-deps )
- I cd /usr/src/rpm/SPECS
- rpmbuild -bc grub.spec
- cd ../BUILD/
- cd grub-0.94/
- make install
I read a thread on .bashrc, it seems that it doesn't load in the virtual terminals. So then I moved the stuff I added to .bashrc to /etc/profile. Now it loaded.
and more stupidity...
Before I moved the settings to /etc/profile, I was typing the export CFLAGS=... in one terminal, then moving to another one to compile, so my settings didn't carry over. I didn't even think about that.
I'll play around with the optimization -O2, -O3,-Os settings to see what's best. Thanks for all the help.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.