[Qt-creator] error with position independent code : qt 5.x

Tobias Hunger tobias.hunger at gmail.com
Fri Sep 16 17:09:24 CEST 2016


Hi Kapil,

according to the error message you will need to build your code with
-fPIC. Not very helpful, but the best I can do with that information,
sorry.

https://cmake.org/cmake/help/v3.6/variable/CMAKE_POSITION_INDEPENDENT_CODE.html#variable:CMAKE_POSITION_INDEPENDENT_CODE
might help though:-)

You will need to figure out how to tell that to your project's build
system. That is a task I do not expect creator being able to help with
-- each project has its own set of particularities:-/

Best Regards,
Tobias

On Fri, Sep 16, 2016 at 4:28 PM, Kapil Gupta <kpgupta98 at gmail.com> wrote:
> Hi,
>
> I am having this error with qt code :
> ```
> In file included from
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:37:0,
>                  from
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:41,
>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:40,
>                  from
> /usr/include/x86_64-linux-gnu/qt5/QtMultimedia/qaudioformat.h:38,
>                  from
> /home/cortana/libdash/libdash/qtplayer/libdashframework/Buffer/AudioChunk.h:16,
>                  from
> /home/cortana/libdash/libdash/qtplayer/libdashframework/Buffer/AudioChunk.cpp:12:
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1067: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. "\
>     ^
> [ 57%] Building CXX object
> CMakeFiles/qtsampleplayer.dir/libdashframework/Buffer/MediaObjectBuffer.cpp.o
> [ 60%] Building CXX object
> CMakeFiles/qtsampleplayer.dir/libdashframework/Input/DASHReceiver.cpp.o
> [ 63%] Building CXX object
> CMakeFiles/qtsampleplayer.dir/libdashframework/Input/MediaObject.cpp.o
> [ 66%] Building CXX object
> CMakeFiles/qtsampleplayer.dir/libdashframework/Input/DASHManager.cpp.o
> CMakeFiles/qtsampleplayer.dir/build.make:389: recipe for target
> 'CMakeFiles/qtsampleplayer.dir/libdashframework/Buffer/AudioChunk.cpp.o'
> failed
> make[2]: ***
> [CMakeFiles/qtsampleplayer.dir/libdashframework/Buffer/AudioChunk.cpp.o]
> Error 1
> make[2]: *** Waiting for unfinished jobs....
> In file included from
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:37:0,
>                  from
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:41,
>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:40,
>                  from
> /usr/include/x86_64-linux-gnu/qt5/QtMultimedia/qaudioformat.h:38,
>                  from
> /home/cortana/libdash/libdash/qtplayer/libdashframework/Input/DASHManager.h:23,
>                  from
> /home/cortana/libdash/libdash/qtplayer/libdashframework/Input/DASHManager.cpp:12:
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1067: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. "\
> ```
> What can I do to remove this error? The code is the libdash library's
> qtsampleplayer which is based on cmake.
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>



More information about the Qt-creator mailing list