#5452 closed defect (fixed)
cpl_recode_iconv.cpp compile error on freebsd 10
Reported by: | springmeyer | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.1 |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
Hitting this error compiling GDAL latest on freebsd 10:
/bin/sh /usr/home/ec2-user/mapnik-packaging/osx/out/packages/gdal/gdal/libtool --mode=compile --tag=CXX clang++ -Wno-pragmas -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -DNDEBUG -O3 -D_FILE_OFFSET_BITS=64 -fPIC -Wall -DOGR_ENABLED -I/usr/home/ec2-user/mapnik-packaging/osx/out/packages/gdal/gdal/port -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64 -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64 -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -DHAVE_LIBZ -c -o cpl_recode_iconv.lo cpl_recode_iconv.cpp libtool: compile: clang++ -Wno-pragmas -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -DNDEBUG -O3 -D_FILE_OFFSET_BITS=64 -fPIC -Wall -DOGR_ENABLED -I/usr/home/ec2-user/mapnik-packaging/osx/out/packages/gdal/gdal/port -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64 -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64 -I/usr/home/ec2-user/mapnik-packaging/osx/out/build-cpp03-libstdcpp-gcc-x86_64/include -DHAVE_LIBZ -c cpl_recode_iconv.cpp -o cpl_recode_iconv.o warning: unknown warning option '-Wno-pragmas' [-Wunknown-warning-option] cpl_recode_iconv.cpp:106:13: error: no matching function for call to 'iconv' iconv( sConv, &pszSrcBuf, &nSrcLen, &pszDstBuf, &nDstLen ); ^~~~~ /usr/include/iconv.h:56:8: note: candidate function not viable: no known conversion from 'char **' to 'const char **' for 2nd argument size_t iconv(iconv_t, const char ** __restrict, ^ cpl_recode_iconv.cpp:256:13: error: no matching function for call to 'iconv' iconv( sConv, &pszSrcBuf, &nSrcLen, &pszDstBuf, &nDstLen ); ^~~~~ /usr/include/iconv.h:56:8: note: candidate function not viable: no known conversion from 'char **' to 'const char **' for 2nd argument size_t iconv(iconv_t, const char ** __restrict, ^ 1 warning and 2 errors generated. gmake[1]: *** [cpl_recode_iconv.lo] Error 1
I'm using:
FreeBSD ip-10-233-153-7 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
I found that port/cpl_config.h
looks like:
/* Define as const if the declaration of iconv() needs const. */ #define ICONV_CONST const /* For .cpp files, define as const if the declaration of iconv() needs const. */ #define ICONV_CPP_CONST
And I can workaround the problem by changing it to:
/* Define as const if the declaration of iconv() needs const. */ #define ICONV_CONST const /* For .cpp files, define as const if the declaration of iconv() needs const. */ #define ICONV_CPP_CONST const
Change History (5)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Not seeing a warning:
$ echo '#include <iconv.h>' > testiconv.cpp $ echo 'int main(int argc, char** argv) { iconv_t cd; return iconv (cd, (const char **) 0, 0, 0, 0); } ' >> testiconv.cpp $ clang++ testiconv.cpp -c $ clang++ testiconv.cpp -c -pedantic $ clang++ testiconv.cpp -c -pedantic -Wall testiconv.cpp:2:61: warning: variable 'cd' is uninitialized when used here [-Wuninitialized] int main(int argc, char** argv) { iconv_t cd; return iconv (cd, (const char ... ^~ testiconv.cpp:2:45: note: initialize the variable 'cd' to silence this warning int main(int argc, char** argv) { iconv_t cd; return iconv (cd, (const c... ^ = NULL 1 warning generated. $ clang++ -v FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 Target: x86_64-unknown-freebsd10.0 Thread model: posix
comment:3 by , 10 years ago
Note:
See TracTickets
for help on using tickets.
Hum, this is weird. There's a configure test for that. Could you try the following ? I suspect there must be a warning that occurs and make the test fail