[opensuse-packaging] error: invalid conversion from 'const char*' to 'char*'
Hi, in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*' It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int) Details are at http://udrepper.livejournal.com/20948.html -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Hi Martin, On Monday 01 June 2009 07:40:56 Martin Vidner wrote:
in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*'
It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int)
I am not that well familiar with C++ and maybe an example would work better : If I have the following statement char *pp = strchr(str, ';'); (str is a const char), then this one fails with the above error. But would the following statement be the right correction : const char *pp = strchr(str, ';'); Thanks Raymond -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Jun 01, 2009 at 10:53:13AM +0200, Raymond Wooninck wrote:
On Monday 01 June 2009 07:40:56 Martin Vidner wrote:
we have char *strchr(char *, int) const char *strchr(const char *, int)
I am not that well familiar with C++ and maybe an example would work better :
If I have the following statement
char *pp = strchr(str, ';');
(str is a const char), then this one fails with the above error. But would the following statement be the right correction :
const char *pp = strchr(str, ';');
That is right. Except for the case when you then modify the string through pp. (The compiler would give you another error) I actually had a case where I put a NUL byte at pp and then the original character back, so I used char *pp = (char *) strchr(str, ';'); See here for the actual code: http://svn.opensuse.org/viewvc/yast/trunk/core/libycp/src/StaticDeclaration.cc?annotate=57367&pathrev=57367#l276 -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, 1 Jun 2009 12:24:06 +0200, you wrote:
char *pp = (char *) strchr(str, ';');
char *pp = const_cast
Hi, On Mon, 1 Jun 2009, Martin Vidner wrote:
const char *pp = strchr(str, ';');
That is right.
Except for the case when you then modify the string through pp. (The compiler would give you another error) I actually had a case where I put a NUL byte at pp and then the original character back, so I used char *pp = (char *) strchr(str, ';'); See here for the actual code: http://svn.opensuse.org/viewvc/yast/trunk/core/libycp/src/StaticDeclaration.cc?annotate=57367&pathrev=57367#l276
But then it's already questionable to have the incoming string be a "const char *", as you modify it. IMO for this it's better to cast away the constness on the argument (maybe even using a temporary) than on the function result, as a matter of style. It seems to me more explicit of the intent ("yes I know, this is a const string, but I also know that in fact it's not read-only memory, so for speed purposes let's make it 'writable' for a short time"). Ciao, Michael. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Am Montag 01 Juni 2009 schrieb Martin Vidner:
Hi,
in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*'
It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int)
Details are at http://udrepper.livejournal.com/20948.html
Thanks Martin for the pointer. The fallout of this is pretty large so I'm asking anyone with a failure to fix packages - the change is done easily done and we need to get the current rate of failures down before we can integrate more things. A lot of fixed packages are already waiting to be accepted, thanks for that. But I'm afraid a lot is left to do ;( Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Tue, Jun 02, 2009 at 11:32:34AM +0200, Stephan Kulow wrote:
Am Montag 01 Juni 2009 schrieb Martin Vidner:
Hi,
in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*'
It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int)
Details are at http://udrepper.livejournal.com/20948.html
Thanks Martin for the pointer. The fallout of this is pretty large so I'm asking anyone with a failure to fix packages - the change is done easily done and we need to get the current rate of failures down before we can integrate more things.
A lot of fixed packages are already waiting to be accepted, thanks for that. But I'm afraid a lot is left to do ;(
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed. -- Petr "Pasky" Baudis The lyf so short, the craft so long to lerne. -- Chaucer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Fri, Jun 05, 2009 at 02:42:31AM +0200, Petr Baudis wrote:
On Tue, Jun 02, 2009 at 11:32:34AM +0200, Stephan Kulow wrote:
Am Montag 01 Juni 2009 schrieb Martin Vidner:
Hi,
in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*'
It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int)
Details are at http://udrepper.livejournal.com/20948.html
Thanks Martin for the pointer. The fallout of this is pretty large so I'm asking anyone with a failure to fix packages - the change is done easily done and we need to get the current rate of failures down before we can integrate more things.
A lot of fixed packages are already waiting to be accepted, thanks for that. But I'm afraid a lot is left to do ;(
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
If it fixes getline() it will get 17 more packages fixed: grep -il error.*getline *|wc -l 17 Ciao, Marcus -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Fri, Jun 05, 2009 at 11:13:06AM +0200, Marcus Meissner wrote:
On Fri, Jun 05, 2009 at 02:42:31AM +0200, Petr Baudis wrote:
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
If it fixes getline() it will get 17 more packages fixed:
grep -il error.*getline *|wc -l 17
What do you mean by "fixing getline()"? -- Petr "Pasky" Baudis The lyf so short, the craft so long to lerne. -- Chaucer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Am Freitag 05 Juni 2009 schrieb Petr Baudis:
On Fri, Jun 05, 2009 at 11:13:06AM +0200, Marcus Meissner wrote:
On Fri, Jun 05, 2009 at 02:42:31AM +0200, Petr Baudis wrote:
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
If it fixes getline() it will get 17 more packages fixed:
grep -il error.*getline *|wc -l 17
What do you mean by "fixing getline()"?
Werner and me found a neat work around for the "getline problem" - which translates to "getline was added to POSIX2008 and glibc defaulting to it, as such breaking valid pre-2008 code": add -D_POSIX_C_SOURCE=200803L -D_XOPEN_SOURCE=600 to your CFLAGS Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Friday 05 June 2009 11:13:06 Marcus Meissner wrote:
On Fri, Jun 05, 2009 at 02:42:31AM +0200, Petr Baudis wrote:
On Tue, Jun 02, 2009 at 11:32:34AM +0200, Stephan Kulow wrote:
Am Montag 01 Juni 2009 schrieb Martin Vidner:
Hi,
in case you wonder why your C++ package build started to fail with error: invalid conversion from 'const char*' to 'char*'
It's because glibc-2.10 has been checked in which contains stricter prototypes for some functions. Instead of the C prototype char *strchr(const char *, int) we have char *strchr(char *, int) const char *strchr(const char *, int)
Details are at http://udrepper.livejournal.com/20948.html
Thanks Martin for the pointer. The fallout of this is pretty large so I'm asking anyone with a failure to fix packages - the change is done easily done and we need to get the current rate of failures down before we can integrate more things.
A lot of fixed packages are already waiting to be accepted, thanks for that. But I'm afraid a lot is left to do ;(
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
If it fixes getline() it will get 17 more packages fixed:
Adding a getline prototype is actually a fix not a bug, see the link Martin posted. What worries me much more are the random crashes we see all around, I count 25 of those and they weren't there before the update. What worries me most is I could not reproduce them with osc build, but they are not bound to a specific build host - and according to bug 509398, valgrind "hides" them. So I'm wondering if we shouldn't back out of glibc 2.10 for the moment, then again this might be a small fallout you don't notice normally and only in Xen guests with n cpus - as in the build service, after all glibc 2.10 changed the malloc pools pretty drastically (according to drepper's words). Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Stephan Kulow schrieb:
What worries me much more are the random crashes we see all around, I count 25 of those and they weren't there before the update. What worries me most is I could not reproduce them with osc build, but they are not bound to a specific build host - and according to bug 509398, valgrind "hides" them.
So I'm wondering if we shouldn't back out of glibc 2.10 for the moment, then again this might be a small fallout you don't notice normally and only in Xen guests with n cpus - as in the build service, after all glibc 2.10 changed the malloc pools pretty drastically (according to drepper's words).
For the crashes which impair my package in that case I can reproduce locally (osc build) w/o Xen at least. I have 4 CPUs though which could make a difference. Wolfgang -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Stephan Kulow wrote:
On Friday 05 June 2009 11:13:06 Marcus Meissner wrote: [..]
If it fixes getline() it will get 17 more packages fixed:
Adding a getline prototype is actually a fix not a bug, see the link Martin posted.
What worries me much more are the random crashes we see all around, I count 25 of those and they weren't there before the update. What worries me most is I could not reproduce them with osc build,
openldap2 fails pretty reliably in the test suite currently and it is reprodcuable with a local osc build as well. At least on x86_64 (haven't tried anything else yet).
but they are not bound to a specific build host - and according to bug 509398, valgrind "hides" them.
So I'm wondering if we shouldn't back out of glibc 2.10 for the moment, then again this might be a small fallout you don't notice normally and only in Xen guests with n cpus - as in the build service, after all glibc 2.10 changed the malloc pools pretty drastically (according to drepper's words).
-- regards, Ralf -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Am Montag 08 Juni 2009 schrieb Ralf Haferkamp:
Stephan Kulow wrote:
On Friday 05 June 2009 11:13:06 Marcus Meissner wrote:
[..]
If it fixes getline() it will get 17 more packages fixed:
Adding a getline prototype is actually a fix not a bug, see the link Martin posted.
What worries me much more are the random crashes we see all around, I count 25 of those and they weren't there before the update. What worries me most is I could not reproduce them with osc build,
openldap2 fails pretty reliably in the test suite currently and it is reprodcuable with a local osc build as well. At least on x86_64 (haven't tried anything else yet).
How many cores do you have? Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Am Montag 08 Juni 2009 11:47:04 schrieb Stephan Kulow:
Am Montag 08 Juni 2009 schrieb Ralf Haferkamp:
Stephan Kulow wrote:
On Friday 05 June 2009 11:13:06 Marcus Meissner wrote:
[..]
If it fixes getline() it will get 17 more packages fixed:
Adding a getline prototype is actually a fix not a bug, see the link Martin posted.
What worries me much more are the random crashes we see all around, I count 25 of those and they weren't there before the update. What worries me most is I could not reproduce them with osc build,
openldap2 fails pretty reliably in the test suite currently and it is reprodcuable with a local osc build as well. At least on x86_64 (haven't tried anything else yet).
How many cores do you have? Two. It's an Athlon X2 CPU.
-- regards, Ralf -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Friday 05 June 2009 02:42:31 Petr Baudis wrote:
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
I still would like to see a "porting guide" for the applications failing to build. Many of our packages do not see updates so often that a new glibc has any impact upstream. I see errors like this (random picks): error: 'struct hostent' has no member named 'h_addr' sys/syslog.h:88: error: 'NULL' undeclared here (not in a function) error: 'INT_MAX' undeclared (first use in this function) Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Le vendredi 05 juin 2009, à 02:42 +0200, Petr Baudis a écrit :
By the way, I just created a sr for another glibc update that might induce some build failures - in glibc-2.8, namespace pollution of many header files was fixed and many definitions are now guarded by USE_GNU etc.; at that time, this introduced too many build failures so we reverted this change for the time being, but by now, I think most applications should have been fixed.
FWIW, I'm still seeing something that looks like a bug in the glibc headers: https://bugzilla.novell.com/show_bug.cgi?id=507930 Vincent -- Les gens heureux ne sont pas pressés. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (10)
-
Marcus Meissner
-
Martin Vidner
-
Michael Matz
-
Petr Baudis
-
Philipp Thomas
-
Ralf Haferkamp
-
Raymond Wooninck
-
Stephan Kulow
-
Vincent Untz
-
Wolfgang Rosenauer