Compiling gRPC examples for QNX - grpc

Successfully compiled gRPC for QNX and now trying to build the examples.
Build command:
cmake -DCMAKE_C_COMPILER=qcc -DCMAKE_CXX_COMPILER=q++ ../..
Linker errors:
[ 90%] Linking CXX executable greeter_client
[ 95%] Linking CXX executable greeter_async_client
[100%] Linking CXX executable greeter_async_server
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -lpthread
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -lpthread
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -lpthread
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -ldl
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -ldl
/home/csa/src/qnx//host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld: cannot find -ldl
I found the following link, looks like it might be cmake issue for -lpthread, but not sure about -ldl.
https://gitlab.kitware.com/cmake/cmake/-/issues/21579

library pthread of QNX is in libc
https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html

Related

mingw cross compiler won't link qt libs statically

I'm having trouble getting Qt to statically link its libraries when cross compiling from my Linux machine to windows. I added this to my config to make compile statically.
win32:CONFIG += -static
And by looking at the output of make it seems to have passed the flags correctly (omitting object files to make it short)
i686-w64-mingw32-g++ -static -static-libstdc++ -static-libgcc -Wl,-subsystem,windows -mthreads [exe and object files] /usr/i686-w64-mingw32/lib/libQt5Widgets.dll.a -ldwmapi -luxtheme /usr/i686-w64-mingw32/lib/libQt5Gui.dll.a -lopengl32 -lgdi32 -lcomdlg32 -loleaut32 -limm32 -ljpeg -lpng -L/usr/i686-w64-mingw32/lib -lfreetype -lbz2 -lharfbuzz -lm -lintl -lglib-2.0 -lshlwapi -lpcre -lgraphite2 /usr/i686-w64-mingw32/lib/libQt5Core.dll.a -lz -lpcre2-16 -liconv -lversion -lnetapi32 -luserenv -lole32 -luuid -lwinmm -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 /usr/i686-w64-mingw32/lib/libglu32.a /usr/i686-w64-mingw32/lib/libopengl32.a /usr/i686-w64-mingw32/lib/libgdi32.a /usr/i686-w64-mingw32/lib/libuser32.a -lmingw32 /usr/i686-w64-mingw32/lib/libqt5main.a -lshell32
As you can see the static flags are being passed to the compiler correctly, however I tried running the resulting exe in both WINE, and on a windows machine but in both cases it tells me that it failed to find the Qt dlls. The wine error log had more info so that's the one im providing
0009:err:module:import_dll Library Qt5Core.dll (which is needed by L"Z:\\home\\zee\\mapper\\release\\mapper.exe") not found
0009:err:module:import_dll Library Qt5Gui.dll (which is needed by L"Z:\\home\\zee\\mapper\\release\\mapper.exe") not found
0009:err:module:import_dll Library Qt5Widgets.dll (which is needed by L"Z:\\home\\zee\\mapper\\release\\mapper.exe") not found
0009:err:module:LdrInitializeThunk Importing dlls for L"Z:\\home\\zee\\mapper\\release\\mapper.exe" failed, status c0000135
I'm running on an Arch Linux machine with the latest qt5base aur package (5.13.1), and the latest mignw package (g++ 9.2.0)
Your compiler command line has both static and dynamic libraries. For instance: "/usr/i686-w64-mingw32/lib/libQt5Core.dll.a" is the import library for the dynamic "Qt5Core.dll". The right file to be linked in static mode would be "libQt5Core.a". Your problem looks similar to this report of the mingw project: https://github.com/msys2/MINGW-packages/issues/4970

How to fix C++ compiler is not able to compile github repo in R

I use Rtools c++ compiler to compile a github repo via cmake, and error says that C++ compiler Rtools/mingw_64/bin/g++.exe is not able to compile a simple test program.
devtools::install_github("tractatus/wholebrain", args='--no-multiarch')
.....
.....
-- The CXX compiler identification is GNU 4.9.3
-- The C compiler identification is GNU 4.9.3
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"C:/Rtools/mingw_64/bin/g++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Windows/Temp/RtmpuqHViQ/R.INSTALL5c036fc6900/ROpenCVLite/src/opencv-4.0.1/build64/CMakeFiles/CMakeTmp
Run Build Command:"C:/Rtools/bin/make.exe" "cmTC_96862/fast"
/Rtools/bin/make -f CMakeFiles/cmTC_96862.dir/build.make CMakeFiles/cmTC_96862.dir/build
make: /bin/sh: Command not found
make: *** [Makefile:121: cmTC_96862/fast] Error 127
and I try to install cmake in another version and rtools, but it seemly not work. So, what's the problem for this?

Building Qt for Linux x86 with fontconfig support

