ld without -lstdc++ cannot find doctest - qt

I am working on a project under Windows and Ubuntu using CMake and CLang. On Ubuntu, I can build it OK with a shell script and could build it using Qt 5.5.1 (Creator 3.5.1). After upgrading to Qt 5.14.0 (Creator 4.11.1), there are over 1200 link errors where doctest cannot be found.
Captured compiler output:
[8/9 4.4/sec] Linking CXX executable test/test_runner
FAILED: : && /opt/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9 -g -O0 -Wall -pthread --verbose test/CMakeFiles/test_runner.dir/test_runner.cpp.o test/CMakeFiles/test_runner.dir/test.cpp.o -o test/test_runner PSCOM_LIB.a && :
clang version 9.0.0 (https://github.com/llvm-mirror/llvm c62b24f070c9a4bb1a76409e623042a740cac4cd)
Target: x86_64-unknown-linux-gnu
...
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o test/test_runner /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7.4.0/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/7.4.0 -L/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../.. -L/opt/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../lib -L/lib -L/usr/lib test/CMakeFiles/test_runner.dir/test_runner.cpp.o test/CMakeFiles/test_runner.dir/test.cpp.o PSCOM_LIB.a -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/7.4.0/crtend.o /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crtn.o
test/CMakeFiles/test_runner.dir/test_runner.cpp.o: In function `doctest::detail::rawMemoryToString(void const*, unsigned int)':
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2853: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2854: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2854: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::_Setfill<char>)'
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2854: undefined reference to `std::ostream::operator<<(std::ios_base& (*)(std::ios_base&))'
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2856: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::_Setw)'
/home/me/dev/source/vcpkg_pml/vcpkg/installed/x64-linux/include/doctest/doctest.h:2856: undefined reference to `std::ostream::operator<<(unsigned int)'
and hundreds of similar errors in several files.
The shell script produces the following output.
"/usr/bin/ld" ... -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc ...
I have no idea why -lstdc++ is added or not but assume that it identifies the required doctest library. Is there an option that can be added to CMakeList.txt to correct this issue?

Related

How can I link with the QPid Proton library's static libs?

I'm trying to link against the QPid Proton library, using static libs, and am getting lots of link errors. I am able to build with the shared libraries, but for this project we need to use static libs.
Here's the CMake file:
cmake_minimum_required(VERSION 3.0.0)
project(test-qpid VERSION 0.1.0)
include(CTest)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie " )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -std=c++17 -lpthread -static-libgcc -static-libstdc++ -fdiagnostics-color=auto")
set(THREADS_PREFER_PTHREAD_FLAG ON)
add_library(libpthread STATIC IMPORTED)
set_target_properties(libpthread PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libpthread.a)
set_target_properties(libpthread PROPERTIES INTERFACE_INCLUDE_DIRECTORIES /usr/include)
add_executable(test-qpid main.cpp)
find_library(QPID_PROTON_CORE NAMES qpid-proton-core-static)
if (NOT QPID_PROTON_CORE)
message(FATAL_ERROR, "QPid Proton core static library not found")
endif()
find_library(QPID_PROTON_PROACTOR NAMES qpid-proton-proactor-static)
if (NOT QPID_PROTON_PROACTOR)
message(FATAL_ERROR, "QPid Proton proactor static library not found")
endif()
find_library(QPID_PROTON NAMES qpid-proton-static)
if (NOT QPID_PROTON)
message(FATAL_ERROR, "QPid Proton static library not found")
endif()
find_library(QPID_PROTON_CPP NAMES qpid-proton-cpp-static)
if (NOT QPID_PROTON_CPP)
message(FATAL_ERROR, "QPid Proton CPP static library not found")
endif()
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include_directories("/usr/local/include")
set(LIBS ${QPID_PROTON_CORE} ${QPID_PROTON} ${QPID_PROTON_PROACTOR} ${QPID_PROTON_CPP})
target_link_libraries(test-qpid ${LIBS} libpthread)
include(CPack)
Here is a snippet of the output I'm seeing (there are lots more, which I've omitted for brevity):
-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. -lpthread CMakeFiles/test-qpid.dir/main.cpp.o /usr/local/lib/libqpid-proton-core-static.a /usr/local/lib/libqpid-proton-static.a /usr/local/lib/libqpid-proton-proactor-static.a /usr/local/lib/libqpid-proton-cpp-static.a /usr/lib/x86_64-linux-gnu/libpthread.a -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::close()':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:65: undefined reference to `pn_connection_close'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::error() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:171: undefined reference to `pn_connection_remote_condition'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::transport() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:52: undefined reference to `pn_connection_transport'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::open(proton::connection_options const&)':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:61: undefined reference to `pn_connection_open'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::virtual_host[abi:cxx11]() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:71: undefined reference to `pn_connection_remote_hostname'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::container_id[abi:cxx11]() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:75: undefined reference to `pn_connection_remote_container'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::user[abi:cxx11]() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:79: undefined reference to `pn_connection_transport'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:79: undefined reference to `pn_transport_get_user'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::sessions() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:93: undefined reference to `pn_session_head'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::receivers() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:97: undefined reference to `pn_link_head'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:101: undefined reference to `pn_link_next'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:99: undefined reference to `pn_link_is_receiver'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::senders() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:107: undefined reference to `pn_link_head'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:111: undefined reference to `pn_link_next'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:109: undefined reference to `pn_link_is_sender'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::open_session(proton::session_options const&)':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:121: undefined reference to `pn_session'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::default_session()':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:133: undefined reference to `pn_session'
[build] /usr/bin/ld: /home/user/src/qpid-proton/cpp/src/connection.cpp:134: undefined reference to `pn_session_open'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::max_frame_size() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:175: undefined reference to `pn_connection_transport'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::max_sessions() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:179: undefined reference to `pn_connection_transport'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::idle_timeout() const':
[build] /home/user/src/qpid-proton/cpp/src/connection.cpp:183: undefined reference to `pn_connection_transport'
[build] /usr/bin/ld: /usr/local/lib/libqpid-proton-cpp-static.a(connection.cpp.o): in function `proton::connection::desired_capabilities() const':
I've been Googling for answers for days and have gotten nowhere. If anyone has any experience with QPid Proton I'd greatly appreciate some suggestions.

Error in installing passenger nginx module

I am getting an error in installing passenger nginx in MAC 10.14.
here are the logs:
src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_x86_dcas.hpp:408:16: error:
address argument to atomic builtin cannot be const-qualified
('const volatile
boost::atomics::detail::gcc_dcas_x86_64::storage_type *' (aka
'const volatile unsigned __int128 *') invalid)
return __sync_val_compare_and_swap(&storage, value, value);
^ ~~~~~~~~
1 error generated.
rake aborted!
Command failed with status (1): [c++ -o buildout/support-binaries/AgentFundamentals.o -Isrc/agent -Isrc/cxx_supportlib -Isrc/cxx_supportlib/vendor-copy -Isrc/cxx_supportlib/vendor-modified -Isrc/cxx_supportlib/vendor-modified/libev -Wno-ambiguous-member-template -Isrc/cxx_supportlib/vendor-copy/libuv/include -Isrc/cxx_supportlib/vendor-copy/websocketpp -I/usr/local/opt/openssl/include -D_REENTRANT -I/usr/local/include -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -Wno-ambiguous-member-template -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -DHAS_ALLOCA_H -DHAS_SFENCE -DHAS_LFENCE -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -g -fno-limit-debug-info -std=gnu++11 -Wno-unused-local-typedefs -Wno-format-nonliteral -DHAS_UNORDERED_MAP -c src/agent/Shared/Fundamentals/Implementation.cpp]
/Users/narendrakumawat/.rvm/gems/ruby-2.2.5#rails4115/gems/passenger-6.0.2/build/support/cplusplus.rb:53:in `run_compiler'
/Users/narendrakumawat/.rvm/gems/ruby-2.2.5#rails4115/gems/passenger-6.0.2/build/support/cplusplus.rb:104:in `compile_cxx'
/Users/narendrakumawat/.rvm/gems/ruby-2.2.5#rails4115/gems/passenger-6.0.2/build/support/cplusplus.rb:162:in `block in define_cxx_object_compilation_task'
/Users/narendrakumawat/.rvm/gems/ruby-2.2.5#rails4115/bin/ruby_executable_hooks:24:in `eval'
/Users/narendrakumawat/.rvm/gems/ruby-2.2.5#rails4115/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => nginx => nginx_without_native_support => buildout/support-binaries/PassengerAgent => buildout/support-binaries/AgentFundamentals.o
(See full trace by running task with --trace)
I already tried this also :
https://github.com/phusion/passenger/issues/2199

