terminal fails to build from source on fedora with standard compiler flags

Bug #1639883 reported by Fabio Valentini
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Terminal
Fix Released
Undecided
Unassigned

Bug Description

pantheon-terminal doesn't compile successfully on fedora with standard compiler flags.

When executing this command during the build (the final linking?):

/usr/bin/cc -ggdb -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld CMakeFiles/pantheon-terminal.dir/src/DBus.c.o CMakeFiles/pantheon-terminal.dir/src/Settings.c.o CMakeFiles/pantheon-terminal.dir/src/PantheonTerminal.c.o CMakeFiles/pantheon-terminal.dir/src/PantheonTerminalWindow.c.o CMakeFiles/pantheon-terminal.dir/src/TerminalWidget.c.o CMakeFiles/pantheon-terminal.dir/src/ForegroundProcessDialog.c.o CMakeFiles/pantheon-terminal.dir/src/UnsafePasteDialog.c.o CMakeFiles/pantheon-terminal.dir/src/Constants.c.o CMakeFiles/pantheon-terminal.dir/src/SearchToolbar.c.o -o pantheon-terminal -rdynamic -lgranite -lgee-0.8 -lgthread-2.0 -lvte-2.91 -lgtk-3 -latk-1.0 -lgio-2.0 -lz -lgnutls -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lglib-2.0 -lm

the following error occurs:

/usr/bin/ld: CMakeFiles/pantheon-terminal.dir/src/DBus.c.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
CMakeFiles/pantheon-terminal.dir/src/DBus.c.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Adding "-fPIC" to the CFLAGS manually fixes this problem, but having to resort to tweaking CFLAGS manually seems like an indication that something else might be wrong here (CFLAGS not being passed to all commands correctly? a CMake error? I don't know). Also, this is the only elementary / pantheon package where this specific error occurs, so it seems to be specific to the pantheon-terminal build configuration.

For reference, the standard compilation flags on fedora are:

CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'

LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'

Looking at the CMakeLists.txt file, the only odd thing I find is this snippet:

# Work around http://www.cmake.org/Bug/view.php?id=12928:
# CMake ignores CPPFLAGS where Debian and Ubuntu pass their hardening options.
# See the bug linked above and https://wiki.debian.org/Hardening for more info.
add_definitions (${CPPFLAGS})

which is not present in all other packages I have checked (the linked bug is also *ancient*).

Revision history for this message
Fabio Valentini (decathorpe) wrote :

By the way, this has been fixed as part of no longer overriding all CFLAGS in CMake. (Fix is already released).

Changed in pantheon-terminal:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.