[MacPorts] #57975: ld64-97: have it deal with -rpath on Tiger without erroring?

MacPorts noreply at macports.org
Wed Jan 30 06:31:33 UTC 2019


#57975: ld64-97: have it deal with -rpath on Tiger without erroring?
--------------------------+----------------------
  Reporter:  kencu        |      Owner:  kencu
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:  tiger
      Port:  ld64-97      |
--------------------------+----------------------

Comment (by kencu):

 This patch makes ld64-97 not generate an error when it sees an `-rpath`
 link command:
 {{{
 $ cat ld64-97-no-error-rpath-tiger.diff
 --- src/ld/Options.cpp.orig2    2019-01-29 21:27:48.000000000 -0800
 +++ src/ld/Options.cpp  2019-01-29 21:28:43.000000000 -0800
 @@ -3503,8 +3503,8 @@

         // can't use -rpath unless targeting 10.5 or later
         if ( fRPaths.size() > 0 ) {
 -               if ( !minOS(ObjectFile::ReaderOptions::k10_5,
 ObjectFile::ReaderOptions::k2_0) )
 -                       throw "-rpath can only be used when targeting Mac
 OS X 10.5 or later";
 +//KEN          if ( !minOS(ObjectFile::ReaderOptions::k10_5,
 ObjectFile::ReaderOptions::k2_0) )
 +//KEN                  throw "-rpath can only be used when targeting Mac
 OS X 10.5 or later";
                 switch ( fOutputKind ) {
                         case Options::kDynamicExecutable:
                         case Options::kDynamicLibrary:
 }}}
 and this patch makes ld64-97 just do nothing instead of inserting an rpath
 command into the executable:
 {{{
 $ cat ld64-97-dont-output-rpath-atom.diff
 diff --git src/ld/MachOWriterExecutable.hpp.orig
 src/ld/MachOWriterExecutable.hpp
 index 630328a..ee21fe2 100644
 --- src/ld/MachOWriterExecutable.hpp.orig
 +++ src/ld/MachOWriterExecutable.hpp
 @@ -3142,7 +3142,7 @@ Writer<A>::Writer(const char* path, Options&
 options, std::vector<ExecutableFile

         // add any rpath load commands
         for(std::vector<const char*>::const_iterator
 it=fOptions.rpaths().begin(); it != fOptions.rpaths().end(); ++it) {
 -               fWriterSynthesizedAtoms.push_back(new
 RPathLoadCommandsAtom<A>(*this, *it));
 +//KEN          fWriterSynthesizedAtoms.push_back(new
 RPathLoadCommandsAtom<A>(*this, *it));
         }

         // set up fSlideable
 }}}

 surprisingly, that is enough to get `mpv` to build and run on Tiger
 (without doing the proper job of figuring out how to make `libtool` not
 output the `-rpath` argument in the first place, which is turning out to
 be surprisingly hard).

-- 
Ticket URL: <https://trac.macports.org/ticket/57975#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list