[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

[Openvpn-users] Re: OpenVPN 1.1.0 compilation issue


  • Subject: [Openvpn-users] Re: OpenVPN 1.1.0 compilation issue
  • From: "James Yonan" <jim@xxxxxxxx>
  • Date: Thu, 11 Apr 2002 14:22:33 -0600

>         First, congratulations for the excelent OpenVPN software.
> OpenVPN is much better and much easier to use than Freeswan and
> other alternatives. Thank you!
>
> Linux 2.4.18, gcc 3.0.3, bison 1.35 and all the latest versions of
programs
> needed for proper compilation.
>
>
gcc -DHAVE_CONFIG_H -I. -I. -I.     -O3 -march=k6 -mcpu=k6 -ffast-math -funr
oll-loops -fforce-mem -fforce-addr -malign-double -
> fno-exceptions -c `test -f openvpn.c || echo './'`openvpn.c
> openvpn.c:358:1: directives may not be used inside a macro argument
> openvpn.c:358:1: unterminated argument list invoking macro "printf"
> openvpn.c: In function `usage':
> openvpn.c:368: parse error before ')' token
> make[1]: *** [openvpn.o] Error 1
> make[1]: Leaving directory `/home/fraga/src/openvpn-1.1.0'
> make: *** [all] Error 2
>
>         The problem is here:
>
> static void
> usage ()
> {
>   struct options o;
>   init_options (&o);
>   printf (usage_message,
>       TITLE,
>       o.local_port,
>       o.remote_port,
>       o.tun_mtu,
>       o.verbosity
> /*#ifdef USE_CRYPTO*/
>       , o.authname, o.ciphername
> /*#ifdef USE_SSL*/
>       ,
>       o.tls_timeout,
>       o.renegotiate_seconds,
>       o.handshake_window,
>       o.transition_window
> /*#endif
> #endif*/
>     );
>   exit (1);
> }
>
>         As you noticed, I put the /* and */ comments to avoid this
> compilation problem. Of course this isn´t a solution at all. I´m
> not very good at C, but I think the #ifded/#endif or commas should be
changed
> so the parser won´t misinterpret the code.
>
>         Well, just a small problem. If you suspect that this is
> in fact a problem with my parser, please point where I can fix it.
>
>         Thank you very much!

Thanks, I'm glad you like OpenVPN.

I think the compiler error is happening because for some strange reason,
your gcc environment is defining printf as a macro.  Normally printf is
defined as a library function.  For example, in my stdio.h:

/* Write formatted output to stdout.  */
extern int printf (__const char *__restrict __format, ...) __THROW;

In this situation, the OpenVPN code for usage() is completely legal.  But on
the other hand if printf is defined as:

#define printf(args...)  something

Then the #ifdefs for the CRYPTO and SSL library will break the compile if
the C preprocessor doesn't like #ifdefs inside of macro arguments.

I've never seen this particular error before -- if you send me your
/usr/include/stdio.h file I will take a look at it.

The clean solution is probably to have several different complete printf
calls in the usage() function, depending on CRYPTO or SSL state.

James



_______________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users