Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet208/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   204   205   206   207   208   209   210   211   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

standard
to specify 
the standardized version desired, and 
–x
language
, where 
language
specifies which lan-
guage is included with the C code. For instance, it is possible to include Ada or FORTRAN 
code with your C source code.
To go along with this theme, there are a number of naming conventions used for file 
extensions. The .c and .cpp files stand for C and C
++
source codes, respectively. A .i or .ii 
file contains C and C
++
source codes that should not be preprocessed. The .m extension 
is used with objective-C source code. The .h and .o files are C/C
++
/Objective-C header 
and object files, respectively. And then there are extensions for FORTRAN source code, 
including .f, .for, and .ftn while .f90 and .f95 represent FORTRAN 90 and FORTRAN 95, 
respectively. Ada code is placed in .ads or .adb files. Assembly code is placed in .s or .S files.
As gcc is expected to compile very large files, compiler warnings can be crucial in dis-
covering potential problems or flaws with the source code. There are a great number of 
different warning options available. Each warning option is preceded by –W. These options 
include the aforementioned 
–Wall
which provides all warning options. Other more specific 
options include 
–Wcast-align

-Wfatal-errors

-Wno-overflow

-Wnonnull

-Wpointer-arith

-Wsign-conversion

-Wtype-limits

-Wunused-value

and 
–Wunused-variable
to mention but a few.
Similarly, there are a number of debugging options available. These are best explored by 
programmers who are looking for specific debugging assistance. Finally, gcc provides for a 
large number of optimization choices. These are specified using the –O options (-O, -O2, 


558

Linux with Operating System Concepts
-O3, 
-Os

-O0
). Aside from the general optimizations, you can also specify a machine-
dependent option to indicate the intended destination architecture. These include main-
frame computers produced by DEC, Intel-based architectures like i386 and x86-64, and 
ARM processors often found in handheld devices.
What follows are some example gcc operations and explanations.
• 
gcc -Wall hello.c –o helloworld
—compile the program hello.c into the 
executable helloworld using the –Wall warning option.
• 
gcc –Wall –O –mpower hello.c –o helloworld
—same as the first one 
but optimize for the Power PC processor.
• 
gcc –Wall hello1.c hello2.c hello3.c –o helloworld
—same as the 
first one but compiles the program stored in three different source code files.
• 
gcc –Wall –g hello.c –o helloworld
—same as the first one but include 
debugging help.
• 
gcc –Wall –I ../lib hello.c –o helloworld
—same as the first one 
except that hello.c uses #include statements whose libraries are stored in the directory 
lib located one level above the current directory.
• 
gcc –c hello.c –o hello.o
—same as the first but the output is an object file 
instead of an executable file. The object file can then be used as a library file for other 
C programs.
One last comment about gcc: There are alternate programs available that also compile C/
C
++
programs. First is 
g
++
, a variant of gcc, which will treat any C file as a C
++
file instead. 
Although it is a subtle difference, many C
++
programmers prefer to use g
++
as it is spe-
cifically tuned to compile C
++
rather than C. This is especially true if your C
++
program 
links to the standard libraries in C
++
(which gcc is not capable of handling). 
GNAT
is a ver-
sion of gcc which specifically will compile Ada programs. While gcc can handle multiple 
languages, GNAT is specific to Ada. There is also 
gdb
, the GNUs Debugger, which is not a 
replacement for gcc but an addition to gcc.
13.7 SOFTWARE MAINTENANCE
Once software is installed, the system administrator’s task is over, right? No, not really. 
Although the system administrator may not use the software, others will and because soft-
ware is often being revised over time, upgrades, updates, and patches need to be installed. 
Linux, like Windows, allows much of this software to be upgraded with little to no inter-
vention. In other cases, the system administrator might explicitly perform the upgrade.
13.7.1 Updating Software through rpm and yum
Updating software can be performed in much the same way as installation, through rpm or 
yum. If you wish to upgrade through rpm, you must obtain the RPM file. If you had deleted 


Software Installation and Maintenance

559
the RPM file after installation, you will have to download it anew from the repository. With 
the RPM file available, the command to upgrade the package is 
rpm –U packagename
or 
rpm –F packagename
. The –U is for upgrade, the –F is for freshen. As stated in 
Section 13.3, the only difference between upgrade and freshen occurs when you are install-
ing a new package. Freshen will not work if a package has not yet been installed whereas 
upgrade can be used to either install the first time or upgrade the installed package.
In addition, if you are upgrading/freshening an installed package, you can add fur-
ther options: --
replacepkgs
, --
replacefiles
, --
oldpackage
, and 
--force
. These 
options force the installation of a package during the upgrade even if that particular pack-
age already exists, force the installation of files that already exist, downgrade from the 
currently installed package to a previous one, and perform all three of them combined, 
respectively.
It is obviously easier to issue a yum command than an rpm command because you do 
not need to first have the RPM file available, nor do you have to worry about file dependen-
cies. The format to upgrade software with yum is
yum upgrade 

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   204   205   206   207   208   209   210   211   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish