SUMMARY: Problem compiling a shareware on Solaris 2.5.1 (compile issue)
thesunlover2002 at yahoo.com
Mon Aug 4 15:18:56 EDT 2003
Michael Schulte's message gave me the best
inspiration. I edited the files 'main.c' and 'log.c'
to replace all 'snprintf' and 'vsnprintf' with
something else such as fprint. In other words, I
disabled the calls to the two unexisting functions
'snprintf' and 'vsnprintf'. Then it works. I compiled
the program without getting other error messages.
Michael has the full credit.
Enclosed are some major answers.
Many thanks to:
"Michael Schulte" <mike at babbage.cs.umsl.edu>
"Casper Dik" <Casper.Dik at Sun.COM>
"Simon Burr" <simes at bpfh.net> Wrote:
"Rich Teer" <rich.teer at rite-group.com>
"Moore, Bryan (Scripps)" <lbmoore at scrippsops.com>
"Hendrik Visage" <hvisage at is.co.za>
"Ozgur C. Demir" <ocd at mushrappa.org>
Michael Schulte wrote:
It says: you used the function 'snprintf' in the file
main.c and the function 'vsnprintf' in the file log.c.
I can not find the definitions for these functions in
any of the libraries [in particular, in libc.a]. It
exists in Solaris 2.6, but I don't have a machine
running 2.5. It is possible (quite possible) that the
functions are not implemented in Solaris 2.5 [I am
pretty sure that they are relatively new to the C
The best solution is to upgrade the OS. As a temporary
fix (at some loss of security, i.e. you may get buffer
overruns) you could change the calls to both functions
to drop the 1st letter 'n' in the name and drop the
2nd argument in the parameter lists. [The 2nd argument
is the size of the string named in the first
argument.][I.e. change snprintf (xxx, 3, "format",
...) to sprintf (xxx, "format", ...) and vsnprintf
(xxx, 3, "format", ...) to vsprintf (xxx, "format",
Casper Dik wrote:
Solaris 2.5 predates the addition of
snprintf()/vsnprintf() to Solaris; it was first a
first class interface in Solaris 2.6.
There are __[v]snprintf() varients in patches Solaris
2.5 C libraries, but those versions behave slightly
different from the generally expectde behaviour and
also make that your code would not run on Solaris 2.6.
If at all possible, I'd suggest upgrading to a later
Simon Burr wrote:
If you get the latest version of Apache (1.3.28) from
http://httpd.apache.org/ you'll find a file called
apache_1.3.28/src/ap/ap_snprintf.c you can use this to
provide you with an snprintf(). Although I should note
that it'll need some work to get it to build outside
of an Apache dist.
You may want to look at
<http://www.ijs.si/software/snprintf/> which is a
portable version of snprintf() and its friends.
As to how you include it into the build of rssh -
you'll have to play with Makefiles et al to do this.
For example with the snprintf() above you should be
able to place the generated snprintf.o and its header
files into the rssh directory and update the rssh
Makefile to include the snprintf.o file.
Easy - Solaris 2.5 doesn't have the snprintf()
function; you'll have to pull one from another bit of
code (ie Apache has one in their AP library) to get
this to work.
--- Melissa Young <thesunlover2002 at yahoo.com> wrote:
> I am trying to compile rssh on this Solaris 2.5
> -- yes, Solaris 2.5 :(
> I got the following error message, and don't quite
> understand what it means and how to solve it. It
> should be a library problem.
> Anyone can give me a hint? Thank you!!(will
> if get the right answer)
> Melissa Young
> System Admin
> server:/temp/rssh/rssh-2.1.1# make
> make all-am
> gcc -c -DHAVE_CONFIG_H
> -g -O2 main.c
> gcc -g -O2 -o rssh rsshconf.o log.o util.o
> Undefined first referenced
> symbol in file
> snprintf main.o
> vsnprintf log.o
> ld: fatal: Symbol referencing errors. No output
> written to rssh
> collect2: ld returned 1 exit status
> *** Error code 1
> make: Fatal error: Command failed for target `rssh'
> Current working directory /temp/rssh/rssh-2.1.1
> *** Error code 1
> make: Fatal error: Command failed for target `all'
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
sunmanagers mailing list
sunmanagers at sunmanagers.org
More information about the summaries