[Dovecot] Compilation Issue on Old Boxes with macro in src/master/main.c
I'm throwing an error compiling with a custom-compiled gcc 3.2.3 on one box.
The configuration string is CC=/usr/local/gcc3.2.3/bin/gcc CPPFLAGS=-I/usr/local/ssl/include LDFLAGS=-L/usr/local/ssl/lib ./configure --with-ssl=openssl --with-ssldir=/usr/local/ssl/certs --with-pam --with-pop3d --sysconfdir=/etc --localstatedir=/var
I've used this to compile on other older boxes with success. And I compared the command lines and they are identical.
This is the error I get with src/master/main.c
main.c:365:1: directives may not be used inside a macro argument main.c:364:16: unterminated argument list invoking macro "printf" main.c: In function `print_build_options': main.c:372: syntax error before string constant
Changing the function to a simpler function without the ifdef's resolves the issue and dovecot compiles.
I would really like to know why two boxes with the same compiler are failing on one but not the other. Perhaps there's some program or library or preprocessor or path or something out of whack. Especially since using gcc 2.96 on the same box works!
However, I since this is a simple options output routine and (from my cursory read) there may be some standards issue with this technique, I've also patched the issue.
http://www.peregrinehw.com/downloads/dovecot/dovecot-1.1.11-build_options_ma...
Thoughts?
KAM
On Feb 26, 2009, at 9:34 AM, Kevin A. McGrail wrote:
main.c:365:1: directives may not be used inside a macro argument main.c:364:16: unterminated argument list invoking macro "printf"
printf is a macro in this system. I don't think that's normal (or even
allowed by the standard?).
I'll admit that I'm out of my league on this. It does compile with this change I made but I may not be within the standard for the same reason. Here's the items I was reading about the issue:
http://gcc.gnu.org/ml/gcc-patches/2002-02/msg01874.html
But to be clear, what I was trying to do was get rid of the building up of the output for the printf command:
i.e. printf("this" #ifdef something "this" #endif "\n");
And after applying the patch, I can compile and don't see any warnings. And build options still works:
./dovecot --build-options Build options: ioloop=poll notify=dnotify ipv6 openssl Mail storages: maildir mbox dbox cydir raw SQL drivers: Passdb: checkpassword pam passwd passwd-file shadow Userdb: nss passwd passwd-file prefetch static
Thoughts, KAM
printf is a macro in this system. I don't think that's normal (or even allowed by the standard?).
On Thu, 2009-02-26 at 10:29 -0500, Kevin A. McGrail wrote:
I'll admit that I'm out of my league on this. It does compile with this change I made but I may not be within the standard for the same reason.
It was standard.
Here's the items I was reading about the issue:
But printf() isn't normally a macro. I was also wondering if it was even allowed to be macro, i.e. if your system was completely broken. But looks like it's allowed, so Dovecot shouldn't do that..
Anyway, did a cleaner fix: http://hg.dovecot.org/dovecot-1.1/rev/2c7111b2b0d0
Timo,
Thanks, this patch works fine as well.
Regards, KAM ----- Original Message ----- From: "Timo Sirainen" <tss@iki.fi>
Anyway, did a cleaner fix: http://hg.dovecot.org/dovecot-1.1/rev/2c7111b2b0d0
participants (2)
-
Kevin A. McGrail
-
Timo Sirainen