Compiling 2.1 on Linux with QT-Creator

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Compiling 2.1 on Linux with QT-Creator

MLutz
Hello,
as I wanted to test some things with version 2.1 and eventually also
include my PR regarding fingerings on tablature, I tried to compile 2.1
with QT-Creator, but didn't get around with an 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. "\
       ^
Does someone know, how to get around this problem?

Best regards
Markus



--

Markus Lutz
Schulstraße 11

88422 Bad Buchau

Tel  0 75 82 / 92 62 89
Fax  0 75 82 / 92 62 90
Mail [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

lasconic
Administrator
On which OS ? Do you have Qt 5.4 installed?

lasconic

2017-02-28 18:53 GMT+01:00 MLutz <[hidden email]>:
Hello,
as I wanted to test some things with version 2.1 and eventually also
include my PR regarding fingerings on tablature, I tried to compile 2.1
with QT-Creator, but didn't get around with an 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. "\
       ^
Does someone know, how to get around this problem?

Best regards
Markus



--

Markus Lutz
Schulstraße 11

88422 Bad Buchau

Tel  0 75 82 / 92 62 89
Fax  0 75 82 / 92 62 90
Mail [hidden email]





--
View this message in context: http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160.html
Sent from the MuseScore Developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

MLutz
lasconic wrote
On which OS ? Do you have Qt 5.4 installed?
My OS is linuxmint 16. I have Qt 5.6 or 5.5 installed.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

lasconic
Administrator
You will need Qt 5.4 for MuseScore 2.1 I'm afraid.

lasconic

2017-02-28 19:58 GMT+01:00 MLutz <[hidden email]>:
lasconic wrote
> On which OS ? Do you have Qt 5.4 installed?

My OS is linuxmint 16. I have Qt 5.6 or 5.5 installed.




--
View this message in context: http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580162.html
Sent from the MuseScore Developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

ralfD
 
Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic <[hidden email]> schrieb:
 
> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.

Are you shure this is the cause of that error? That sounds vaguely familiar, but AFAIK I only needed to
mess with the linker flags.

Cheers, Ralf Mattes


>
> lasconic
>
> 2017-02-28 19:58 GMT+01:00 MLutz <[hidden email]>:
>
> > lasconic wrote
> > > On which OS ? Do you have Qt 5.4 installed?
> >
> > My OS is linuxmint 16. I have Qt 5.6 or 5.5 installed.
> >
> >
> >
> >
> > --
> > View this message in context: http://dev-list.musescore.org/
> > Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580162.html
> > Sent from the MuseScore Developer mailing list archive at Nabble.com.
> >
> > ------------------------------------------------------------
> > ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Mscore-developer mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/mscore-developer
> >
 
 
 
 



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

MLutz
ralfD wrote
Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic <[hidden email]> schrieb:
> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
Are you shure this is the cause of that error? That sounds vaguely familiar, but AFAIK I only needed to mess with the linker flags.
At least it doesn't seem to be a problem of the qt version. With 5.4 I have the same problem ...
I tried to set the Compiler Flags within MuseScore2.1.config, but it doesn't work also:
#define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g -reduce-relocations"
#define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG"

Does someone has further advice?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

wschweer9
You can use the settings from git head branch (3.0) which should work.


Am 28.02.2017 um 21:55 schrieb MLutz:

> ralfD wrote
>> Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic &lt;
>> lasconic@
>> &gt; schrieb:
>>> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
>> Are you shure this is the cause of that error? That sounds vaguely
>> familiar, but AFAIK I only needed to mess with the linker flags.
> At least it doesn't seem to be a problem of the qt version. With 5.4 I have
> the same problem ...
> I tried to set the Compiler Flags within MuseScore2.1.config, but it doesn't
> work also:
> #define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g
> -reduce-relocations"
> #define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG
> -DQT_NO_DEBUG"
>
> Does someone has further advice?
>
>
>
>
>
> --
> View this message in context: http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580165.html
> Sent from the MuseScore Developer mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Mscore-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

ralfD
In reply to this post by MLutz
 
Am Dienstag, 28. Februar 2017 21:55 CET, MLutz <[hidden email]> schrieb:
 

> ralfD wrote
> > Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic &lt;
>
> > lasconic@
>
> > &gt; schrieb:
> >> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
> > Are you shure this is the cause of that error? That sounds vaguely
> > familiar, but AFAIK I only needed to mess with the linker flags.
>
> At least it doesn't seem to be a problem of the qt version. With 5.4 I have
> the same problem ...

No, this is not a Qt Version Problem at thois point. That change was introduced in
Qt5.4.2 - see http://code.qt.io/cgit/qt/qtbase.git/plain/dist/changes-5.4.2.

> I tried to set the Compiler Flags within MuseScore2.1.config, but it doesn't
> work also:
> #define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g
> -reduce-relocations"
> #define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG
> -DQT_NO_DEBUG"
>
> Does someone has further advice?

I think Cmake has specific magic for that. Try:

 if (Qt5_POSITION_INDEPENDENT_CODE)
       SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
 endif()

HTH, RalfD
 
 

>
>
>
>
> --
> View this message in context: http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580165.html
> Sent from the MuseScore Developer mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Mscore-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mscore-developer
 
 
 
 



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

ralfD
 
Am Dienstag, 28. Februar 2017 22:11 CET, "Ralf Mattes" <[hidden email]> schrieb:
 

>  
> Am Dienstag, 28. Februar 2017 21:55 CET, MLutz <[hidden email]> schrieb:
>  
> > ralfD wrote
> > > Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic &lt;
> >
> > > lasconic@
> >
> > > &gt; schrieb:
> > >> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
> > > Are you shure this is the cause of that error? That sounds vaguely
> > > familiar, but AFAIK I only needed to mess with the linker flags.
> >
> > At least it doesn't seem to be a problem of the qt version. With 5.4 I have
> > the same problem ...
>
> No, this is not a Qt Version Problem at thois point. That change was introduced in
> Qt5.4.2 - see http://code.qt.io/cgit/qt/qtbase.git/plain/dist/changes-5.4.2.
>
> > I tried to set the Compiler Flags within MuseScore2.1.config, but it doesn't
> > work also:
> > #define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g
> > -reduce-relocations"
> > #define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG
> > -DQT_NO_DEBUG"
> >
> > Does someone has further advice?
>
> I think Cmake has specific magic for that. Try:
>
>  if (Qt5_POSITION_INDEPENDENT_CODE)
>        SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
>  endif()

And if you want to do it "manualy" you'd want to do it like this:

 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

Which is what I did (I think).

 
Cheers, RalfD



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

Marc Sabatella
In reply to this post by wschweer9
I've definitely seen that error before, but it always turned out to be something I had done wrong in my cmake configuration within QtCreator.  Like I left out the CMAKE_BUILD_TYPE=DEBUG, or the -G"Unix Makefiles", or I didn't do a make clean after a previous build attempt with bad configuration, etc.

Marc

On Tue, Feb 28, 2017 at 2:32 PM Werner Schweer <[hidden email]> wrote:
You can use the settings from git head branch (3.0) which should work.


Am 28.02.2017 um 21:55 schrieb MLutz:
> ralfD wrote
>> Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic &lt;
>> lasconic@
>> &gt; schrieb:
>>> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
>> Are you shure this is the cause of that error? That sounds vaguely
>> familiar, but AFAIK I only needed to mess with the linker flags.
> At least it doesn't seem to be a problem of the qt version. With 5.4 I have
> the same problem ...
> I tried to set the Compiler Flags within MuseScore2.1.config, but it doesn't
> work also:
> #define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g
> -reduce-relocations"
> #define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG
> -DQT_NO_DEBUG"
>
> Does someone has further advice?
>
>
>
>
>
> --
> View this message in context: http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580165.html
> Sent from the MuseScore Developer mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Mscore-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

ralfD
 
Am Dienstag, 28. Februar 2017 22:42 CET, Marc Sabatella <[hidden email]> schrieb:
 
> I've definitely seen that error before, but it always turned out to be
> something I had done wrong in my cmake configuration within QtCreator.
> Like I left out the CMAKE_BUILD_TYPE=DEBUG, or the -G"Unix Makefiles", or I
> didn't do a make clean after a previous build attempt with bad
> configuration, etc.

I can't tell about the QtCreator build, but with a plain CMake build you really need to add
that flag (N.B.: CMake does add that flag authomatically, but not for static libraries).

Cheers, Ralf Mattes

> Marc
>
> On Tue, Feb 28, 2017 at 2:32 PM Werner Schweer <[hidden email]> wrote:
>
> > You can use the settings from git head branch (3.0) which should work.
> >
> >
> > Am 28.02.2017 um 21:55 schrieb MLutz:
> > > ralfD wrote
> > >> Am Dienstag, 28. Februar 2017 20:10 CET, Lasconic &lt;
> > >> lasconic@
> > >> &gt; schrieb:
> > >>> You will need Qt 5.4 for MuseScore 2.1 I'm afraid.
> > >> Are you shure this is the cause of that error? That sounds vaguely
> > >> familiar, but AFAIK I only needed to mess with the linker flags.
> > > At least it doesn't seem to be a problem of the qt version. With 5.4 I
> > have
> > > the same problem ...
> > > I tried to set the Compiler Flags within MuseScore2.1.config, but it
> > doesn't
> > > work also:
> > > #define CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g
> > > -reduce-relocations"
> > > #define CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG
> > > -DQT_NO_DEBUG"
> > >
> > > Does someone has further advice?
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > http://dev-list.musescore.org/Compiling-2-1-on-Linux-with-QT-Creator-tp7580160p7580165.html
> > > Sent from the MuseScore Developer mailing list archive at Nabble.com.
> > >
> > >
> > ------------------------------------------------------------------------------
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> > > _______________________________________________
> > > Mscore-developer mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/mscore-developer
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Mscore-developer mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/mscore-developer
> >
 
 
 
 



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

MLutz
Thank you very much for all the help.
It finally worked, as soon as I deleted the "-fPIE" from line 163 of CMakeLists.txt.
All other tries were in vain ...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

ralfD
 
Am Mittwoch, 01. März 2017 02:11 CET, MLutz <[hidden email]> schrieb:
 
> Thank you very much for all the help.
> It finally worked, as soon as I deleted the "-fPIE" from line 163 of
> CMakeLists.txt.
> All other tries were in vain ...

Are you shure the binary runs stable? AFAAIK you really need the -fpic flag to compile against
newer Qt5 versions (unless you compiled Qt yourself and disabled Qt's "reduce relocations").
From Qt's changelog:

- On x86 and x86-64 systems with ELF binaries (especially Linux), due to
  a new optimization in GCC 5.x in combination with a recent version of
  GNU binutils, compiling Qt applications with -fPIE is no longer
  enough with GCC 5.x. Applications now need to be compiled with
  the -fPIC option if Qt's option "reduce relocations" is active. For
  backward compatibility only, Qt accepts the use of -fPIE for GCC 4.x
  versions.
  Note that Clang is known to generate incompatible code even with -fPIC if
  the -flto option is active.
  Applications using qmake or cmake >= 2.8.12 as their build system will
  adapt automatically. Applications using an older release of cmake in
  combination with GCC 5.x need to change their CMakeLists.txt to add
  Qt5Core_EXECUTABLE_COMPILE_FLAGS to CMAKE_CXX_FLAGS. In particular,
  applications using cmake >= 2.8.9 and < 2.8.11 will continue to build
  with the -fPIE option and invoke the special compatibility mode if using
  GCC 4.x.

Cheers, RalfD




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiling 2.1 on Linux with QT-Creator

MLutz
ralfD wrote
Am Mittwoch, 01. März 2017 02:11 CET, MLutz <[hidden email]> schrieb:
 
> Thank you very much for all the help.
> It finally worked, as soon as I deleted the "-fPIE" from line 163 of
> CMakeLists.txt.
> All other tries were in vain ...

Are you shure the binary runs stable? AFAAIK you really need the -fpic flag to compile against
newer Qt5 versions (unless you compiled Qt yourself and disabled Qt's "reduce relocations").
From Qt's changelog:

- On x86 and x86-64 systems with ELF binaries (especially Linux), due to
  a new optimization in GCC 5.x in combination with a recent version of
  GNU binutils, compiling Qt applications with -fPIE is no longer
  enough with GCC 5.x. Applications now need to be compiled with
  the -fPIC option if Qt's option "reduce relocations" is active. For
  backward compatibility only, Qt accepts the use of -fPIE for GCC 4.x
  versions.
  Note that Clang is known to generate incompatible code even with -fPIC if
  the -flto option is active.
  Applications using qmake or cmake >= 2.8.12 as their build system will
  adapt automatically. Applications using an older release of cmake in
  combination with GCC 5.x need to change their CMakeLists.txt to add
  Qt5Core_EXECUTABLE_COMPILE_FLAGS to CMAKE_CXX_FLAGS. In particular,
  applications using cmake >= 2.8.9 and < 2.8.11 will continue to build
  with the -fPIE option and invoke the special compatibility mode if using
  GCC 4.x.
As far as I can see, it works fine. The -fPIC option is set in CMakeLists.txt.
See the lines:
      set(CMAKE_CXX_FLAGS_DEBUG   "-std=c++11 -fPIC -fPIE -g")
      set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG")

I only deleted the -fPIE, and now everything works ...

Best regards
Markus



Loading...