LIBICONV_SECOND_ARGUMENT_CONST - Failed

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

LIBICONV_SECOND_ARGUMENT_CONST - Failed

#1 Post by kamil »

Hi, I try to use libiconv, I was downloaded libiconv in dcmtk's main page http://dicom.offis.de/dcmtk#lib-win, it's 3.6.0 version.
And I'm using DCMTK-3.6.1_20131114 as source. In the cmake settings, I checked "DCMTK_WITH_ICONV" and set "WITH_LIBCONVINC" path to above libiconv path.
But when I press "Generate" button in cmake, it appears:

Code: Select all

Info: DCMTK ICONV support will be enabled
Performing Test LIBICONV_SECOND_ARGUMENT_CONST
Performing Test LIBICONV_SECOND_ARGUMENT_CONST - Failed
in the output.

But when I building the dcmtk project, an error found:

Code: Select all

can not  find "liconv.h" in "ofchrenc.cc"
And then, I downloaded source code of libiconv in dcmtk's main page, copy the "iconv.h"and"localcharset.h" to the libinconv include folder,
then an other error appear:

Code: Select all

Error	1	error C2664: 'libiconv' : cannot convert parameter 2 from 'char **' to 'const char **'	DCMTK-3.6.1_20131114\ofstd\libsrc\ofchrenc.cc	236
And I found in osconfig.h:

Code: Select all

/* Define if we are compiling with libiconv support. */
#define WITH_LIBICONV
/* Define if the second argument to iconv() is const */
/* #undef LIBICONV_SECOND_ARGUMENT_CONST */
it seems is "LIBICONV_SECOND_ARGUMENT_CONST" marco problem.

How can I set this marco in cmake-gui? Thanks!

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#2 Post by J. Riesmeier »

You cannot mix header files from one package with a library from another package... especially not after the configuration step has been completed.

Where did you get the libiconv library from and how did you compile it?

Follow-up: Please note that the support library package on the DCMTK website does not contain a pre-compiled version of the libiconv that has been tested with the latest development snapshot. The libiconv in the libxml2 subdirectory is only meant to be used as part of libxml2 and only for DCMTK 3.6.0 (i.e. the latest release). See documentation of DCMTK 3.6.0 for details.

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#3 Post by kamil »

You cannot mix header files from one package with a library from another package... especially not after the configuration step has been completed.
I just want to know the steps to add libiconv for dcmtk 3.6.1, compile the "dcmconv" project with WITH_LIBICONV and LIBICONV_SECOND_ARGUMENT_CONST marco. So I can use ofstd which depends libiconv lib.
Where did you get the libiconv library from and how did you compile it?
I get the libiconv library in dcmtk main page:http://dicom.offis.de/dcmtk#lib-win, it is 1.1.3 version
And the souce code of libiconv is also 1.1.3 in dcmtk main page.
May be I should use v1.1.4?
J. Riesmeier wrote:the support library package on the DCMTK website does not contain a pre-compiled version of the libiconv
You mean in the cmake WITH_LIBICONVINC path must set to " a pre-compiled version of the libiconv"?
What does " a pre-compiled version of the libiconv" meaning? Source code of libiconv-1.14?
Or may be I should compile the libiconv-1.14 source code first, and than use the created header and binary lib in cmake WITH_LIBICONVINC path?
May be I should read the cmake manual first to know how to set this path....

Thank you for your reply...

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#4 Post by kamil »

hi, I follow the :http://www.codeproject.com/Articles/302 ... ual-Studio
guide to create libiconv library, and define "LIBICONV_SECOND_ARGUMENT_CONST" manually, and the ofstd compiled well, but the dcmconv has some problem:

Code: Select all

2>ofstd.lib(ofchrenc.obj) : error LNK2019: unresolved external symbol __imp__locale_charset referenced in function "public: class OFCondition __thiscall OFCharacterEncoding::updateLocaleEncoding(void)" (?updateLocaleEncoding@OFCharacterEncoding@@QAE?AVOFCondition@@XZ)
2>ofstd.lib(ofchrenc.obj) : error LNK2019: unresolved external symbol __imp__libiconv referenced in function "protected: class OFCondition __thiscall OFCharacterEncoding::convertString(void *,char const *,unsigned int,class OFString &,bool)" (?convertString@OFCharacterEncoding@@IAE?AVOFCondition@@PAXPBDIAAVOFString@@_N@Z)
2>ofstd.lib(ofchrenc.obj) : error LNK2019: unresolved external symbol __imp__libiconvctl referenced in function "protected: class OFCondition __thiscall OFCharacterEncoding::convertString(void *,char const *,unsigned int,class OFString &,bool)" (?convertString@OFCharacterEncoding@@IAE?AVOFCondition@@PAXPBDIAAVOFString@@_N@Z)
2>ofstd.lib(ofchrenc.obj) : error LNK2019: unresolved external symbol __imp__libiconv_open referenced in function "protected: class OFCondition __thiscall OFCharacterEncoding::openDescriptor(void * &,class OFString const &,class OFString const &)" (?openDescriptor@OFCharacterEncoding@@IAE?AVOFCondition@@AAPAXABVOFString@@1@Z)
2>ofstd.lib(ofchrenc.obj) : error LNK2019: unresolved external symbol __imp__libiconv_close referenced in function "protected: class OFCondition __thiscall OFCharacterEncoding::closeDescriptor(void * &)" (?closeDescriptor@OFCharacterEncoding@@IAE?AVOFCondition@@AAPAX@Z)
2>ofstd.lib(ofchrenc.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) int _libiconv_version" (__imp_?_libiconv_version@@3HA)
Any suggustion?

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#5 Post by J. Riesmeier »

You mean in the cmake WITH_LIBICONVINC path must set to " a pre-compiled version of the libiconv"? What does " a pre-compiled version of the libiconv" meaning? Source code of libiconv-1.14?
Pre-compiled means that you need to compile the libiconv before you start the configuration/compilation of the DCMTK.
Or may be I should compile the libiconv-1.14 source code first, and than use the created header and binary lib in cmake WITH_LIBICONVINC path?
Correct. Unfortunately, we not have a ready-to-use "pre-compiled" version of libiconv for Windows/VisualStudio right now since the character set conversion code has been added after the latest release (DCMTK 3.6.0).

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#6 Post by kamil »

Correct. Unfortunately, we not have a ready-to-use "pre-compiled" version of libiconv for Windows/VisualStudio right now since the character set conversion code has been added after the latest release (DCMTK 3.6.0).
I don't find "offical" way to compile libiconv v1.14 in windows(windows compilation only support in v1.11), all I found the approch (v1.14) is need to modify header files in libiconv, but I not sure these modified headers is suitable for dcmtk 3.6.1.(I tried, but faild list above)
May be I need to compile libiconv v1.14 in Linux(GNU)?( I'm not familiar with linux...)

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: LIBICONV_SECOND_ARGUMENT_CONST - Failed

#7 Post by Chung-Yueh Lien »

hi,
kamil wrote: I don't find "offical" way to compile libiconv v1.14 in windows(windows compilation only support in v1.11), all I found the approch (v1.14) is need to modify header files in libiconv, but I not sure these modified headers is suitable for dcmtk 3.6.1.(I tried, but faild list above)
May be I need to compile libiconv v1.14 in Linux(GNU)?( I'm not familiar with linux...)
I have create a branch from dcmtk-3.6.1_20121102 on github that you can compile the libiconv v1.14 for Windows.
https://github.com/cylien/dcmtk-3.6.1_20121102

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest