Menu

#41 Please allow the user to add LDFLAGS

future
closed
nobody
Compilation (1)
1
2019-03-29
2016-09-02
No

Please allow the user to pass custom LDFLAGS at compile time, for instance -Wl,-z,relro.

Best regards,
Bertrand Marc

Discussion

  • Andrei

    Andrei - 2016-09-02

    This may be done for 0.6.5, however I'm not sure since CXXFLAGS are also out of direct control of the user. Which would mean that, for the sake of consistency, that should be made available too.

    Out of curiosity what exactly is the need of specifying custom LDFLAGS?

    EDIT: what I wish to determine with the above question is: could we add a new option similar to the existing OPTIMS and WARNINGS and stick it into LDFLAGS? If that is acceptable I'm open to naming suggestions.

     

    Last edit: Andrei 2016-09-02
  • Bertrand Marc

    Bertrand Marc - 2016-09-02

    Thank you for your quick answer.

    I am trying to package Trigger-rally for Debian. We need to pass a few flags common to all Debian packages (for instance LDFLAGS=-Wl,-z,relro).

    As for now, we can pass CXXFLAGS with the OPTIMS variable (not perfect but should work), but there is no way to add LDFLAGS without changing the Makefile.

    Of course, using all the standard variables (CXXFLAGS, CPPFLAGS, LDFLAGS) set by the user would be the best solution. Maybe with += instead of := ?

    Best regards,
    Bertrand Marc

     
  • Andrei

    Andrei - 2016-09-02

    Please check the attached makefile and let me know if it works as intended for you, and if it has the needed functionality.

    Also, when building for x86_64 what optimization options would you use? I am currently using the following settings:

    -march=k8 -mtune=generic -O2
    
     
  • Andrei

    Andrei - 2016-09-03

    Ticket moved from /p/trigger-rally/bugs/20/

     
  • Bertrand Marc

    Bertrand Marc - 2016-09-03

    Thanks a lot ! The attached Makefile allows us to pass the desired flags, so it works.

    IMHO, it would be even better if the Makefile was not forcing flags by default. If the user sets CXXFLAGS=-02 (for some reason), this Makefile will append its default -0fast. As a result (gcc uses the last -0 option), the user choice is not aknowledge unless he/she disables OPTIMS manually.

    I think the following would be more standard (ie use the default optims, unless the user sets CXXFLAGS):
    CXXFLAGS ?= -march=native -mtune=native -Ofast
    CXXFLAGS += -std=c++11 $(WARNINGS)
    (and remove all $OPTIMS mention)

    As for optimizations flags per se, for Debian we aim at a large compatibility, so we do not use many optims flags. But your current -march=native -mtune=native seems reasonable. For -0fast, maybe -02 or -03 would be safer ?.

    Best regards,
    Bertrand

     
  • Andrei

    Andrei - 2016-09-03

    I'll keep your suggestion in mind, however I wish to keep the OPTIMS variable unless there is more negative feedback about it.

    In my opinion it is well-documented enough that it won't get in the way of builders.

    But your current -march=native -mtune=native seems reasonable.

    Those defaults are meant for end users downloading the source code, not for us. I remember reading somewhere that GCC favors -O2 instead of higher, and I've always used -march=i686 for Win32 so far.

     
    • Bertrand Marc

      Bertrand Marc - 2016-09-03

      Of course you can keep the OPTIMS variable without ignoring the CXXFLAGS
      passed at build time. In the example attached, OPTIMS is defined only if
      CXXFLAGS is not.

      And sorry, I thought you meant the default for the end user. For your
      win32 build, you could use the same as Debian (-02). Debian is currently
      dropping i586 support [1], but it would not make sense to try
      Trigger-rally on a Pentium, so -march=i686 -mtune=i686 is probably the
      best choice.

      Best regards,
      Bertrand

      [1] https://lists.debian.org/debian-devel-announce/2016/05/msg00001.html

      Le 03/09/2016 à 11:31, Andrei a écrit :

      I'll keep your suggestion in mind, however I wish to keep the |OPTIMS|
      variable unless there is more negative feedback about it.

      In my opinion it is well-documented enough that it won't get in the
      way of builders.

      But your current -march=native -mtune=native seems reasonable.
      

      Those defaults are meant for end users downloading the source code,
      not for us. I remember reading somewhere that GCC favors |-O2| instead
      of higher, and I've always used |-march=i686| for Win32 so far.


      [feature-requests:#41] Please allow the user to add LDFLAGS

      Status: open
      Group: future
      Labels: Compilation
      Created: Fri Sep 02, 2016 08:10 AM UTC by Bertrand Marc
      Last Updated: Sat Sep 03, 2016 08:16 AM UTC
      Owner: nobody

      Please allow the user to pass custom LDFLAGS at compile time, for
      instance -Wl,-z,relro.

      Best regards,
      Bertrand Marc


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/trigger-rally/feature-requests/41/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Bertrand Marc

    Bertrand Marc - 2016-09-03

    Of course you can keep the OPTIMS variable without ignoring the CXXFLAGS passed at build time. In the example attached, OPTIMS is defined only if CXXFLAGS is not.

    And sorry, I thought you meant the default for the end user. For your win32 build, you could use the same as Debian (-02). Debian is currently dropping i586 support [1], but it would not make sense to try Trigger-rally on a Pentium, so -march=i686 -mtune=i686 is probably the best choice.

    Best regards,
    Bertrand

    [1] https://lists.debian.org/debian-devel-announce/2016/05/msg00001.html

     
  • Andrei

    Andrei - 2019-03-29
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB