BenJuan26 / OpenSkyStacker

Multi-platform stacker for deep-sky astrophotography.
MIT License
101 stars 14 forks source link

Problem compiling #20

Closed markus-k closed 7 years ago

markus-k commented 7 years ago

I'm trying to compile on Ubuntu 17.10 (beta), but something seems to be wrong with the include paths. I'm not entirely sure if this is a project with the Qt project or a problem in Ubuntu, the latter seems unlikely to me though.

$ make
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -o Makefile /home/markus/build/OpenSkyStacker/src/src.pro qt=qt5 ) && make -f Makefile 
make[1]: Entering directory '/home/markus/build/OpenSkyStacker/src'
g++ -c -m64 -pipe -I/usr/include/opencv -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include/libraw -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I../build/moc -isystem /usr/include/libdrm -I../build/ui -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o ../build/o/linux/main.o main.cpp
In file included from /usr/include/c++/7/bits/stl_algo.h:59:0,
                 from /usr/include/c++/7/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:109,
                 from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QMainWindow:1,
                 from ui/mainwindow.h:4,
                 from main.cpp:1:
/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
Makefile:498: recipe for target '../build/o/linux/main.o' failed
make[1]: *** [../build/o/linux/main.o] Error 1
make[1]: Leaving directory '/home/markus/build/OpenSkyStacker/src'
Makefile:44: recipe for target 'sub-src-make_first-ordered' failed
make: *** [sub-src-make_first-ordered] Error 2

But stdlib.h exists:

$ ls -l /usr/include/stdlib.h 
-rw-r--r-- 1 root root 32664 Jul  1 23:13 /usr/include/stdlib.h

Some version info:

$ qmake --version
QMake version 3.1
Using Qt version 5.9.1 in /usr/lib/x86_64-linux-gnu

$ g++ --version
g++ (Ubuntu 7.2.0-3ubuntu1) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Any idea what's wrong here?

BenJuan26 commented 7 years ago

Never seen that problem before. It's especially weird since the file exists. Can you try commenting or removing line 127 of src/src.pro where it adds some directories to INCLUDEPATH? Then you probably want to make clean and rerun qmake and make.

markus-k commented 7 years ago

Yep, that helps. It doesn't like being included with with -isystem flags, thats weird.

Next up it won't add -lopencv_imgcodecs to the linker flags, even though it's in pkg-config --libs opencv.

There also seems to be a problem with the precompiled object files on my platform:

g++ -m64 -Wl,-O1 -o ../bin/openskystacker ../build/o/linux/main.o ../build/o/linux/mainwindow.o ../build/o/linux/imagestacker.o ../build/o/linux/processingdialog.o ../build/o/linux/star.o ../build/o/linux/stardetector.o ../build/o/linux/pixel.o ../build/o/linux/adjoiningpixel.o ../build/o/linux/focas.o ../build/o/linux/stackergraphicsview.o ../build/o/linux/triangle.o ../build/o/linux/imagerecord.o ../build/o/linux/imagetablemodel.o ../build/o/linux/optionsdialog.o ../build/o/linux/moc_mainwindow.o ../build/o/linux/moc_imagestacker.o ../build/o/linux/moc_processingdialog.o ../build/o/linux/moc_stackergraphicsview.o ../build/o/linux/moc_optionsdialog.o   -L/usr/X11R6/lib64 -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc /home/markus/build/OpenSkyStacker/src/3rdparty/focas/unix/hfti.o /home/markus/build/OpenSkyStacker/src/3rdparty/focas/unix/h12.o /home/markus/build/OpenSkyStacker/src/3rdparty/focas/unix/diff.o -lraw -lstdc++ -fopenmp -llcms2 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
/usr/bin/ld: /home/markus/build/OpenSkyStacker/src/3rdparty/focas/unix/hfti.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

I'll try to figure those out.

BenJuan26 commented 7 years ago

OpenCV for Ubuntu seems to use opencv_highgui for stuff that other versions use opencv_imgcodecs for. It's strange that it would be in your pkg-config. Might be best to remove that line entirely.

For the 3rdparty stuff, you need to get gfortran. Then compile with -fPIC like the error says:

gfortran -c hfti.f -fPIC

And repeat for h12.f and diff.f.

markus-k commented 7 years ago

I got it working now. Maybe the qmake version shipped with 17.10 is still a little buggy. My RAWs are not read correctly, but thats a separate problem, possibly not related to this project.

As for the fortran code, it might be best to either integrate it into the build process or transcode the code to C, shipping precompiled objects is not really a good idea IMO.