cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Error Compiling Curl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 11 Mar 2002 08:54:44 +0100 (MET)

On Fri, 8 Mar 2002, Victor wrote:

> > Why don't your include files have a strdup() prototype? That seems very
> > strange. My Solaris man page says it is in string.h, and my Solaris
> > compiles never complain on this (and I always build with a lot stricter
> > compiler flags than you did here).
>
> Hmm, here is the stuff from /usr/include/string.h
>
>
> #if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
> !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
> defined(_XPG4_2)
> extern char *strdup(const char *);
> #endif
>
> ...
>
> #if defined(__EXTENSIONS__) || \
> !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
> defined(_XPG4_2)
> extern char *strdup();
> #endif
>
> That's what I have in /usr/include/string.h
> Is this what you have on your Solaris 8 Box?

I'm sitting on a Solaris 2.7 box, so there are differences to expect. But
yes, my machine has those *exact* #if conditions around the strdup()
prototypes.

The difference is thus not exactly there, but for some reason you don't get
those defines set properly, as I evidently do.

I wish I could tell you why... :-/

> > > formdata.c: In function `curl_formadd':
> > > formdata.c:924: `__builtin_va_alist' undeclared (first use in this
> > > function)
> >
> > Another issue. This is supposed to not happen when we include <stdarg.h>,
> > as that should make the va_* functions "just work".
>
> in /usr/include/stdarg.h
>
> /*
> * Allow global visibility for symbols defined in
> * C++ "std" namespace in <iso/stdarg_iso.h>.
> */
> #if __cplusplus >= 199711L
> using std::va_list;
> #endif

Well, can you compile *any* program that's using va_list stuff and that
includes stdarg.h? I can't see how the curl code is written in any
particularly bad way to make this happen for you. After all, this code works
on sooo many platforms.

BTW, isn't the stdarg.h file read from the gcc-specific include path? I found
a stdarg.h here:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.0.3/include/stdarg.h (I'm a gcc
3.0.3 user.)

So if you write a tiny C program that uses va_list, does it work? And if it
does work, what includes do you then use?

> What stricter compiler flags do you use?

Run './configure --enable-debug' in the curl dir and you'll get them too.
They (the stricter options) are mainly meant to alert me and other developers
when writing code.

> Also, what are your compiler settings?

$ cd src
$ rm main.o
$ make
make all-am
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DHAVE_CONFIG_H -I../include -I../src -I../src -DMALLOCDEBUG
-I/home/dast/athena/include -I/usr/local/ssl/include/openssl
-I/usr/local/ssl/include -W -Wall -Wwrite-strings -pedantic -Wundef
-Wpointer-arith -Wcast-align -Wnested-externs -g -c `test -f main.c || echo
'./'`main.c

> Do you define special LDFLAGS or CPPFLAGS or CFLAGS ?

Nope. configure finds everything for me.

> My compiler is gcc 3.0.4 that I compiled myself (using gcc 2.95.3) and is
> set up with SUN's ld and as. It worked fine for BerkeleyDB4, OpenSSH,
> OpenSSL, Postfix, and other software. I am not using any GNU binutil
> software, do you think it could be related to that?

I don't know, but I too uses Sun versions of ld and as etc and I built gcc
3.0.3 myself...

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-11