APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > News Posts > gcc compiling tips ––>Re: gcc compiling notes
Printer Friendly Version




News Group Posts

gcc compiling tips


This is good general advice on code porting.

I would add a few things. First, you may not need to port - the Linux abi may allow you to run your program without porting. However, there still may be hard paths and references to non-existent programs (or worse, references to programs that exist but have different function!)

I'd recommend reading Advanced Programming in the Unix Environment and be aware that "make" files that say they provide support for your target OS may be a good natured guess by someone trying to be helpful - they may never have actually compiled on that system!




From: smallshaw@cs.man.ac.uk (Andrew Smallshaw)
Newsgroups: comp.unix.sco.misc
Subject: Re: gcc compiling notes
Date: 24 Sep 1999 14:51:25 GMT
Message-ID: <slrn7un3v9.8uh.smallshaw@ug029.cs.man.ac.uk> 
NNTP-Posting-User: smallsa7

On Fri, 24 Sep 1999 01:00:30 -0400, Brian K. White wrote:
> Is there a repository of porting/compiling notes for compiling various
> free apps on OS 5.0.5 using gcc?

> I didn't include detailed make error messages because I'm not really
> looking for help with libjpeg. I'm looking for help with 'stuff' the
> general points to see to in any random makefile for super whiz-bang gnu
> app XXXX

When it comes to porting, it's helpful to know APIs of various Unix systems 
inside out and back to front, but the best way of doing this is probably by 
porting.  It appears you want general pointers on porting so a few tips:

1)  Link errors

    If you successfully compile an application but get errors on linking,
    do a 'man function-name' for the missing function.  In the syntax section,
    you'll see a line 'cc ... -l(library)'.  You need to add the -l bit to
    get the required library linked in.

2)  Apparently missing functions 

    It's possible that what is needed is there, but defined in a place
    other than where the program expects it.  'man function-name' will
    tell you what headers you need to pick up the function declaration.

3)  Apparently missing #defines and/or variables

    Again, these may be present, but in a non-standard location.  Try 
    searching scohelp for the term you're looking for, and include
    the relevant headers.  Alternatively you can find and grep on 
    /usr/include, /usr/local/include, etc.

4)  Really missing functions, #defines, or variables

    These fall into two categories: those that are included in other Unix 
    systems, and those that belong to third party libraries.

    Third party libraries first: find out which library you need, get it
    and port that.  This can get a bit demoralising when you have to port
    several libraries before you can get on with what you're trying to do.

    Other systems: read up on what the function in question does (most
    Unixes have on-line docs somewhere on the net), and assess how tricky
    it will be to implement.  Some times you can create a simple wrapper
    around facilities you do have, or you may have to re-write the 
    problematic code to use your system's facilities.

5)  #ifdefs

    These are your friends.  You may have done a './configure', but the 
    #defines still may not be quite right.  Look around the problematic
    code and see if there are any #ifdefs that look like they could solve
    your problem.  If so this is likely to prove the path of least 
    resistance.

This isn't exhaustive, of course.  Feel free to add extra points here.  

-- 
Andrew Smallshaw
smallshaw@cs.man.ac.uk












From - Mon Jun 19 06:30:17 2000
From: Frank Langelage <langel@st-oneline.de>
Newsgroups: comp.unix.sco.misc
Subject: Re: [Question] about my LINK errors
Date: Sun, 18 Jun 2000 21:40:56 +0200
Message-ID: <394D25C8.EA6A3556@st-oneline.de> 
References: <394dea19.0@news.nownuri.net> 
X-Server-Date: 18 Jun 2000 19:46:31 GMT

The order the libraries are named for the link command is wrong.
-lm is behind lgasrfeat.a.
You can add -lm at the and a second time or put your own libraries in front of
the system libs.
        cc voice.o process.o ifunc.o util.o msg_q.o vms.o vms_sub.o ars1.o
ars2.o v_ad.o vms_util.o paramete.o sctools.o guide.o ipc_ex.o faxutil.o fax.o
q_call.o log.o lgasrfeat.a -ldti -ldxxx -lsrl -lm -lfax -lcurses -lsocket -lc
-lgthreads /usr/lib/libgthreads.a -o voice



From - Tue Jun 20 17:58:11 2000
From: jls@sco.com (J. L. Schilling)
Newsgroups: comp.unix.sco.misc,comp.unix.sco.programmer
Subject: Re: warning: #ident is an extension of ANSI C
Followup-To: comp.unix.sco.misc,comp.unix.sco.programmer
Date: 20 Jun 2000 20:15:08 GMT
Message-ID: <8iojcc$nfl$1@hobbes.sco.com> 
References: <8io2rt$3ai$0@pita.alt.net> 

Jeff Dickens (jdickens@ersi.com.nospam) wrote:

: Recently we moved to version 5.0.5.  Now we get warnings like this:

: "/usr/include/stdlib.h", line 226: warning: #ident is an extension of ANSI C

: [...]

This is a "feature" of the cc -w3 option (highest level warnings).
#ident is indeed not part of strict ANSI C, although warning you about
things inside system headers (which you have no control over) is 
admittedly not very practical.

To eliminate these warnings, use cc -w2 or less.

--
Jonathan Schilling              SCO, Inc.               jls@sco.com


If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

Comments?




More Articles by



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide


 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - Compiler
       - Conversion
       - Linux
       - Programming
       - SCO_OSR5




Unix/Linux Consultants

Skills Tests

Guest Post Here