LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-17-2004, 05:33 PM   #1
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Rep: Reputation: 49
architecture for slackware package?


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?
 
Old 06-17-2004, 05:39 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
I don't understand...

You would put whatever the package was compiled on. If you did it on i386, then you would put that, etc.
 
Old 06-17-2004, 06:31 PM   #3
Noryungi
Member
 
Registered: Jul 2003
Location: --> X <-- You are here.
Distribution: Slackware, OpenBSD
Posts: 305

Rep: Reputation: 53
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...

Hope this helps!
 
Old 06-17-2004, 11:18 PM   #4
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 49
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?
 
Old 06-18-2004, 03:44 AM   #5
Waldi
Member
 
Registered: Apr 2003
Location: Warsaw, Poland
Distribution: Slackware current
Posts: 133

Rep: Reputation: 15
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.

Last edited by Waldi; 06-18-2004 at 03:46 AM.
 
Old 06-18-2004, 04:05 AM   #6
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 49
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?

Thanks for all the help.
 
Old 06-18-2004, 07:17 AM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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 :
Code:
CFLAGS="-O2 -march=athlon -mcpu=athlon -pipe"
CXXFLAGS="$CFLAGS"
CHOST="i686-pc-linux-gnu"
export CFLAGS CXXFLAGS CHOST
so it did the optimisation automatically for each compile. You have to change CFLAGS to suit your system if (like me) you find this settings usefull.
 
Old 06-18-2004, 08:16 AM   #8
horndude
Member
 
Registered: Sep 2003
Posts: 43

Rep: Reputation: 15
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.
 
Old 06-18-2004, 03:37 PM   #9
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 49
Now I'm starting to have problems.

First I added these lines to ~/.bashrc

export CXXFLAGS="-march=pentium4 -mcpu=pentium4"
export CPPFLAGS="-march=pentium4 -mcpu=pentium4"
export CFLAGS="-march=pentium4 -mcpu=pentium4"

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

Help!

Last edited by elyk; 06-18-2004 at 03:39 PM.
 
Old 06-18-2004, 07:38 PM   #10
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 49
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:
Code:
## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_build_alias=i686-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_header_curses_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_ncurses_curses_h=yes
ac_cv_header_ncurses_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_host=i686-pc-linux-gnu
ac_cv_host_alias=i686-pc-linux-gnu
ac_cv_lib_ncurses_wgetch=yes
ac_cv_lib_util_opendisk=no
ac_cv_objext=o
ac_cv_path_install='/usr/bin/ginstall -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_CPP='gcc -E'
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_ac_ct_OBJCOPY=objcopy
ac_cv_prog_ac_ct_RANLIB=ranlib
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_egrep='grep -E'
ac_cv_prog_make_make_set=yes
am_cv_CC_dependencies_compiler_type=gcc3
grub_cv_asm_absolute_without_asterisk=no
grub_cv_asm_addr32=yes
grub_cv_asm_prefix_requirement=yes
grub_cv_asm_uscore=no
grub_cv_check_edata_symbol=yes
grub_cv_check_end_symbol=yes
grub_cv_check_start_symbol=no
grub_cv_check_uscore_edata_symbol=yes
grub_cv_check_uscore_end_symbol=yes
grub_cv_check_uscore_start_symbol=yes
grub_cv_check_uscore_uscore_bss_start_symbol=yes
grub_cv_prog_objcopy_absolute=yes
It appears that the flags aren't getting recognized.

Code:
## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /usr/src/grub-0.94/missing --run aclocal-1.7'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /usr/src/grub-0.94/missing --run tar'
AUTOCONF='${SHELL} /usr/src/grub-0.94/missing --run autoconf'
AUTOHEADER='${SHELL} /usr/src/grub-0.94/missing --run autoheader'
AUTOMAKE='${SHELL} /usr/src/grub-0.94/missing --run automake-1.7'
AWK='gawk'
BUILD_EXAMPLE_KERNEL_FALSE=''
BUILD_EXAMPLE_KERNEL_TRUE='#'
CC='gcc'
CCAS='gcc'
CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
CCDEPMODE='depmode=gcc3'
CFLAGS='  -g'
CPP='gcc -E'
CPPFLAGS=' -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef'
CYGPATH_W='echo'
DEFS='-DHAVE_CONFIG_H'
DEPDIR='.deps'
DISKLESS_SUPPORT_FALSE=''
DISKLESS_SUPPORT_TRUE='#'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
FSYS_CFLAGS=' -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1'
GRUB_CFLAGS='-O2'
GRUB_LIBS=' -lncurses'
HERCULES_SUPPORT_FALSE='#'
HERCULES_SUPPORT_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${SHELL} /usr/src/grub-0.94/missing --run makeinfo'
NETBOOT_DRIVERS=''
NETBOOT_SUPPORT_FALSE=''
NETBOOT_SUPPORT_TRUE='#'
NET_CFLAGS=''
NET_EXTRAFLAGS=' -DCONGESTED=1 -DNE_SCAN=0x280,0x300,0x320,0x340 -DWD_DEFAULT_MEM=0xCC000'
OBJCOPY='objcopy'
OBJEXT='o'
PACKAGE='grub'
PACKAGE_BUGREPORT='bug-grub@gnu.org'
PACKAGE_NAME='GRUB'
PACKAGE_STRING='GRUB 0.94'
PACKAGE_TARNAME='grub'
PACKAGE_VERSION='0.94'
PATH_SEPARATOR=':'
PERL=''
RANLIB='ranlib'
SERIAL_SPEED_SIMULATION_FALSE=''
SERIAL_SPEED_SIMULATION_TRUE='#'
SERIAL_SUPPORT_FALSE='#'
SERIAL_SUPPORT_TRUE=''
SET_MAKE=''
SHELL='/bin/sh'
STAGE1_CFLAGS='-O2'
STAGE2_CFLAGS='-Os'
STRIP=''
VERSION='0.94'
ac_ct_CC='gcc'
ac_ct_OBJCOPY='objcopy'
ac_ct_RANLIB='ranlib'
ac_ct_STRIP=''
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__include='include'
am__quote=''
bindir='${exec_prefix}/bin'
build='i686-pc-linux-gnu'
build_alias=''
build_cpu='i686'
build_os='linux-gnu'
build_vendor='pc'
datadir='${prefix}/share'
exec_prefix='${prefix}'
host='i686-pc-linux-gnu'
host_alias=''
host_cpu='i386'
host_os='linux-gnu'
host_vendor='pc'
includedir='${prefix}/include'
infodir='${prefix}/info'
install_sh='/usr/src/grub-0.94/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='/usr'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='/etc'
target_alias=''
Again, I'm confused where it's getting these values for i386 and i686, and I'm wondering if they may cause the binaries to be suboptimal for the P4.
 
Old 06-19-2004, 07:38 AM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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
 
Old 06-19-2004, 04:21 PM   #12
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 49
stupid, stupid...

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.
 
  


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
How to compile Slackware 10.1 packages for the 64-bit Architecture? Basel Slackware 14 07-27-2005 04:28 AM
slackware 7.1 package n8 JunctaJuvant Slackware 5 07-18-2005 12:00 PM
first slackware package Rognon Slackware 2 10-14-2004 10:15 PM
Slackware Package???? epihammer Slackware 13 07-03-2004 09:24 AM
Slackware 9 Package help Tech1 Slackware 2 05-07-2003 11:37 PM

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

All times are GMT -5. The time now is 10:53 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