(Answer) (Category) Linux on PowerPC FAQ-O-Matic : (Category) Languages and Compilers :
Why don't command line arguments work?
On my linuxppc machine (A 6400 running a 2.1.24 kernal) I found that, for programs I had compiled, argc and argv were always 0. This appears to be a known problem. The workaround is to compile with '-static' on the command line. The ultimate cause is (apparently) if various libraries do not agree. I do not know if this problem also affects MkLinux. To quote from Ian Piumarta (on the linux-pmac list):
arirabkin@geocities.com

----------------
Subject:     Re: Is Linux-pmac really that flaky?
Sent:        11/25/97 7:35 PM
Received:    11/26/97 9:38 AM
From:        Ian Piumarta, piumarta@prof.inria.fr
To:          Multiple recipients of list, linux-pmac@samba.anu.edu.au
-----------------
It could equally well be due to a too *new* version of [g]libc.  If the
stuff in /usr/lib/{crt,libc}* and /usr/lib/gcc-lib/<your-arch>/{specs,crt*}
doesn't agree then problems with argv and/or environ are likely symptoms.

        In general (unless you go to some trouble to setup gcc to cope with both
libc-5 and libc-6 [aka glibc2]) you must make absolutely sure that all of
the following RPMS (or the configs if you've compiled your own from
sources) are versions that agree on which particular libc is being used
(the correct versions are *NOT* necessarily the most recent ones!!):

        libc
        libc-devel
        binutils
        ld.so
        gcc

For libc[-devel]-5 you need binutils >= 2.7, ld.so-1, and a gcc that
reports *-*-linux-gnulibc1 with the "-v" option.  For libc[-devel]-6 you
need binutils-2.8, ld.so-2 (I think 1.9.5 is probably ok) and a gcc that
reports *-*-linux-gnu.  libc-devel should always have a minor version
matching the largest minor version of the libc(s) that is(are) installed.

A "volatile admixture" can easily be generated by combining stuff from
the release RPMS and those from the contrib/updates RPMS without careful
attention to which versions are compatible.

The situation w.r.t. [lib]g++ is similar.
arirabkin@geocities.com
[Append to This Answer]
Previous: (Answer) Where can I get PowerPC reference manuals?
Next: (Answer) I get an error about lcrypt while compiling apache...
This document is: http://www.jonh.net/cgi-bin/lppcfom/fom?file=355
[Search] [Appearance]
This is a Faq-O-Matic 2.717d.
Hosted by anduin.org and SourceForge Logo