quazip-0-7-3 build fails on windows

The following is what I did and the error message:
downloads quazip-0-7-3 from http://quazip.sourceforge.net/index.html, and unzip it to c:\Qt, run the following commands and it gets the error at the end:
C:\Qt\quazip-0.7.3\quazip>where qmake
C:\Qt\5.10.0\msvc2015\bin\qmake.exe
C:\Qt\quazip-0.7.3\quazip>where qmake
C:\Qt\5.10.0\msvc2015\bin\qmake.exe
C:\Qt\quazip-0.7.3\quazip>qmake PREFIX=c:\Qt\quazip
Info: creating stash file C:\Qt\quazip-0.7.3\quazip\.qmake.stash
C:\Qt\quazip-0.7.3\quazip>where make
C:\Program Files (x86)\GnuWin32\bin\make.exe
C:\Qt\quazip-0.7.3\quazip>make
make -f Makefile.Release
make[1]: Entering directory `C:/Qt/quazip-0.7.3/quazip'
Makefile.Release:120: *** missing separator. Stop.
make[1]: Leaving directory `C:/Qt/quazip-0.7.3/quazip'
make: *** [release] Error 2
The following is the Makefile.Release from line 115 to 155, line 120 is "<<":
.SUFFIXES: .c .cpp .cc .cxx
{release}.cpp{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{release}.cc{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{release}.cxx{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{release}.c{release\}.obj::
$(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{.}.cpp{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{.}.cc{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{.}.cxx{release\}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
{.}.c{release\}.obj::
$(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ #<<
$<
<<
Then I use the 'nmake' instead of 'make', but it fails again with different error:
C:\Qt\quazip-0.7.3\quazip>nmake
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe" -f Makefile.Release
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl -BxC:\Qt\5.10.0\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ..\..\5.10.0\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quagzipfile.h -o release\moc_quagzipfile.cpp
C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quaziodevice.h -o release\moc_quaziodevice.cpp
C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quazipfile.h -o release\moc_quazipfile.cpp
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ #C:\Users\yhuang\AppData\Local\Temp\nm402C.tmpqioapi.cpp
.\qioapi.cpp(11): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
JlCompress.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quaadler32.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quacrc32.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quagzipfile.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quaziodevice.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazip.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipdir.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipfile.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipfileinfo.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipnewinfo.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\bin\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\bin\nmake.exe"' : return code '0x2'
Stop.
Change to the following steps after #hole-otter-rosy's comment, and still got error at the end -
C:\Qt\quazip-0.7.3\quazip>where qmake
C:\Qt\5.10.0\msvc2015\bin\qmake.exe
C:\Qt\quazip-0.7.3\quazip>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"
C:\Qt\quazip-0.7.3\quazip>qmake PREFIX=c:\Qt\quazip INCPATH+=C:\Qt\zlib-1.2.11
NOTE: the 'zlib-1.2.11' contains the zlib.h which is required by quazip project.
run 'nmake' and I got the following link error:
C:\Qt\quazip-0.7.3\quazip>nmake
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.Release
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ #C:\Users\yhuang\AppData\Local\Temp\nm2D8C.tmp
qioapi.cpp
JlCompress.cpp
quaadler32.cpp
quacrc32.cpp
quagzipfile.cpp
quaziodevice.cpp
quazip.cpp
quazipdir.cpp
quazipfile.cpp
Generating Code...
cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ #C:\Users\yhuang\AppData\Local\Temp\nm44F3.tmp
unzip.c
zip.c
Generating Code...
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ #C:\Users\yhuang\AppData\Local\Temp\nm46E8.tmp
moc_quagzipfile.cpp
moc_quaziodevice.cpp
moc_quazipfile.cpp
Generating Code...
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /MANIFEST:embed /OUT:release\quazip.dll #C:\Users\yhuang\AppData\Local\Temp\nm4ED5.tmp
Creating library release\quazip.lib and object release\quazip.exp
quaadler32.obj : error LNK2019: unresolved external symbol _adler32 referenced in function "public: __thiscall QuaAdler32::QuaAdler32(void)" (??0QuaAdler32##QAE#XZ)
quacrc32.obj : error LNK2019: unresolved external symbol _crc32 referenced in function "public: __thiscall QuaCrc32::QuaCrc32(void)" (??0QuaCrc32##QAE#XZ)
unzip.obj : error LNK2001: unresolved external symbol _crc32zip.obj : error LNK2001: unresolved external symbol _crc32
quagzipfile.obj : error LNK2019: unresolved external symbol _gzdopen referencedin function "private: bool __thiscall QuaGzipFilePrivate::open<int>(int,class QFlags<enum QIODevice::OpenModeFlag>,class QString &)" (??$open#H#QuaGzipFilePrivate##AAE_NHV?$QFlags#W4OpenModeFlag#QIODevice####AAVQString###Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzread referenced in function "protected: virtual __int64 __thiscall QuaGzipFile::readData(char *,__int64)" (?readData#QuaGzipFile##MAE_JPAD_J#Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzwrite referencedin function "protected: virtual __int64 __thiscall QuaGzipFile::writeData(char const *,__int64)" (?writeData#QuaGzipFile##MAE_JPBD_J#Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzflush referencedin function "public: virtual bool __thiscall QuaGzipFile::flush(void)" (?flush#QuaGzipFile##UAE_NXZ)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzclose referencedin function "public: virtual __thiscall QuaGzipFile::~QuaGzipFile(void)" (??1QuaGzipFile##UAE#XZ)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzopen referenced in function "private: bool __thiscall QuaGzipFilePrivate::open<class QString>(class QString,class QFlags<enum QIODevice::OpenModeFlag>,class QString &)" (??$open#VQString###QuaGzipFilePrivate##AAE_NVQString##V?$QFlags#W4OpenModeFlag#QIODevice####AAV1##Z)
quaziodevice.obj : error LNK2019: unresolved external symbol _deflate referenced in function "public: virtual bool __thiscall QuaZIODevice::flush(void)" (?flush#QuaZIODevice##UAE_NXZ)
zip.obj : error LNK2001: unresolved external symbol _deflatequaziodevice.obj : error LNK2019: unresolved external symbol _deflateEnd referenced in function "public: virtual void __thiscall QuaZIODevice::close(void)" (?close#QuaZIODevice##UAEXXZ)
zip.obj : error LNK2001: unresolved external symbol _deflateEnd
quaziodevice.obj : error LNK2019: unresolved external symbol _inflate referenced in function "protected: virtual __int64 __thiscall QuaZIODevice::readData(char*,__int64)" (?readData#QuaZIODevice##MAE_JPAD_J#Z)
unzip.obj : error LNK2001: unresolved external symbol _inflatequaziodevice.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function "public: virtual void __thiscall QuaZIODevice::close(void)" (?close#QuaZIODevice##UAEXXZ)
unzip.obj : error LNK2001: unresolved external symbol _inflateEnd
quaziodevice.obj : error LNK2019: unresolved external symbol _deflateInit_ referenced in function "public: virtual bool __thiscall QuaZIODevice::open(class QFlags<enum QIODevice::OpenModeFlag>)" (?open#QuaZIODevice##UAE_NV?$QFlags#W4OpenModeFlag#QIODevice#####Z)
quaziodevice.obj : error LNK2019: unresolved external symbol _inflateInit_ referenced in function "public: virtual bool __thiscall QuaZIODevice::open(class QFlags<enum QIODevice::OpenModeFlag>)" (?open#QuaZIODevice##UAE_NV?$QFlags#W4OpenModeFlag#QIODevice#####Z)
unzip.obj : error LNK2019: unresolved external symbol _inflateInit2_ referencedin function _unzOpenCurrentFile3
unzip.obj : error LNK2019: unresolved external symbol _get_crc_table referencedin function _unzOpenCurrentFile3
zip.obj : error LNK2001: unresolved external symbol _get_crc_table
zip.obj : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function _zipOpenNewFileInZip4_64release\quazip.dll : fatal error LNK1120: 17 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
You are using an MSVC build of Qt and thus cannot use MinGW's make.
The error you get when using nmake indicates that you haven't set up a MSVC build environent. See Build C/C++ code on the command line in the MSVC docs for more information.

native build qt5.7.1 on raspberry pi get errors: /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to `QV8Engine::toVariant

i tried to build qt 5.7.1 on pi3 following this instruction:
https://wiki.qt.io/Native_Build_of_Qt_5.4.1_on_a_Raspberry_Pi
the source package i use is:
qt-everywhere-opensource-src-5.7.1.tar
configure as:
./configure -v -opengl es2 -force-pkg-config -device linux-rpi3-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -qt-xcb -make libs -no-use-gold-linker -prefix /usr/local/qt5
The instruction is using "linux-rasp-pi-g++", but i think it should be linux-rpi3-g++ for Rpi3.
Make, and i get errors like:
/usr/bin/g++ -Wl,-rpath-link,/opt/vc/lib
-Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/lib/arm-linux-gnueabihf -mfloat-abi=hard -Wl,--gc-sections -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../lib -Wl,-rpath-link,/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib
-Wl,-rpath-link,/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/lib
-o ../../bin/qmltestrunner .obj/main.o -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib
-lQt5QuickTest -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Test -lQt5Core -lGLESv2 -lpthread /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to QV8Engine::toVariant(QV4::ValueRef, int)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::dataReady(QQmlAbstractProfilerAdapter*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionContext::throwTypeError()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::markObjects(QV4::Managed*, QV4::ExecutionEngine*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlEngineDebugService::instance()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV8Engine::fromVariant(QVariant const&)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::operator=(unsigned long long)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::qt_metacast(char const*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickItem::y() const#Qt_5'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickView::errors() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::engine() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionEngine::newErrorObject(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::property() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlCustomParser::bindingIdentifier(QV4::CompiledData::Binding
const*)' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined
reference to QV4::ExecutionContext::throwError(QString const&)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::Invalid' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5:
undefined reference to QQmlAbstractBinding::vTables'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionContext::throwError(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::call(QV4::Managed*, QV4::CallData*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::createBinding(int, QObject*, QQmlContext*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::operator new(unsigned int, QV4::MemoryManager*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickItem::height() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::setLookup(QV4::Managed*, QV4::Lookup*, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::PersistentValue(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::qt_metacall(QMetaObject::Call, int, void**)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::addGlobalProfiler(QQmlAbstractProfilerAdapter*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickView::QQuickView(QWindow*)#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::putIndexed(QV4::Managed*, unsigned int, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::put(QV4::Managed*, QV4::StringRef, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::Object(QV4::ExecutionEngine*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::staticMetaObject'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QShortcutMap::tryShortcutEvent(QObject*, QKeyEvent*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::instance()'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickView::engine() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::getLookup(QV4::Managed*, QV4::Lookup*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickView::setSource(QUrl const&)#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::operator=(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ArrayData::realloc(QV4::Object*, QV4::ArrayData::Type, unsigned
int, unsigned int, bool)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlInspectorService::addView(QObject*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlPropertyPrivate::setBinding(QQmlProperty const&,
QQmlAbstractBinding*, QFlags)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::ValueRef,
QV4::ValueRef, QObject*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickItem::staticMetaObject#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::QQmlValueType(int, QObject*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickItem::x() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlDebugStream::QQmlDebugStream(QByteArray*,
QFlags<QIODevice::OpenModeFlag>)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickItem::window() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::~Object()'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickItem::mapToScene(QPointF const&)
const#Qt_5' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined
reference to QV4::Object::deleteProperty(QV4::Managed*,
QV4::StringRef)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickView::rootContext() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::getIndexed(QV4::Managed*, unsigned int, bool*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlDebugService::isDebuggingEnabled()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::destroy(QV4::Managed*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference toQQuickWindow::grabWindow()#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::metaObject() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlAbstractBinding::weakPointer()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::get(QV4::Managed*, QV4::StringRef, bool*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QOpenGLContextPrivate::globalShareContext()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::setVTable(QV4::ManagedVTable const*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlEngineDebugService::setStatesDelegate(QQmlDebugStatesDelegate*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickView::status() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::construct(QV4::Managed*, QV4::CallData*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlInspectorService::instance()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::query(QV4::Managed const*, QV4::StringRef)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickItem::width() const#Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::defineAccessorProperty(QV4::StringRef, unsigned long
long ()(QV4::CallContext), unsigned long long
()(QV4::CallContext))'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::advanceIterator(QV4::Managed*, QV4::ObjectIterator*,
QV4::StringRef, unsigned int*, QV4::Property*,
QV4::PropertyAttributes*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::String::simplifyString() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
`QQmlInspectorService::removeView(QObject*)' collect2: error: ld
returned 1 exit status Makefile:108: recipe for target
'../../bin/qmltestrunner' failed make[3]: *
[../../bin/qmltestrunner] Error 1 make[3]: Leaving directory
'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/tools/qmltestrunner'
Makefile:276: recipe for target 'sub-qmltestrunner-make_first' failed
make[2]: * [sub-qmltestrunner-make_first] Error 2
so, how can i fix this problem?
thanks.
I've solved this problem, and there is a new problem now.
Before native building qt on pi, I installed qt by:
sudo apt-get install qt5-default, and other qt5 packages.
Although I have :
sudo apt-get remove those packages, it may still works.
so I formatted the SD card and re-burned an Raspbian image, followed the instructions, "make", and the problem is gone.
but now I have another problem.
When I "make install", I get this error:
/usr/bin/g++ -Wl,-rpath-link,/opt/vc/lib -Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/lib/arm-linux-gnueabihf -mfloat-abi=hard -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -shared -o libdeclarative_location.so .obj/location.o .obj/qdeclarativegeomapitemview.o .obj/qdeclarativegeoserviceprovider.o .obj/qdeclarativegeocodemodel.o .obj/qdeclarativegeoroutemodel.o .obj/qdeclarativegeoroute.o .obj/qdeclarativegeoroutesegment.o .obj/qdeclarativegeomaneuver.o .obj/qdeclarativegeomap.o .obj/qdeclarativegeomaptype.o .obj/qdeclarativegeomapitembase.o .obj/qdeclarativegeomapquickitem.o .obj/qdeclarativecirclemapitem.o .obj/qdeclarativerectanglemapitem.o .obj/qdeclarativepolygonmapitem.o .obj/qdeclarativepolylinemapitem.o .obj/qdeclarativeroutemapitem.o .obj/qgeomapitemgeometry.o .obj/qdeclarativegeomapcopyrightsnotice.o .obj/error_messages.o .obj/locationvaluetypehelper.o .obj/qquickgeomapgesturearea.o .obj/qquickgeocoordinateanimation.o .obj/mapitemviewdelegateincubator.o .obj/qdeclarativeplacecontentmodel.o .obj/qdeclarativesupportedcategoriesmodel.o .obj/qdeclarativesearchsuggestionmodel.o .obj/qdeclarativesearchresultmodel.o .obj/qdeclarativereviewmodel.o .obj/qdeclarativeplaceimagemodel.o .obj/qdeclarativeplaceeditorialmodel.o .obj/qdeclarativecontactdetail.o .obj/qdeclarativecategory.o .obj/qdeclarativeplace.o .obj/qdeclarativeplaceattribute.o .obj/qdeclarativeplaceicon.o .obj/qdeclarativeplaceuser.o .obj/qdeclarativeratings.o .obj/qdeclarativesupplier.o .obj/qdeclarativesearchmodelbase.o .obj/moc_qdeclarativecirclemapitem_p.o .obj/moc_qdeclarativerectanglemapitem_p.o .obj/moc_qdeclarativepolygonmapitem_p.o .obj/moc_qdeclarativepolylinemapitem_p.o .obj/moc_qdeclarativeroutemapitem_p.o .obj/moc_qdeclarativegeomapcopyrightsnotice_p.o .obj/moc_qquickgeocoordinateanimation_p.o .obj/moc_qdeclarativeplacecontentmodel.o .obj/moc_qdeclarativesupportedcategoriesmodel_p.o .obj/moc_qdeclarativesearchsuggestionmodel_p.o .obj/moc_qdeclarativesearchresultmodel_p.o .obj/moc_qdeclarativereviewmodel_p.o .obj/moc_qdeclarativeplaceimagemodel_p.o .obj/moc_qdeclarativeplaceeditorialmodel.o .obj/moc_qdeclarativecontactdetail_p.o .obj/moc_qdeclarativecategory_p.o .obj/moc_qdeclarativeplace_p.o .obj/moc_qdeclarativeplaceattribute_p.o .obj/moc_qdeclarativeplaceicon_p.o .obj/moc_qdeclarativeplaceuser_p.o .obj/moc_qdeclarativeratings_p.o .obj/moc_qdeclarativesupplier_p.o .obj/moc_qdeclarativesearchmodelbase.o -L=/opt/vc/lib -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/lib -lQt5Location -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/lib -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Positioning -lQt5Core -Wl,-rpath-link,/opt/vc/lib -lGLESv2 -lpthread -lclip2tri -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/lib -lpoly2tri -lclipper
/usr/bin/ld: cannot find -lclip2tri
/usr/bin/ld: cannot find -lpoly2tri
/usr/bin/ld: cannot find -lclipper
collect2: error: ld returned 1 exit status
Makefile:273: recipe for target '../../../qml/QtLocation/libdeclarative_location.so' failed
make[4]: *** [../../../qml/QtLocation/libdeclarative_location.so] Error 1
make[4]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/imports/location'
Makefile:80: recipe for target 'sub-location-install_subtargets' failed
make[3]: *** [sub-location-install_subtargets] Error 2
make[3]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/imports'
Makefile:135: recipe for target 'sub-imports-install_subtargets' failed
make[2]: *** [sub-imports-install_subtargets] Error 2
make[2]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src'
Makefile:56: recipe for target 'sub-src-install_subtargets' failed
make[1]: *** [sub-src-install_subtargets] Error 2
make[1]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation'
Makefile:844: recipe for target 'module-qtlocation-install_subtargets' failed
make: *** [module-qtlocation-install_subtargets] Error 2
I found there are 3 directories in qtlocation/src/3rdparty
clip2tri
clipper
poly2tri
and 3 file in qtlocation/lib:
libclip2tri.prl
libclipper.prl
libpoly2tri.prl
but no lib files.
I checked the build log, it seems cpp file in the directoriy qtlocation/src/3rdparty are not compiled,
cd 3rdparty/ && ( test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/3rdparty.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile ) && make -f Makefile install
make[3]: Entering directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty'
cd poly2tri/ && ( test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/poly2tri/poly2tri.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile ) && make -f Makefile install
make[4]: Entering directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/poly2tri'
make[4]: Nothing to be done for 'install'.
make[4]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/poly2tri'
cd clipper/ && ( test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clipper/clipper.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile ) && make -f Makefile install
make[4]: Entering directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clipper'
make[4]: Nothing to be done for 'install'.
make[4]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clipper'
cd clip2tri/ && ( test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clip2tri/clip2tri.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile ) && make -f Makefile install
make[4]: Entering directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clip2tri'
make[4]: Nothing to be done for 'install'.
make[4]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clip2tri'
make[3]: Leaving directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty'
cd location/ && ( test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/location/location.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile ) && make -f Makefile install
make[3]: Entering directory '/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/location'

Getting unresolved external symbol when trying to compile a Qt application

I created a simple GUI application in QtCreator (QT 4.8.2) and added a function to check the network connectivity:
bool MainWindow::CheckNetworkConnectivity()
{
QList<QNetworkInterface> interface = QNetworkInterface::allInterfaces();
for(int i = 0; i < interface.count();i++)
{
QNetworkInterface inface = interface.at(i);
if(inface.IsUp && !inface.IsLoopBack)
{
ui->lstLog->addItem(inface.name()+QDateTime::currentDateTime().toString("h:m:s ap"));
ui->chkConStatus->setChecked(true);
}
else{
ui->chkConStatus->setChecked(false);
}
}
return ui->chkConStatus->checkState();
}
After that any attempts to compile the code generates the following errors:
15:21:11: Running steps for project MasterVPN...
15:21:11: Configuration unchanged, skipping qmake step.
15:21:11: Starting: "C:\Qt\Designer\bin\jom.exe"
C:\Qt\Designer\bin\jom.exe -f Makefile.Debug
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.2\include\QtCore" -I"c:\Qt\4.8.2\include\QtGui" -I"c:\Qt\4.8.2\include" -I"c:\Qt\4.8.2\include\ActiveQt" -I"debug" -I"." -I"..\MasterVPN" -I"." -I"c:\Qt\4.8.2\mkspecs\win32-msvc2010" -Fodebug\ #C:\Users\Master\AppData\Local\Temp\mainwindow.obj.4156.31.jom
mainwindow.cpp
link /LIBPATH:"c:\Qt\4.8.2\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /MANIFEST /MANIFESTFILE:"debug\MasterVPN.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:debug\MasterVPN.exe #C:\Users\Master\AppData\Local\Temp\MasterVPN.exe.4156.5422.jom
mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QNetworkInterface::~QNetworkInterface(void)" (__imp_??1QNetworkInterface##QAE#XZ) referenced in function "public: bool __thiscall MainWindow::CheckNetworkConnectivity(void)" (?CheckNetworkConnectivity#MainWindow##QAE_NXZ)
mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QString __thiscall QNetworkInterface::name(void)const " (__imp_?name#QNetworkInterface##QBE?AVQString##XZ) referenced in function "public: bool __thiscall MainWindow::CheckNetworkConnectivity(void)" (?CheckNetworkConnectivity#MainWindow##QAE_NXZ)
mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QNetworkInterface::QNetworkInterface(class QNetworkInterface const &)" (__imp_??0QNetworkInterface##QAE#ABV0##Z) referenced in function "public: bool __thiscall MainWindow::CheckNetworkConnectivity(void)" (?CheckNetworkConnectivity#MainWindow##QAE_NXZ)
mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QList<class QNetworkInterface> __cdecl QNetworkInterface::allInterfaces(void)" (__imp_?allInterfaces#QNetworkInterface##SA?AV?$QList#VQNetworkInterface####XZ) referenced in function "public: bool __thiscall MainWindow::CheckNetworkConnectivity(void)" (?CheckNetworkConnectivity#MainWindow##QAE_NXZ)
debug\MasterVPN.exe : fatal error LNK1120: 4 unresolved externals
jom: C:\Users\Master\Documents\Qt\MasterVPN-build-desktop-Qt_4_8_2__4_8_2__Debug\Makefile.Debug [debug\MasterVPN.exe] Error 1120
jom: C:\Users\Master\Documents\Qt\MasterVPN-build-desktop-Qt_4_8_2__4_8_2__Debug\Makefile [debug] Error 2
15:21:17: The process "C:\Qt\Designer\bin\jom.exe" exited with code 2.
Error while building/deploying project MasterVPN (target: Desktop)
When executing step 'Make'
Can someone please point out what the cause could be?
The linker is indicating that is can not find the required functionality. This is contained within QtNetwork4.lib (if you're on a Windows platform) or the equivalent library for your platform. So you have to tell the linker that it needs to link against this library. The network module is the required one, so instead of just
QT += core gui
at least make that
QT += core gui network
That should fix the linker errors you see.

Resources