I'm porting my Qt app to Linux for x86 architecture, and since the last official release for that platform is 5.5, I'm trying to do my own build of Qt 5.11.3. I want to use fontconfig to enable use of system fonts. My build platform is Centos 7.5, and I'm using a GCC toolchain which builds x86 binaries with -m32 switch.
The problem is, I can't get it to see the fontconfig library. I've installed it with the package fontconfig-devel-2.13.0-4.3.el7.i686
When running configure with the option -fontconfig, I get the following error message:
ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.win32 && features.system-freetype && libs.fontconfig' failed.
My understanding from this is that I have to use -system-freetype and can't use -qt-freetype, but when I try that (also with -feature-freetype), I get this message:
ERROR: Feature 'system-freetype' was enabled, but the pre-condition 'features.freetype && libs.freetype' failed.
The relevant messages in config.log are:
looking for library freetype
Trying source 0 (type pkgConfig) of library freetype ...
pkg-config use disabled globally.
=> source produced no result.
Trying source 1 (type freetype) of library freetype ...
+ cd /home/myuser/qt-build/config.tests/freetype && /home/myuser/qt-build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" -early "CONFIG += cross_compile" 'LIBS += -lfreetype' /home/myuser/qt-build/config.tests/freetype
+ cd /home/myuser/qt-build/config.tests/freetype && MAKEFLAGS= /usr/bin/gmake
> g++ -c -m32 -pipe -O2 -std=gnu++11 -w -fPIC -I. -I/home/myuser/qt-everywhere-src-5.11.3/qtbase/mkspecs/linux-g++-32 -o main.o main.cpp
> main.cpp:2:22: fatal error: ft2build.h: No such file or directory
> #include <ft2build.h>
> ^
> compilation terminated.
> gmake: *** [main.o] Error 1
=> source failed verification.
test config.qtbase_gui.libraries.freetype FAILED
Now, I do also get this message:
WARNING: Cross compiling without sysroot. Disabling pkg-config
which I understand is the source of the "source 0" failure. I have however tried to point configure manually point it to the freetype include directory, by passing FREETYPE_INCDIR=/usr/include/freetype2 to configure; however, as can be seen in the log file, the value does not seem to be used when detecting freetype.
Am I missing a trick here, or are the configure scripts broken? And if it's the latter, is there a way to work around this?
EDIT: For completeness, the environment for running configure:
CFLAGS=-m32
CXXFLAGS=-m32 --std=c++1x
Configure flags:
-opensource
-xplatform linux-g++-32
-nomake tests -nomake examples -nomake tools
-prefix /home/myuser/qt_install/
-qpa xcb
-no-use-gold-linker
-icu ICU_PREFIX=/home/myuser/icu_install ICU_LIBS="-licui18n -licuuc -licudata"
-no-opengl
-fontconfig -feature-freetype -system-freetype FREETYPE_INCDIR=/usr/include/freetype2
Try using the Freetype library that is included inside Qt's sources: when running configure use the flag "-qt-freetype"
I've found it's possible to work around this by setting CPATH (and LIBRARY_PATH to point at a specific build of Freetype which it turned out I needed as well). It looks like the fact that FREETYPE_* variables are ignored when detecting the presence of Freetype is indeed a bug in the config scripts.

Error while testing QT test project

I have started using QT on Kubuntu. I first installed g++ via Package Manager. Then I installed QT 5.0.1. I then made a test project to check if everything is correct or not. Then I got following issues.
- cannot find -lGL
- collect2: error:Id returned 1 exit status
I saw in Compile Output
11:32:05: Running steps for project untitled2...
11:32:05: Configuration unchanged, skipping qmake step.
11:32:05: Starting: "/usr/bin/make" -w
make: Entering directory `/home/harsh/Desktop/untitled2-build-Desktop_Qt_5_0_1_GCC_64bit-Debug'
g++ -m64 -Wl,-rpath,/home/harsh/Qt5.0.1/5.0.1/gcc_64 -Wl,-rpath,/home/harsh/Qt5.0.1/5.0.1/gcc_64/lib -o untitled2 main.o mainwindow.o moc_mainwindow. -L/usr/X11R6/lib64 -L/home/harsh/Qt5.0.1/5.0.1/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [untitled2] Error 1
make: Leaving directory `/home/harsh/Desktop/untitled2-build-Desktop_Qt_5_0_1_GCC_64bit-Debug'
11:32:05: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled2 (kit: Desktop Qt 5.0.1 GCC 64bit)
When executing step 'Make'
Please help me fix these errors.
Qt != QT
The error tells you what is wrong, the compiler cannot find libGL.so. It's usually in /usr/lib64.

Qt 5.0 Build Warning

I have installed Qt 5.0 (the whole SDK) on Fedora 17. I have configured the compiler (GCC) and everything seems to be working fine, except that when I press "Ctrl-R" for having a demo of my GUI coding, I get the following error :
make: Entering directory `/home/Nisarg/Documents/Qt Projects/untitled-build-Desktop_Qt_5_0_1_GCC_32bit-Debug'
g++ -Wl,-rpath,/opt/Qt/5.0.1/gcc -Wl,-rpath,/opt/Qt/5.0.1/gcc/lib -o untitled main.o mainwindow.o moc_mainwindow.o -L/opt/Qt/5.0.1/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
**/usr/bin/ld: cannot find -lGL**
make: Leaving directory `/home/Nisarg/Documents/Qt Projects/untitled-build-Desktop_Qt_5_0_1_GCC_32bit-Debug'
collect2: error: ld returned 1 exit status
make: *** [untitled] Error 1
04:07:17: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled (kit: Desktop Qt 5.0.1 GCC 32bit)
When executing step 'Make'.
(The error above is that a file called -lGL is not found)
How do I go about solving this error ?
You will need to have the libGL development files installed. It's been awhile since I used Fedora, but check your package manager for a package named something like mesa-libGL-devel.

Resources