Static Qt Build Cryptic Error - qt

I am trying to do a static build of Qt (4.8.1) using mingw32-make (gcc 4.7.0) so that I can statically link my application for the sake of ease of use/delivery.
I keep getting a strange error from mingw32-make, though, which I do not understand.
../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h:270:103: warning: control reaches end of non-void function [-Wreturn-type]
Makefile.Release:2033: recipe for target 'obj/release/JSBase.o' failed
mingw32-make[2]: *** [obj/release/JSBase.o] Error 1
mingw32-make[2]: Leaving directory 'C:/StaticQt/qt/src/script'
Makefile:34: recipe for target 'release' failed
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory 'C:/StaticQt/qt/src/script'
Makefile:1360: recipe for target 'sub-script-sub_src_target_ordered' failed
mingw32-make: *** [sub-script-sub_src_target_ordered] Error 2
Looking in the associated Makefile.Release file, on the indicated lines, I find these:
Makefile.Release 2033: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/release/JSBase.o ../3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp
Makefile.Release 1360: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/release/pcre_compile.o ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_compile.cpp
Makefile 34: $(MAKE) -f $(MAKEFILE).Release
I really understand very little about makefiles, so haven't a clue what these lines mean. Any help with this would be very much appreciated.
EDIT: it just occured to me it may be useful for people to know the commandline arguments I used... Well, I followed this guide: http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows

There were syntax errors in the code for some reason. Somebody must've updated the Qt Git with the wrong code just before I downloaded it. I got the code from elsewhere and managed to get it to compile using visual studio's nmake instead... turned out it didn't really matter whether I used mingw or vc2008.

Related

