From: Pouar <the...@gm...> - 2015-04-26 00:58:07
|
On 04/25/2015 05:32 PM, Scot Jenkins wrote: > Pouar <the...@gm...> wrote: > >> I get the following compile error if libiconv is installed (which I need) >> >> Session.C:1661:18: error: no matching function for call to 'libiconv' >> if ((ret = iconv(cd, &ip, &ileft, &op, &oleft)) == (size_t) -1) { >> >> I managed to work around it by moving /usr/local/include/iconv.h, but >> then it complained about invalid characters when building >> programs/localized which I worked around by only building the C locale >> which got it to compile, but then ttsession segfaulted. I've attached >> ~/.dt/startlog and a backtrace from gdb to this email from the segfault > > I ran into a similar error on the same line when compiling the source > tarball cde-src-2.2.2.tar.gz on FreeBSD 9.3 i386 32-bit using the OS > stock gcc 4.2.1 C/C++ compilers. > > Session.C: In member function 'int DtMail::Session::csConvert(char**, long unsigned int&, int, char*, char*)': > Session.C:1661: error: invalid conversion from 'const char**' to 'char**' > Session.C:1661: error: initializing argument 2 of 'size_t libiconv(void*, char**, size_t*, char**, size_t*)' > *** [Session.o] Error code 1 > > > I also tried the latest git version of CDE source, build died at the > same spot with the same error. A web search on the error message > brought me here: > > http://stackoverflow.com/questions/20984220/invalid-conversion-from-const-char-to-char > > I changed line 1661 in > $BUILDDIR/cde-2.2.2/programs/dtmail/libDtMail/Common/Session.C > to this (line number display in left margin): > > 1661 if ((ret = iconv(cd, const_cast<char**>(&ip), &ileft, &op, &oleft) > ) == (size_t) -1) { > > > This "casts away the const" according to Stroustroup 3rd edition: > section 10.2.7.1 and 15.4.2.1 > > Adding the const_cast<char**> and ()'s around &ip allowed Session.C > to compile. CDE continued building but soon failed with the same > error on line 1073 of > $BUILDDIR/cde-2.2.2/programs/dtmail/libDtMail/RFC/RFCBodyPart.C > > Again, same fix (line number displayed in left margin): > > 1073 ret = iconv(cd, const_cast<char**>(&ip), &ileft, &op, &oleft); > > After that CDE built successfully. I've been using it since last > night and everything seems to work OK so far. > > I'm using binary packages for xorg, motif, etc. > I have this version of iconv package installed: libiconv-1.14_8 > if it matters. > > I don't know if my hack is the correct fix but it worked for me. > Can someone more familiar with the code please tell me if this is > the correct fix? If so, I'd be happy to submit patches. > > scot Well that fixed the issue with iconv.h, there was also LC_ALL that was being set in ~/.profile that FreeBSD put there automatically which I took out which seemed to be causing the "invalid characters", now all that's left is the segfault -- Pouar |