Problems compiling GCC-CilkPlus 4.9 - unix

I am trying to compile, on my x86_64 RHEL machine (CentOS 6.4), the GCC compiler with Intel CilkPlus (v4.9) module for compiling applications targeting parallel multicore platforms.
I am following GNU GCC Doc for installation which is very very similar for the GCC with CilkPlus extension. I was particularly focused on providing good attention to the Prerequisites and Configuration sections of the before-mentioned doc.
1) Download
I did download everything I needed using this snapshot as specified in the Instructions page. Download was successful and un-tar as well. I did rename the folder as cilkplus-gcc and put it under my $HOME directory.
I also created another directory: $HOME/b-gcc from where I intend to run the configure command and then make commands. This will prevent from installing into the same directory (something undesirable for this procedure which encourages building everything on a different directory).
2) Initial configuration
As specified in the documentation, I moved into the $HOME/cilkplus-gcc/contrib directory in order to build the three most important libraries needed by the installation process (that is: compiling GCC):
GMP: located into the $HOME/cilkplus-gcc/contrib/gmp-4.3.2 directory.
MPFR: located into the $HOME/cilkplus-gcc/contrib/mpfr-2.4.2 directory.
MPC: located into the $HOME/cilkplus-gcc/contrib/mpc-0.8.1 directory.
I build them in the order of appearance as MPFR depends on GMP and MPC depends on both GMP and MPFR. I wanted to place ll needed files into the $HOME/cilkplus-gcc directory so I instructed the installers of these libraries to place everything into the $HOME/cilkplus-gcc/contrib/tmp directory. So:
sudo $HOME/cilkplus-gcc/contrib/gmp-4.3.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpfr-2.4.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpc-0.8.1/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp
As direct result, my $HOME/cilkplus-gcc/contrib/tmp directory is filled with directories lib, include, share and bin with those three libs inside.
3) Installation
Time to get busy compiling everything. I move into the $HOME/b-gcc directory and from there I issue the following command:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/
The configuration goes smoothly and creates make stuff into my current folder ($HOME/b-gcc). Time to make and I issue: sudo make.
Two minutes and I get this error
g++ -c -g -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -fno-common -DHAVE_CONFIG_H -I. -Ic-family -I/home/andry/cilkplus-gcc/gcc -I/home/andry/cilkplus-gcc/gcc/c-family -I/home/andry/cilkplus-gcc/gcc/../include -I/home/andry/cilkplus-gcc/gcc/../libcpp/include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/gcc/../libdecnumber -I/home/andry/cilkplus-gcc/gcc/../libdecnumber/bid -I../libdecnumber -I/home/andry/cilkplus-gcc/gcc/../libbacktrace /home/andry/cilkplus-gcc/gcc/c-family/cppspec.c -o
c-family/cppspec.o g++ -g -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -o cpp gcc.o ggc-none.o \ c-family/cppspec.o driver-i386.o libcommon-target.a \
libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a /home/andry/b-gcc/./gcc/xgcc
-B/home/andry/b-gcc/./gcc/ -dumpspecs > tmp-specs /home/andry/b-gcc/./gcc/xgcc: error while loading shared libraries:
libiconv.so.2: cannot open shared object file: No such file or
directory make3: * [specs] Error 127 make3: Leaving directory
/home/andry/b-gcc/gcc' make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory/home/andry/b-gcc' make1: *
[stage1-bubble] Error 2 make1: Leaving directory
`/home/andry/b-gcc'
But I check my /usr/local/lib folder and I can clearly see that libiconv.so.2 is there! So I understand the installation procedure (that is GCC compiling itself) cannot find the library (clearly referenced as I can see the -liconv flag). So I delete everything in $HOME/b-gcc and issue a modified configure command:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/ --with-stage1-ldflags=-L/usr/local/lib
As I issue sudo make again, the previous error is not encountered anymore and time passes. After 5/6 minutes I get this error:
checking for x86_64-unknown-linux-gnu-ar... ar checking for
x86_64-unknown-linux-gnu-lipo... lipo checking for
x86_64-unknown-linux-gnu-nm... /home/andry/b-gcc/./gcc/nm checking
for x86_64-unknown-linux-gnu-ranlib... ranlib checking for
x86_64-unknown-linux-gnu-strip... strip checking whether ln -s
works... yes checking for x86_64-unknown-linux-gnu-gcc...
/home/andry/b-gcc/./gcc/xgcc -B/home/andry/b-gcc/./gcc/
-B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/bin/ -B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/lib/ -isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/include
-isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in
/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc': configure:
error: cannot compute suffix of object files: cannot compile See
config.log' for more details. make2: *
[configure-stage1-target-libgcc] Error 1 make2: Leaving directory
/home/andry/b-gcc' make[1]: *** [stage1-bubble] Error 2 make[1]:
Leaving directory/home/andry/b-gcc'
Well, quite a strange stuff... So I checked $HOME/b-gcc/x86_64-unknown-linux-gnu/libgcc/config.log (gonna show the relevant excerpt):
-isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
-c -g -O2 conftest.c >&5 /home/andry/b-gcc/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file:
No such file or directory configure:3593: $? = 1 configure: failed
program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU C Runtime
Library" | #define PACKAGE_TARNAME "libgcc" | #define PACKAGE_VERSION
"1.0" | #define PACKAGE_STRING "GNU C Runtime Library 1.0" | #define
PACKAGE_BUGREPORT "" | #define PACKAGE_URL
"http://www.gnu.org/software/libgcc/" | /* end confdefs.h. */ | |
int | main () | { | | ; | return 0; | } configure:3607: error: in
/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc':
configure:3610: error: cannot compute suffix of object files: cannot
compile Seeconfig.log' for more details.
Saying that the error is basically the following:
/home/andry/b-gcc/./gcc/cc1: error while loading shared libraries:
libmpc.so.2: cannot open shared object file: No such file or directory
But didn't I already told it (during configure) to go search for libmpc.so.2 into $HOME/cilkplus-gcc/contrib/tmp???
How can I get things done?
How can I get through this? Thankyou

**
I downloaded the snapshot of the cilkplus branch from http://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/cilkplus-4_8-branch and click the snapshot link on the top line of the list of checkins. It will take a few moments for the server to fetch the sources and build a compressed tarfile. Once the compressed tarfile has downloaded, unpack it using the following commands after placing it in directory /home :
cd /home
tar -xf gcc-3cfca5e.tar.gz
This creates a directory gcc-3cfca5e
Download latest mpfr, mpc and gmp and place these tarballs into the gcc-3fca5e directory.
cd /home/gcc-3cfca5e
tar -jxvf mpfr-3.1.2.tar.bz2
tar -xzvf mpc-1.0.1.tar.gz
tar -vxjf gmp-5.1.3.tar.bz2
ln -sf mpfr-3.1.2 mpfr
ln -sf mpc-1.0.1 mpc
ln -sf gmp-5.1.3 gmp
cd /home
mkdir gcc-cilk-obj
mkdir gcc-cilk
cd /home/gcc-cilk-obj
../gcc-3cfca5e/configure --prefix=/home/gcc-cilk --disable-multilib -enable-languages=c
make
make install
============
It took about 4 hours to make on a core 2 duo running Slackware current inside VirtualBox 4
(VBox settings>system>processor> check enable PAE) Windows 7 professional. My linux system did not have autogen but it worked anyway.

Related

gcc Compling and linking object file and source file at the same time

In a nutshell , the issue is I have some object file (say a.o , b.o ) and some source file (f.c and g.c)
I have to compile and link in a single step.
This is what I am doing but I don't think this is the write way atleast I should give something like -l or -L for linking
gcc -Wall -O0 -ggdb -fPIC a.o b.o f.c g.c -o executable
This is the correct way, -l is used to link to a library (for example, the ptheads library needs -lpthread) and -L is used to add directories to the directories in which the linker looks for library files.
There is nothing wrong with compiling the software this way.
Most build systems build files one at a time in order to avoid having to rebuild the object file in case the source file was not modified and the object file still exists. If you are fine with rebuilding code, then your approach is perfectly valid.

Buildroot: qt application with an empty install target

I am integrating my own Qt app into buildroot. *.mk file follows.
CATCHER_SITE=http://g7/gitlab/igorsk/catcher.git
CATCHER_SITE_METHOD=git
CATCHER_VERSION=master
CATCHER_DEPENDENCIES=qt
ifeq ($(BR2_PACKAGE_QT5),y)
CATCHER_QMAKE = $(QT5_QMAKE)
else
CATCHER_QMAKE = $(QT_QMAKE)
endif
define CATCHER_CONFIGURE_CMDS
(cd $(#D); $(TARGET_MAKE_ENV) $(CATCHER_QMAKE))
endef
define CATCHER_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(#D)
endef
define CATCHER_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) INSTALL_ROOT=$(TARGET_DIR) -C $(#D) install
endef
$(eval $(generic-package))
The app compiles, but it doesn't get installed to a target directory (and therefore to resulting rootfs ). During buildroot's "Installing to target" phase I get Nothing to be done for 'install'. message. buildroot/output/build/catcher-master/Makefile has emtpy install rule.
Buildroot 2015.08.1
Qt 4.8.7
The question is: why is this happening and how do I get my app installed to target?

How to compile a Qt application through the command line with MinGW?

I have downloaded the latest Qt version for MinGW, and I have the correct MinGW version which is compatible with Qt. When I try to make the project, g++ is unable to find my source file even if it's in the same folder as the project file.
Those are the steps I followed (all project and source files are in T:\QtTest ):
T:\QtTest> qmake -project
T:\QtTest> qmake
T:\QtTest> make
And the output is this:
T:\QtTest> make
mingw32-make -f Makefile.Debug
mingw32-make1: Entering directory `T:/QtTest’
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -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 -DQT_NEEDS_QMAIN -I“c:\Qt\4.8.0\include\QtCore” -I“c:\Qt\4.8.0\include\QtGui” -I“c:\Qt\4.8.0\include” -I”.” -I“c:\Qt\4.8.0\include\ActiveQt” -I“debug” -I“c:\Qt\4.8.0\mkspecs\default” -o debug\main.o main.cpp
g++: main.cpp: no such file or directory
g++: no input files
mingw32-make1: *** [debug/main.o] Error 1
mingw32-make1: Leaving directory `T:/QtTest’
mingw32-make: *** [debug] Error 2
I have no idea why it can't find "main.cpp" file when it's in the same directory as the
project files. Even if I replace "main.cpp" with the full path ("T:\QtTest\main.cpp") it still won't find it. What am I doing wrong?
The following is my project structure:
(main.cpp is the only file that I wrote, all the others were generated by qmake)
T:\QtTest\main.cpp
T:\QtTest\Makefile
T:\QtTest\Makefile.debug
T:\QtTest\Makefile.release
T:\QtTest\QtTest.pro
T:\QtTest\debug\
T:\QtTest\release\
My g++ version is 4.4.0, which is the version suggested by the Qt installer and available for download in the same page as the Qt for MinGW installer.
Problem solved.
It had nothing to do with MinGW or Qt or the makefiles generated by qmake. I found it was caused solely by a custom entry in the Windows registry. I'm posting this solution for anyone who encounters the same problem:
Sometime ago I had created an entry in the Windows registry under HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor called Autorun, which makes CMD.exe start in a custom working directory, which was something I wanted to do (so I followed the steps detailed in this page about "How to change the default startup directory for Command Prompt": http://windowsxp.mvps.org/autoruncmd.htm).
Well, I completely neglected the CAUTION part in that page, which states that "Changing the current directory using Autorun value as mentioned in this article, might affect the functionality of batch scripts". Yes, shame on me.
So, if you have the same problem of being unable to make your Qt projects using qmake, and everything else looks OK in your project structure and makefiles, verify that you don't have something in the Windows registry which might change the startup directory for the command prompt.
Do you have MSYS installed? If sh.exe from MSYS is on the system path, it may conflict with the interpretation of windows style paths. Check the documentation here.
If that isn't the problem, then delete everything in your project folder except the source files and start over again with qmake -project. After that step, open the .pro file and verify that things look correct. For a very basic project, I get something like this:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += widget.h
FORMS += widget.ui
SOURCES += main.cpp widget.cpp
The next two steps, running qmake and then make should work correctly. If not, there is nothing wrong with the steps you followed and there is something wrong with your system/environment.

Qt Creator Error

Launching debugging for a project and then,
Running build steps for project Text_Editor...
Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/Text_Editor/Text_Editor.pro -r -spec win32-g++
The process "c:/qt/2010.05/qt/bin/qmake.exe" exited normally.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'
C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\qt\include\QtCore" -I"..\qt\include\QtGui" -I"..\qt\include" -I"..\qt\include\ActiveQt" -I"debug" -I"..\Text_Editor" -I"." -I"..\qt\mkspecs\win32-g++" -o debug\main.o ..\Text_Editor\main.cpp
mingw32-make[1]: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'
mingw32-make: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'
g++: ..\Text_Editor\main.cpp: No such file or directory
g++: no input files
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project Text_Editor (target: Desktop)
When executing build step 'Make'
I have no clue on that. I just installed it, created a new project and got that error instantly.
I had pretty much the same problem just now.
Without getting into "why" - I unticked "Shadow build" from project options and my build was succesful. Funny part is - "Shadow build" worked yesterday, and nothing really changed that much in between.
For reason or another it is not able to find your main.cpp (g++: ..\Text_Editor\main.cpp: No such file or directory). Basically that path should be ok if you have shadow build toggled on.
Location where the main.cpp is tried to find is:
C:/Qt/2010.05/Text_Editor/main.cpp
Double check that this is proper location (notice also case sensitivity to be sure)
you can try toggling off the shadow build from project -> check off shadow build. And also you should check that Text_Editor.pro contains properly the main.cpp.
Edit: It might be also wise to create that project outside the Qt binary folder, to some other more logical folder.
Try to change your build directory from C:/Qt/2010.05/Text_Editor-build-desktop to C:/Qt/2010.05/Text_Editor.
To do this just open your project in Qt creator, left click on Project on the left pane, then open build settings tab and edit Build directory input field.
What worked for me was the way I added headers in a .pri.
This works...
HEADERS += ../serialportwidget.h
HEADERS += ../serialportworker.h
SOURCES += ../serialportwidget.cpp
SOURCES += ../serialportworker.cpp
or this
HEADERS += ../serialportwidget.h \
../serialportworker.h
SOURCES += ../serialportwidget.cpp \
../serialportworker.cpp
This doesn't...
HEADERS += ../serialportwidget.h \ ../serialportworker.h
SOURCES += ../serialportwidget.cpp \ ../serialportworker.cpp
Run Qt Creator with "Run as Administrator".
Problem Solved for [debug/main.o] error5
-
Vivin NL

an error in qt_creator

I begin to study qt (I have qt creator, last version), so I read the reference how to begin to work with it and I'm trying to compile project "Animated Tiles" but I receive an error, can somebody please explain why:
Running build steps for project animatedtiles...
Configuration unchanged, skipping qmake step.
Starting: "D:/QT_prog/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: Nothing to be done for `all'.
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\release_shared" -I"..\animatedtiles" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o ..\animatedtiles\main.cpp
..\animatedtiles\main.cpp:257:20: error: main.moc: No such file or directory
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
mingw32-make: *** [release-all] Error 2
The process "D:/QT_prog/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project animatedtiles (target: Desktop)
When executing build step 'Сборка'
Looks like the main.moc file hasn't be generated.
Try this:
Clean the Project "Build" -> "Clean All" or "Clean Project "
Build the project again, Ctrl+B
If that doesn't work then:
Comment out the #include "main.moc" line at the end of main.cpp
Perform a build, moc should run and create main.moc, but the build will fail.
Uncomment #include "main.moc", and build again. Should work
Edit:
I'm not very familiar with qt creator, so you might also want to try just remove the #include "main.moc" line altogether. QMake might be smart enough and figure out what to do.
The suggested solution did not work for me. I had to copy main.moc from release_shared up to the directory containing main.cpp. QT 2010.05, Win7.
I think you are experiencing this:
http://bugreports.qt.io/browse/QTCREATORBUG-1889
I was able to reproduce this issue with Qt SDK 2010.04.
Install Qt SDK 2010.04 on Windows 7
Open animatedtiles
Build
Removing c:\Qt\2010.04\qt\exmaples\animation\animatedtiles\tmp\moc\release_shared\main.moc manually solved the issue.

Resources