undefined reference to `dlsym'

I'm trying to cross compile QT for the raspberry PI 3 under Debian Stretch but when I use make -j4 to compile QT, it gives the following error:
$ make -j4>log
/home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[5]: *** [../../../../plugins/platforms/libqminimalegl.so] Error 1
make[4]: *** [sub-minimalegl-make_first] Error 2
make[4]: *** Waiting for unfinished jobs....
/home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[6]: *** [../../../../lib/libQt5EglFSDeviceIntegration.so.5.8.1] Error 1
make[5]: *** [sub-eglfsdeviceintegration-pro-make_first-ordered] Error 2
make[4]: *** [sub-eglfs-make_first] Error 2
make[3]: *** [sub-platforms-make_first] Error 2
make[2]: *** [sub-plugins-make_first] Error 2
make[1]: *** [sub-src-make_first] Error 2
make: *** [module-qtbase-make_first] Error 2
I have read a lot of similar posts containing the same dlsym error and I have tried the solutions given in them, but no luck so far. I have proceeded as it is shown in here and until now I still have doubts about the symlinks in lib directory.
When I run sudo file * | grep broken, 2 symlinks are reported to be broken, even after running the script that supposedly fixes the symlinks (as sudo).
./fixQualifiedLibraryPaths /mnt/raspberry-rootfs/ ~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
The symlinks that appear to be broken are listed below:
libblas.so.3gf: broken symbolic link to /etc/alternatives/libblas.so.3gf
liblapack.so.3gf: broken symbolic link to /etc/alternatives/liblapack.so.3gf
The ./configure is executed as follows:
./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
Do you guys can point me out what I am doing wroing?
PD: I also installed the libncurses5 and lib32z1 and I obtained qt by git cloning.
I ran into the same problem, proceeding as you did but using the gcc-5.4.1-linaro-gnueabihf toolchain. Unfortunately I did not find the root cause, but a workaround is calling configure like
LIBS=-ldl ./configure ...
with raspbian stretch egl libs has different names
/opt/vc/lib/libEGL.so -> /opt/vc/lib/libbrcmEGL.so
/opt/vc/lib/libGLESv2.so -> /opt/vc/lib/libbrcmGLESv2.so
so, I eddited this file in Qt sources:
./qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
and changed
-lEGL -lGLESv2
to
-lbrcmEGL -lbrcmGLESv2
the symlinks was broken when mount to host,
$ cd /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/
$ sudo rm libdl.so
$ sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 libdl.so
I faced the same issue, tried to follow Miguel Angel Pons solution, but then realized that missed to update my raspberry with:
sudo rpi-update
Solution is taken from https://wiki.qt.io/RaspberryPi2EGLFS#Step_by_step. It is refferencing to https://bugreports.qt.io/browse/QTBUG-62216 and should fix the libraries exactly which compiler complains to.
After that I repeated 8 and 9 steps, cleaned up the source tree, reconfigured and finally successfully built qt for raspberry.

gcc not found by win-builder

I've built an R package which includes C/C++ code. I am now trying to test this package on win-builder. Unfortunately, the following error is returned in 00install.out:
* installing *source* package 'mypackage' ...
** libs
running 'src/Makefile.win' ...
/usr/bin/make --directory=lib/mylib/
gcc -g -Wall -fPIC -c mycode.c
make[1]: gcc: Command not found
make[1]: *** [mycode.o] Error 127
make: *** [mylib] Error 2
Warning: running command 'make --no-print-directory -f "Makefile.win"' had status 2
ERROR: compilation failed for package 'mypackage'
* removing 'd:/RCompile/CRANguest/R-release/lib/mypackage'
Trying with gcc, gcc.exe, and cc yielded similar results.
Accordingly, I set up a testing environment on a Windows virtual machine according to these instructions. Running R CMD INSTALL . on the code from the command line within this environment resulted in the code compiling and the package installing without issue. (Running R CMD build . also yielded no errors.)
What's up with win-builder, and how can I achieve compilation on it?
Or, more importantly, is being able to build the package on Windows sufficient, regardless of whether it worked on win-builder?
My Makefile.win is as follows:
export CCOMP = gcc
export CPPCOMP = c++
export ADD_CC_FLAGS = -O3
APP_DIR = ./apps/myapp
LIB_DIR = ./lib/mylib
.PHONY: all $(APP_DIR) $(LIB_DIR)
all: $(APP_DIR) $(LIB_DIR)
$(APP_DIR) $(LIB_DIR): mylib
$(MAKE) --directory=$#
$(APP_DIR): $(LIB_DIR) mylib
mylib:
$(MAKE) --directory=lib/mylib
Inserting echo %PATH% into the make file under the mylib target yielded:
Makefile.win:24: *** missing separator. Stop.
You get an obscure error here because you included a file Makefile.win.
But the semantics of make, if such a file is found, it will be used ... which is not what you want here. R builds its own Makefile.win and you are supposed to only supply a snippet to be included -- which must be called Makevars.win.
That is rule number one. Rules number two is to not included all the material you would include in a Makefile -- as you would clobber what R already brings to the table. All this is in Writing R Extensions but could of course be clearer.
My pragmatic suggestion: take a package you know and like which has a working R build in win-builder, and modify it. You can test locally should you have access to an R system with Rtools etc pp.
Edit from OP:
I needed to compile an executable which relied on several libraries. The library codes were in src/libs and the executable's code was in src/apps. I ensured that running make within each subdirectory worked and set src/apps/Makefile to use relative paths to pull in the results of src/libs. The only problem then, was getting the whole chain running. To do so, I created a file src/Makevars.win which had the following structure:
.PHONY: all myprogram sublib1 sublib2
all: sublib1 sublib2 myprogram
myprogram: sublib1 sublib2
#(cd apps/myprogram && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
sublib1:
#(cd lib/sublib1 && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
sublib2:
#(cd lib/sublib2 && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
As I understand it, Makevars.win gets embedded in a dynamically generated Makefile that R produces. So, $(CC) is actually referencing this hidden code.
(There are probably more clever ways to do this.)

make qglviewer gives QT related errors

I want to install libQGLViewer, which I downloaded from http://www.libqglviewer.com/download.html on Ubuntu 10.04. According to the manual I have to do;
1) cd QGLViewer/
2) qmake
3) make
Compiling the library by typing make almost immediately ends in error however;
`c++ -c -pipe -Wall -W -Os -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/macx-g++ -I. -I/usr/include/qt3 -I/System/Library/Frameworks/OpenGL.framework/Headers -I/System/Library/Frameworks/AGL.framework/Headers/ -I.moc/ -o .obj/qglviewer.o qglviewer.cpp
In file included from domUtils.h:23,
from qglviewer.cpp:23:
config.h:77:22: error: QGLWidget: No such file or directory
config.h:88:17: error: QList: No such file or directory
config.h:89:19: error: QVector: No such file or directory
In file included from qglviewer.cpp:23:
domUtils.h:25:23: error: QDomElement: No such file or directory
domUtils.h:26:19: error: QString: No such file or directory
domUtils.h:27:23: error: QStringList: No such file or directory
domUtils.h:28:18: error: QColor: No such file or directory
`
this goes on for a while and ends in:
`qglviewer.cpp:841: error: ‘height’ was not declared in this scope
qglviewer.cpp: At global scope:
qglviewer.cpp:864: error: variable or field ‘timerEvent’ declared void
qglviewer.cpp:864: error: ‘QTimerEvent’ was not declared in this scope
qglviewer.cpp:864: error: expected primary-expression before ‘)’ token
make: *** [.obj/qglviewer.o] Error 1
rcar#DUD3642RCAR:~/Downloads/libQGLViewer-2.5.1/QGLViewer$
`
I think this is because it cannot find the QT library. But I have installed QT 5.2 using the latest download from http://qt-project.org/downloads.
Could it be the Makefile just can not locate the library path? And if so I how do I mend this?
Solved it! I missed qtcreator for this; sudo apt-get install qtcreator
I also needed an upgrade to Ubuntu 12.04 because on 10.04 this problem persisted.

The command "make serve" not working

I have installed the pNaCl SDK and have run the command "make serve", as instructed to by the website https://developers.google.com/native-client/dev/devguide/tutorial/tutorial-part1 into my console, it does not run any server and produces the error message:
C:\Users\USERNAME\Documents\nacl_sdk\nacl_sdk\pepper_33\getting_started>make serv
e
C:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper_33/tools/make -C part1 all
process_begin: CreateProcess(NULL, python C:/Users/USERNAME/Documents/nacl_sdk/na
cl_sdk/pepper_33/tools/getos.py, ...) failed.
make[1]: Entering directory 'C:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper
_33/getting_started/part1'
make[1]: Makefile:27: pipe: No error
C:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper_33/toolchain/_pnacl/bin/pnac
l-clang++ -o hello_tutorial.bc hello_tutorial.cc -O2 -IC:/Users/USERNAME/Document
s/nacl_sdk/nacl_sdk/pepper_33/include -LC:/Users/USERNAME/Documents/nacl_sdk/nacl
_sdk/pepper_33/lib/pnacl/Release -lppapi_cpp -lppapi
process_begin: CreateProcess(NULL, C:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/
pepper_33/toolchain/_pnacl/bin/pnacl-clang++ -o hello_tutorial.bc hello_tutorial
.cc -O2 -IC:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper_33/include -LC:/Us
ers/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper_33/lib/pnacl/Release -lppapi_cpp
-lppapi, ...) failed.
make (e=2): The system cannot find the file specified.
Makefile:50: recipe for target 'hello_tutorial.bc' failed
make[1]: *** [hello_tutorial.bc] Error 2
make[1]: Leaving directory 'C:/Users/USERNAME/Documents/nacl_sdk/nacl_sdk/pepper_
33/getting_started/part1'
Makefile:46: recipe for target 'part1_ALL_TARGET' failed
make: *** [part1_ALL_TARGET] Error 2
My username is inserted in the place of USERNAME.
Any ideas what is going on?
I looks like perhaps python is not present in you PATH? Can you run "python" on the command line? What does "where python" produce?
I'm somewhere surprised since python is required to install the SDK in the first place. I've opened a ticket to handle this failure mode:
https://code.google.com/p/chromium/issues/detail?id=348139
I solved this, had the same issues, what i did was (my setup):
It seems compile script doesn't like paths with spaces, like: "C:\Documents and ...".
Make sure python path is at environment variables. "C:\Python27"
Put nacl_sdk folder in "C:\stationary".
Put custom environment variable NACL_SDK_ROOT to "C:\stationary\nacl_sdk\pepper_34".
There i did immediate variable assignee.
A. "cd C:\stationary\nacl_sdk\pepper_34\getting_started".
B. "set NACL_SDK_ROOT C:\stationary\nacl_sdk\pepper_34". This must point to the pepper version you want to build against,
C. "make serve".
And that's it! Works, compiled!
I have encountered and solved the same issue. using comment on old post. I tried building one of the other examples and they seem to work while the getting started one doesn't.
"You will have a hard time building those ppapi tests. I suggest trying to build one of the examples provided with the SDK. If you really need to build that test (it isn't an example) you will need to use clang (another C/C++ toolchain). However, from a cursory look, those tests aren't actually built in NaCl, nor do they generate a PPAPI plugin. I have never gotten clang working on Windows, but it is apparently possible. See clang.llvm.org/get_started.html for instructions using Visual Studio. I would probably use MinGW instead, but I can't find decent instructions for that. – DRayX Oct 21 '13 at 16:08 "

Build QT statically ver 5.0.2

I am trying to build the QT static version by using the information from this link Qt - 4.7.3 - How to make static build. But i am using 5.0.2 as i have developed some applications using the same.
I am using windows 64 bit + MINGW32 and active-perl.
First-fix:
I had to comment the line number 45(if not exist %QTSRC%.gitignore goto sconf) in the file qt-everywhere-opensource-src-5.0.2\qtbase\configure.bat
My configuration command looks like this ..\qt-everywhere-opensource-src-5.0.2\configure -platform win32-g++ -static -release -no-opengl . This executed well without any errors.
Problem:
Now i run mingw32-make. And i get an error which says
/usr/bin/sh: c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe: Invalid argument
mingw32-make[2]: *** [sub-tools-make_first] Error 126
I have pasted the entire error log below. Could any body please kindly point me the cause of this error or the solution.
Entire error log
C:\Qt\qt-everywhere-opensource-src-5.0.2\qt>mingw32-make
cd qtbase/ && ( test -e Makefile || C:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake C:/Qt/qt-everywhere-ope
nsource-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/qtbase.pro -o Makefile ) && mingw32-make -f Makefile
mingw32-make[1]: Entering directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase'
cd src/ && ( test -e Makefile || C:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake C:/Qt/qt-everywhere-openso
urce-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/src/src.pro -o Makefile ) && d:/tools/Dev-Cpp/MinGW32/bin/mingw
32-make -f Makefile
mingw32-make[2]: Entering directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/src'
cd tools/ && ( test -e Makefile || c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe C:/Qt/qt-everywhere-
opensource-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/src/tools/tools.pro -o Makefile ) && d:/tools/Dev-Cpp/Min
GW32/bin/mingw32-make -f Makefile
/usr/bin/sh: c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe: Invalid argument
mingw32-make[2]: *** [sub-tools-make_first] Error 126
mingw32-make[2]: Leaving directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/src'
mingw32-make[1]: *** [sub-src-make_first] Error 2
mingw32-make[1]: Leaving directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase'
mingw32-make: *** [module-qtbase-make_first] Error 2
Static builds are supported from Qt 5.1, not 5.0. You might want to upgrade ;-)

Resources