You must build your code with position independent code if Qt was built with -reduce-relocations

Submitted by soso928 on Fri, 09/07/2018 - 04:43

I tried to follow the instructions from Install.MD of PARSCALE, but kept receiving error messages from Qt such as:

n file included from /usr/include/x86_64-linux-gnu/qt5/include/QtCore/qjsonvalue.h:43:0,
from /usr/include/x86_64-linux-gnu/qt5/include/QtCore/qjsonarray.h:43,
from /usr/include/x86_64-linux-gnu/qt5/include/QtCore/QJsonArray:1,
from ../qjson_includes.h:5,
from ../model_base.h:52,
from ../model_phasechange.h:50,
from ../model_phasechange.cpp:40:
/usr/include/x86_64-linux-gnu/qt5/include/QtCore/qglobal.h:1135: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. "\
^~~~~

Is there a way to resolve the problem? I am using Ubuntu 18.04.1 LTS

Thanks,
Adrian

m.farahani | Tue, 10/23/2018 - 12:56

Hi Adrian,
try the following way, it may work.
Go to the folder src/MAKE and edit Makefile.fedora_fpic. In the CCFLAGS adds "-fPIC" additionally. e.g
CCFLAGS = $(PASCAL_C11_STD) -O2 \
-funroll-loops -fstrict-aliasing -Wall -W make -fPIC -Wno-uninitialized -g -Wno-unused-parameter -Wno-unused-but-set-parameter \
-Wno-reorder -Wno-write-strings -D H5_LIB \
-DGITREMOTE=\"$(GIT_REMOTE)\" -DGITBRANCH=\"$(GIT_BRANCH)\" -DGITCOMMIT=\"$(GIT_VERSION)\"
Best,
Mohammad