Menu

#1616 Build failed if Qt was built with -reduce-relocations

None
closed-accepted
nobody
None
2015-08-01
2015-05-31
pudh4418
No

Hi:

I'm an Archlinux user, and when I compile the latest cvs version from source,
it shows error like this:

depbase=echo wxterminal/gp_cairo.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
gcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\"/usr/bin\" -DX11_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DQT_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DGNUPLOT_SHARE_DIR=\"/usr/share/gnuplot/5.1\" -DGNUPLOT_PS_DIR=\"/usr/share/gnuplot/5.1/PostScript\" -DGNUPLOT_JS_DIR=\"/usr/share/gnuplot/5.1/js\" -DGNUPLOT_LUA_DIR=\"/usr/share/gnuplot/5.1/lua\" -DCONTACT=\"gnuplot-bugs@lists.sourceforge.net\" -DHELPFILE=\"/usr/share/gnuplot/gnuplot.gih\" -DGNUPLOT_X11=\"echo gnuplot_x11 | sed 's,x,x,'\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" -DQTGNUPLOT_DATA_DIR=\"/usr/share/gnuplot/5.1/qt\" -I/usr/include -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -pthread -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/qt/QtNetwork -I/usr/include/qt -I/usr/include/qt/QtSvg -I/usr/include/qt -I/usr/include/qt/QtPrintSupport -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt -I/usr/include/qt/QtGui -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/include/qt -g -O2 -MT wxterminal/gp_cairo.o -MD -MP -MF $depbase.Tpo -c -o wxterminal/gp_cairo.o wxterminal/gp_cairo.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=echo wxterminal/gp_cairo_helpers.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
gcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\"/usr/bin\" -DX11_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DQT_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DGNUPLOT_SHARE_DIR=\"/usr/share/gnuplot/5.1\" -DGNUPLOT_PS_DIR=\"/usr/share/gnuplot/5.1/PostScript\" -DGNUPLOT_JS_DIR=\"/usr/share/gnuplot/5.1/js\" -DGNUPLOT_LUA_DIR=\"/usr/share/gnuplot/5.1/lua\" -DCONTACT=\"gnuplot-bugs@lists.sourceforge.net\" -DHELPFILE=\"/usr/share/gnuplot/gnuplot.gih\" -DGNUPLOT_X11=\"echo gnuplot_x11 | sed 's,x,x,'\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" -DQTGNUPLOT_DATA_DIR=\"/usr/share/gnuplot/5.1/qt\" -I/usr/include -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -pthread -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/qt/QtNetwork -I/usr/include/qt -I/usr/include/qt/QtSvg -I/usr/include/qt -I/usr/include/qt/QtPrintSupport -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt -I/usr/include/qt/QtGui -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/include/qt -g -O2 -MT wxterminal/gp_cairo_helpers.o -MD -MP -MF $depbase.Tpo -c -o wxterminal/gp_cairo_helpers.o wxterminal/gp_cairo_helpers.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=echo qtterminal/qt_term.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
c++ -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\"/usr/bin\" -DX11_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DQT_DRIVER_DIR=\"/usr/bin/gnuplot/5.1\" -DGNUPLOT_SHARE_DIR=\"/usr/share/gnuplot/5.1\" -DGNUPLOT_PS_DIR=\"/usr/share/gnuplot/5.1/PostScript\" -DGNUPLOT_JS_DIR=\"/usr/share/gnuplot/5.1/js\" -DGNUPLOT_LUA_DIR=\"/usr/share/gnuplot/5.1/lua\" -DCONTACT=\"gnuplot-bugs@lists.sourceforge.net\" -DHELPFILE=\"/usr/share/gnuplot/gnuplot.gih\" -DGNUPLOT_X11=\"echo gnuplot_x11 | sed 's,x,x,'\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" -DQTGNUPLOT_DATA_DIR=\"/usr/share/gnuplot/5.1/qt\" -I/usr/include -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -pthread -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/qt/QtNetwork -I/usr/include/qt -I/usr/include/qt/QtSvg -I/usr/include/qt -I/usr/include/qt/QtPrintSupport -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt -I/usr/include/qt/QtGui -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/include/qt -g -O2 -I/usr/lib/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -fPIE -MT qtterminal/qt_term.o -MD -MP -MF $depbase.Tpo -c -o qtterminal/qt_term.o qtterminal/qt_term.cpp &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/qt/QtCore/qnamespace.h:37:0,
from /usr/include/qt/QtCore/qobjectdefs.h:41,
from /usr/include/qt/QtCore/qobject.h:40,
from /usr/include/qt/QtCore/qabstractanimation.h:37,
from /usr/include/qt/QtCore/QtCore:4,
from qtterminal/qt_term.cpp:51:
/usr/include/qt/QtCore/qglobal.h:1050:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)."
# error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
^
Makefile:921: recipe for target 'qtterminal/qt_term.o' failed
make[4]: *** [qtterminal/qt_term.o] Error 1

The 5.0.0 release version has this problem too.

Changing '-fPIE' to '-fPIC' solves this problem.

1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2015-05-31

    This one is a bit out of my league, but I think there is more to it than you suggest. My machines also have Qt5 built with reduce-relocations:

    Qt5Core.pc:qt_config=minimal-config small-config medium-config large-config full-config gtk2 gtkstyle fontconfig libudev evdev xlib xcb-render xcb-glx xcb-xlib xrender accessibility-atspi-bridge linuxfb c++11 accessibility openvg opengl shared qpa reduce_exports reduce_relocations clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify eventfd system-jpeg system-png png system-freetype no-harfbuzz system-zlib nis cups iconv glib dbus dbus-linked openssl-linked xcb xinput2 alsa pulseaudio icu concurrent audio-backend release
    

    yet gnuplot is perfectly happy being built with the -fPIE rather than -fPIC.
    I will add your description and fix to the RELEASE_NOTES, but I'd like guidance from somewhere who understands where this clash comes from to weigh in, since the gcc docs seem to me to suggest that changing -fPIE to -fPIC depends on the machine architecture.

    What architecture is your Arch system?

     
  • Ethan Merritt

    Ethan Merritt - 2015-06-15
    • status: open --> pending-accepted
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2015-08-01
    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.