SUMMARY: Problem compiling a shareware on Solaris 2.5.1 (compile issue)

From: Melissa Young <thesunlover2002_at_yahoo.com>
Date: Mon Aug 04 2003 - 15:18:56 EDT
Hi,
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@babbage.cs.umsl.edu>
"Casper Dik" <Casper.Dik@Sun.COM>
"Simon Burr" <simes@bpfh.net> Wrote:
"Rich Teer" <rich.teer@rite-group.com>
"Moore, Bryan (Scripps)" <lbmoore@scrippsops.com>
"Hendrik Visage" <hvisage@is.co.za>
"Ozgur C. Demir" <ocd@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
standard].
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
version.

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@yahoo.com> wrote:
> Hi,
> 
> I am trying to compile rssh on this Solaris 2.5
> system
> -- 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
> summarise
> 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
> -DPATH_RSSH_CONFIG=\"/usr/local/etc/rssh.conf\"
>
-DPATH_CHROOT_HELPER=\"/usr/local/libexec/rssh_chroot_helper\"
> -g -O2   main.c
> gcc  -g -O2   -o rssh  rsshconf.o log.o util.o
> main.o 
> -lgen
> 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
http://sitebuilder.yahoo.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Aug 4 15:22:51 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:17 EST