jcfr / qt-easy-build

Scripts allowing to easily build Qt with OpenSSL support on Linux, macOS or Windows
Apache License 2.0
37 stars 34 forks source link

Error building Qt4.8.7 on system with foreign locales #38

Closed XinyangWang1024 closed 4 years ago

XinyangWang1024 commented 6 years ago

I tried many times building qt4.8.7 using win10(64bit)plus vs2013, but there are always some problems occurring (as showed in the picture). I have already changed the wrong quotation in C:\D\Support\qt..\src\3rdparty\webkit\source\webcore\platform\DefaultLocalizationStrategy.cpp. I searched many blocks for the answer ,and I was told to use this link"https://raw.githubusercontent.com/jcfr/qt-easy-build/4.8.7-update-to-cmake-3.4.3/windows_build_qt.ps1" instead of "https://raw.githubusercontent.com/jcfr/qt-easy-build/4.8.7/windows_build_qt.ps1". But the first link was unavailable. please help me. 7f52a00da345c37ebf804f80f853b2e

jcfr commented 6 years ago

@qq794863351 The branch 4.8.7 has just been updated to use the latest version of CMake (v3.11).

To address the issue, may be you could build Qt setting the local code page to US. May be you could try typing:

chcp 437

See https://ss64.com/nt/chcp.html

XinyangWang1024 commented 6 years ago

@jcfr Thanks for so quick a reply! I tried typing chcp 437, but I think you misled the Chinese words for the errors. By typing chcp 437, the Chinese prompt can not show normally, but the errors still exist. 60ec0ecb6a0a5c4c74e8c6a6d224cea

I finally build successfully by looking up the issues discussed in the following link:

19 (comment)

here I want to summarize the solution to make it more clear: When getting the errors like this, find the downloaded files at C:\D\Support. Open file "qt-4.8.7-64-vs2013-deb" if you are building in debug mode.(open"qt-4.8.7-64-vs2013-rel" if building in release mode ) Then find C:\D\Support\qt-4.8.7-64-vs2013-deb\src\3rdparty\webkit\Source\WebCore\platform\DefaultLocalizationStrategy.cpp, open it and make two changes: 1.line 325 change the strange quotation marks: return formatLocalizedString(WEB_UI_STRING("Look Up "%@"", "Look Up context menu item with selected word"), selectedCFString.get());

2.line 327 change the strange quotation marks, and add two backslashes: b03e040c3b94722ee0c596e04b3cfcc (sorry to put picture here, because backslash can not be shown)

hope this can help others in the future.

BTW, when searching for the solutions, I find this error occurs almost only with Chinese users. and I do not know why..

XinyangWang1024 commented 6 years ago

@jcfr here are some other questions, please help me. 1.my computer was installed with other version of Qt as well as Qt-addin for vs2013. if I uninstall them, will this influence Qt 4.8.7? 2.my next step is to build 3d slicer, will the building mode of Qt ( debug or release, 64bit or 32 bit) have influence on building of slicer? for example, need I choose 64bit cmake to build slicer if I build Qt in 64 bit? really sorry to bother you

gopain commented 6 years ago

我也是这个错误,解决了啊,之前看到昨天看到有人说是 中文双引号问题,可是改了还是不行,Windows的控制台太tm难用了,而且改了双引号显然不对,转义之后就编译成功了,现在正在build Slicer。一会儿看看是不是成功。

jcfr commented 6 years ago

1.my computer was installed with other version of Qt as well as Qt-addin for vs2013. if I uninstall them, will this influence Qt 4.8.7?

No it shouldn't

2.my next step is to build 3d slicer, will the building mode of Qt ( debug or release, 64bit or 32 bit) have influence on building of slicer? for example, need I choose 64bit cmake to build slicer if I build Qt in 64 bit?

Yes, if you build Qt in 64-bit Release, you will have to select the corresponding Visual Studio Generator ending with Win64, in you case it would be Visual Studio 12 2013 Win64 and then select "Release" in virtual studio.

Or build using this command line:

cmake --build . --config Release  -- /m

here I want to summarize the solution to make it more clear:

Thanks for sharing your findings :+1:

Does this patch properly capture what you described:

325c325
<     return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
---
>     return formatLocalizedString(WEB_UI_STRING("Look Up \"%@\"", "Look Up context menu item with selected word"), selectedCFString.get());
327c327
<     return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
---
>     return WEB_UI_STRING("Look Up \"<selection>\"", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
XinyangWang1024 commented 6 years ago

@gopain 我也正在编译slicer,之前用的qt5.8和qt-addin,编译slicer总是有错,网上也没找到对应的错误,干脆从头开始,用作者推荐的配置,不知道能不能成功,早上用debug模式编译卡住了,重新在用release模式在编译。

XinyangWang1024 commented 6 years ago

@jcfr In my building process, I changed quotation marks both in line325 and line327; added backslashes only in line327.

one more question: I do not totally understand your explanation to my second question..I am a novice at the questions about debug, release and the version Do you mean If i built Qt in 64-bit Release, after building slicer source code using cmake, I have to build slicer selecting "release, x64" in visual studio? If i built Qt in 64-bit debug, after building slicer source code using cmake, I have to build slicer selecting "debug, x64" in visual studio? BTW, I do not find the issues discussed about the errors when building slicer. Do you have the relevant link?

jcfr commented 6 years ago

I changed quotation marks both in line325 and line327; added backslashes only in line327.

Does this patch looks better:

325c325
<     return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
---
>     return formatLocalizedString(WEB_UI_STRING("Look Up "%@"", "Look Up context menu item with selected word"), selectedCFString.get());
327c327
<     return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
---
>     return WEB_UI_STRING("Look Up \"<selection>\"", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));

Do you mean If i built Qt in 64-bit Release, after building slicer source code using cmake, I have to build slicer selecting "release, x64" in visual studio? If i built Qt in 64-bit debug, after building slicer source code using cmake, I have to build slicer selecting "debug, x64" in visual studio?

Yes, that is the idea.

Step 1: Build Qt in 64-bit

Step 2: Configure Slicer project using CMake and select Visual Studio 12 2013 Win64 generator. After opening the solution file, x64 will be the only choice. But you will have to explicitly select Debug or Release

BTW, I do not find the issues discussed about the errors when building slicer. Do you have the relevant link?

Which error are you referring to ?

XinyangWang1024 commented 6 years ago

@jcfr 4ec97f750f7fdd17bfda02db22cfeb3 yes, this patch is fine.

35276d6ae88adefe24a5d3abc617d38 when building slicer.sln in debug,x64 in vs2013, I came upon this error. and I tried to find issues discussed about it. error 155 error MSB6006: “cmd.exe” exited with code 1 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170

jcfr commented 6 years ago

This error is not specific enough, I suggest you scroll up in the log to find out what really caused the problem.

gopain commented 6 years ago

@qq794863351 我x64 Qt Debug模式编译好了,但是Release不可以,然后Slicer Debug也可以了,先开发吧,Release等打包的时候再来处理。

XinyangWang1024 commented 6 years ago

@jcfr Really thanks for your patience. according to @gopain ,this error occurs because visual studio can not download some resources due to the Internet environment. I will try later by using vpn.

jcfr commented 4 years ago

Closing as current maintenance are geared toward maintaining build for Qt 5.15.1 on Linux and macOS.

That said, contributions are welcome.