[GRASS-dev] G70: wximgview compilation issue and fix

Glynn Clements glynn at gclements.plus.com
Thu Sep 15 16:50:35 PDT 2016


Markus Neteler wrote:

> when compiling GRASS GOS 7.0.svn on Fedora 24, I get
> 
> neteler at oboe wximgview]$ make
> : && c++ -L/home/neteler/software/grass70/dist.x86_64-pc-linux-gnu/lib
> -L/home/neteler/software/grass70/dist.x86_64-pc-linux-gnu/lib
> -Wl,--no-undefined -Wl,-z,now -Wl,--export-dynamic
> -Wl,-rpath-link,/home/neteler/software/grass70/dist.x86_64-pc-linux-gnu/lib
> -o /home/neteler/software/grass70/dist.x86_64-pc-linux-gnu/bin/wximgview
> OBJ.x86_64-pc-linux-gnu/main.o    -lgrass_gis.7.0.5svn -pthread
> -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
> -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8
> -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8
> -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8
> -lwx_baseu-2.8    -lm
> /usr/bin/ld: OBJ.x86_64-pc-linux-gnu/main.o: relocation R_X86_64_32
> against `.rodata' can not be used when making a shared object;
> recompile with -fPIC

But it's not trying to make a shared object.

My guess is that it's related to -Wl,-z,relro, possibly an interaction
between that flag and either C++ or the wxWidgets libraries.

> This patch solves it:

> -EXTRA_CFLAGS = $(WXWIDGETSCXXFLAGS) -DWXINTL_NO_GETTEXT_MACRO
> +EXTRA_CFLAGS = $(WXWIDGETSCXXFLAGS) -DWXINTL_NO_GETTEXT_MACRO -fPIC

> but I am not sure if it is the right solution to be applied to SVN.
> 
> Any ideas?

Executables shouldn't require -fPIC.

It may be that we need separate LINK_FLAGS variables for C and C++
programs.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list