Important: Please read the Qt Code of Conduct -

[Solved]Syntax error for QIconvCodec on 5.3.2 build

  • I'm building Qt5.3.2 64 bit from git on Windows 64 bit machine using VS2010 toolchain. I'm using this as a guide.

    I did a git clone on the Qt5 repository, then did git checkout 5.3.2 and ran perl init-repository -no-webkit.

    Configure works and when I run nmake I get this error.

    codecs\qtextcodec.cpp(288) : error C2061: syntax error : identifier 'QIconvCodec'
    NMAKE : fatal error U1077: '"d:\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.EXE"' : return code '0x

    Line 288 consists of

    #if !defined(QT_NO_ICONV)
    (void) new QIconvCodec;

    From what I can find by searching there was an error in earlier versions of Qt 5 (Qt 5 RC1 bug #28473) where there was an issue with a definition in the header file but that is supposed to have been fixed. Other than that bugreport I haven't found much else that pertains to actually building Qt but there are some for building apps with Qt.

    I assume I do need this library it for character conversion on windows unless windows has something else that Qt will use by default.

    I thought I'd post here first before I file a bug in case I'm missing something obvious.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Could you check the configuration summary to see if it mentioned iconv support enabled ?

  • Thank you. I' m glad to be here. I really like Qt and hope to get more active in it. I've spent a lot of time recently and want to build Qt, then Qt Creator from git.

    config.summary shows

    Qt Configuration:

    Iconv support......yes

    I know under Linux this should be yes but for Windows does Qt use something besides the libconv such as built in Windows features? Should I use -noiconv (or is it no-iconv)?

  • I did a build with -no-iconv and got a different error so I'm off to track it down. It will build with no iconv but what do I give up on Windows by not having it?

    c/corelib/kernel/qcore_unix_p.h(60) : fatal error C1189: #error : "qcore_unix_p.h included on a n
    -Unix system"
    NMAKE : fatal error U1077: '"d:\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.EXE"' : return code '

  • Lifetime Qt Champion

    Oo, looks like you are trying to build a unix version of Qt on windows.

    What options are you giving to configure ? Where do you call it from ?

    1. I cloned qt/qt5 into my qt5 local repository, qt5 with

      git clone qt5

    2. I make sure I'm in my local repo/qt5 directory and then I did git checkout (git branch 5.3.2).

    3. Run perl init-repository -no-webkit

    4. I then run configure.bat (from the qt5 top level directory) which does a -top-level and adds my stuff. The configure.bat makes sure the qtbase directory exists and then changes to it, then runs the configure.bat in qtbase with the \pathtoqtbase\configure.bat

    -prefix D:\Qt-5.3.2-x64 -developer-build -no-icu -opensource -platform win32-msvc2010 -nomake examples -nomake tests -mp -confirm-license -plugin-sql-psql -plugin-sql-odbc -plugin-sql-MySQL

    In the configure.bat in qtbase it checks for .gitignore and if it does NOT exist it skips all the setup for c, perl, etc. and just runs configure.exe In this case .gitignore does exist so it sets up the compilers, creates the makefile and then runs configure.exe as

    configure.exe -srcdir %QTSRC% %* 

    where QTSRC is the qt5\qtbase directory.

    What does top-level tell config to do. I have not found it in any of the lists for Qt config options.

    I am running this on a Windows 7 Pro 64 bit machine that does have git-bash installed but I am running from the windows command prompt - actually it's the same as the Visual Studio 64 bit command prompt which sets up the environment for VS2010 64 bit.


  • I think I found the problem. I was a victim of my cut and paste. I had started using the configure line above when I first started trying to build Qt so I cut and pasted it but forgot to add the -no-iconv so it must have tried to build it.

    Tonight I changed that and added the no-iconv and got much further to the point where it's trying to build the PostgreSQL plugin but I left that out of the include path.

  • Lifetime Qt Champion

    Well, nice you got further, but I'm still wondering why it thought you were building on a unix like system.

    If you have enough time, can you try to re-configure (you can use an out of source build for that one so you don't need to clean everything again) but without giving the platform no iconv options ? The platform should be auto-detected for you

  • I wonder, too. I have time and it will be good learning. I'll do an out of source build and see what happens.

    I assume I should leave QMAKESPEC blank and not do a -platform option?

  • A question. iconv is needed on Linux but on Windows does the QT build process use a native Windows encoding system?

  • I'm started fresh and am doing an out of source build. QMAKESPEC was undefined and no -platform and it detected win32-msvc2010 according to config.summary. The iconv is set as yes - I did not have that in my options and I removed the MySQL and PostgreSQL plugins.

    I started a build with jom /j 8 so we'll see.

  • Lifetime Qt Champion

    IIRC, you're right

  • The build with jom hung so I started again - new build directory, reconfigure, and use nmake this time. We'll see what happens.

  • This time it finished. I started clean with a fresh clone of git, did NOT specify QMAKESPEC or -platform. Configure summary showed iconv was no. I did an out of source build.

    I used both -developer-build and -prefix D:\somedir.

    I am now running nmake install and it's copying the files.

    All I can figure is that I must have had something wrong on my setup or system.

    I guess in summary

    1. Windows Qt builds do not use iconv and will figure that out.
    2. Don't use QMAKESPEC - let it be set by the detection process

  • Lifetime Qt Champion

    Strange that jom failed… Anyway, nice it worked out.

    Did you by any chance build once with MinGW ?

  • No builds with MingGW. I have been using git source and the VS2010 toolchain all along. I can only assume it was something on my system.

    I'll be doing lots more builds so I'll redo some of what I did.

    Two questions

    1. I assume iconv is Linux only so Qt will use Windows codecs.

    2. I've built Qt so that is, if I understand correctly, the base, the kit that things I build with Qt Creator and Qt Creator itself will use (after I build Qt Creator). Is that correct?

    Thanks for the help.

  • Lifetime Qt Champion

    1. Not Linux only but not used for Windows

    2. You don't need to build Qt Creator unless you plan to either create plugins for it or work on it's code base. You can simply download the latest version otherwise.

    Go to the Preferences -> Build and Run -> Qt version -> Add your newly built Qt -> Save -> go to Kits -> Create a new Kit and make it use that newly added Qt Version -> Save -> enjoy !

  • I guess Mac, and some others too for iconv.

    That is good to know. I'll give that a try.

    Thanks again.

  • Lifetime Qt Champion

    You're welcome !

    If you have everything going right now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • Very good idea. How do I do that. I've checked around my profile, the post, searched, and come up dry.

  • Lifetime Qt Champion

    It's a bit hidden: edit your original post and update the title by hand :)

  • It sure is. Done.

    Thanks again.

Log in to reply