Opened 4 years ago

Closed 4 years ago

#60397 closed defect (wontfix)

ld64-127 install fails at applying patch stage on Tiger

Reported by: programmingkidx Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: tiger Cc: jeremyhu (Jeremy Huddleston Sequoia)
Port: ld64-127

Description (last modified by kencu (Ken))

When installing ld64-127, the install fails when trying to apply a patch. Here is the message:

--->  Applying patches to ld64-127
Error: reinplace: couldn't read file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/MachOWriterExecutable.hpp": no such file or directory
Error: Failed to patch ld64-127: reinplace sed(1) failed

Here is more information on the error:

:info:patch Hunk #1 succeeded at 810 (offset 185 lines).
:debug:patch Executing proc-post-org.macports.patch-patch-0
:info:patch --->  Patching Options.cpp: s|@@VERSION@@|127.2|g
:debug:patch Executing reinplace: /usr/bin/sed s|@@VERSION@@|127.2|g </opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/Options.cpp >@file10
:debug:patch euid/egid changed to: 0/0
:debug:patch chowned /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/Options.cpp to macports
:debug:patch euid/egid changed to: 502/500
:debug:patch euid/egid changed to: 0/0
:debug:patch setting attributes on /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/Options.cpp
:debug:patch euid/egid changed to: 502/500
:info:patch --->  Patching MachOWriterExecutable.hpp: s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:
:debug:patch Executing reinplace: /usr/bin/sed s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>: </opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/MachOWriterExecutable.hpp >@file10
:debug:patch couldn't read file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/MachOWriterExecutable.hpp": no such file or directory
:debug:patch     while executing
:debug:patch "exec -ignorestderr -- {*}$cmdline"
:error:patch reinplace: couldn't read file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/work/ld64-127.2/src/ld/MachOWriterExecutable.hpp": no such file or directory
:error:patch Failed to patch ld64-127: reinplace sed(1) failed
:debug:patch Error code: NONE
:debug:patch Backtrace: reinplace sed(1) failed
:debug:patch     while executing
:debug:patch "$post $targetname"
:error:patch See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-127/main.log for details.

OS: Mac OS 10.4.11 Server (x86)

Change History (26)

comment:1 Changed 4 years ago by kencu (Ken)

Keywords: tiger added; ld64-127 patch removed
Port: ld64-127 added
Summary: ld64-127 install fails at applying patch stageld64-127 install fails at applying patch stage on Tiger

comment:2 Changed 4 years ago by kencu (Ken)

Description: modified (diff)
Owner: set to kencu
Status: newassigned

comment:3 Changed 4 years ago by kencu (Ken)

Cc: jeremyhu added

comment:4 Changed 4 years ago by kencu (Ken)

ld64-127 in the MacPorts repo does not currently install on MacOSX 10.4 Tiger.

Tiger is presently limited to ld64-97 in MacPorts (and most everywhere else on Earth).

I have, however, modified ld64-127 to build and install on Tiger:

$ port -v installed ld64-127   
The following ports are currently installed:
  ld64-127 @127.2_14+llvm33 platform='darwin 8' archs='ppc' date='2020-02-03T18:00:47-0800'

but so far I have not enabled that on MacPorts. It is quite possible that even newer versions of ld64 could be made to work on Tiger -- it just requires some effort and a bit of attention to detail to do it.

To be honest, so far, ld64-97 links most things on Tiger that need linking, though ... was there a specific reason you were wanting it? Or just generally trying to see what would build?

Ken

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:5 Changed 4 years ago by kencu (Ken)

Milestone: MacPorts 2.6.3MacPorts Future

comment:6 Changed 4 years ago by programmingkidx

Hi, I am trying to build TenFourFox on Mac OS 10.4. It is fork of Firefox for older Macs. It currently fails to build on my computer because the ld command does not accept the -allow_heap_execute option. ld64-127 does support this command-line option. Once I have ld64-127 up and running I will be able to build TenFourFox :)

comment:7 Changed 4 years ago by programmingkidx

Would you be willing to share your ld64-127 binary?

comment:8 Changed 4 years ago by kencu (Ken)

I have tenfourfox building on 10.4 PPC now, using ld64-97. It doesn't need ld64-127, or at least it didn't when I last built it a few weeks ago. If you are having an issue building it with ld64-97, perhaps I can help you sort out what the issue is with that.

I made a Portfile to build it to make it really easy, and put it here <https://github.com/kencu/tenfourfox-macports>. I haven't submitted this one to MacPorts as yet either, but it is pretty much ready to go. We just got stuck with the strip7 modified strip command from cctools -- people weren't happy having that in MacPorts, so that shut down the rest of it too.

To use my custom repo, you need to add it to MacPorts' list of repositories. It's really quite easy to do this, and with the kind of programming you're doing, you are going to need to do it very soon :> The instructions on how to use a custom repo are here <https://guide.macports.org/chunked/development.local-repositories.html>. Basically you just clone mine to some spot on your hard drive, like /opt/local/tenfourfox-macports, and then add that repo to the sources.conf list, as it says in the instructions.

Of course you are welcome to my Tiger ld64-127 stuff -- I have not uploaded that to github yet -- I'll find a place to put it and give you the link.

comment:9 Changed 4 years ago by kencu (Ken)

Did Cameron change something in the TenFourFox build with the latest release to make it require ld64-127?

comment:10 Changed 4 years ago by programmingkidx

I think he did. The configure command fails at a test of the c++ compiler. This is the error I see:

checking for -dead_strip option to ld... no
checking for -allow_heap_execute option to ld... no
checking whether the C++ compiler (c++  -fno-exceptions -fno-strict-aliasing -fno-rtti ) actually is a C++ compiler... no
configure: error: c++  -fno-exceptions -fno-strict-aliasing -fno-rtti  failed to compile and link a simple C++ source.
------ config.log ------
return 0;
; return 0; }
configure:9536: checking for -allow_heap_execute option to ld
configure:9547: gcc -o conftest  -std=gnu99 -fno-strict-aliasing -fno-exceptions   -Wl,-allow_heap_execute conftest.c  1>&5
ld: library not found for -lcrt1.10.6.o
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 9540 "configure"
#include "confdefs.h"

int main() {
return 0;
; return 0; }

I cannot go past the configure command without having a linker that supports -allow_heap_execute.

comment:11 Changed 4 years ago by kencu (Ken)

I think this is your error:

ld: library not found for -lcrt1.10.6.o

and that happens because you're not setting the deployment target to 10.4.

Here's my TFF mozconfig:

. $topsrcdir/browser/config/mozconfig

# optimized buildå
export CC="/opt/local/bin/gcc-mp-4.8 -Wa,-Q -flax-vector-conversions -O3 -m32 -read_only_relocs suppress"
export CXX="/opt/local/bin/g++-mp-4.8 -Wa,-Q -flax-vector-conversions -fpermissive -O3 -m32 -read_only_relocs suppress"

# spec a version of clang that can compile the newer assembly code in libvpx
export TFF_VPX_CC="/opt/local/bin/clang-mp-3.4 -arch i386 -O3"

ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --enable-strip
ac_add_options --enable-install-strip

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg
mk_add_options AUTOCONF=autoconf213
ac_add_options --disable-tests
ac_add_options --disable-static
ac_add_options --disable-cpp-exceptions
ac_add_options --disable-crashreporter
ac_add_options --enable-printing
ac_add_options --enable-prebinding
ac_add_options --enable-macos-target=10.4
ac_add_options --enable-chrome-format=jar
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk
ac_add_options --with-distribution-id=com.floodgap
ac_add_options --enable-webrtc
ac_add_options --disable-ion

but you will possibly have more success using my Portfile, at least to begin with, especially building TFF for Intel -- Riccardo and I had to do some moderate surgery, and there are still a couple of patches needed to make it build on Intel, and these are in my repo.

Version 0, edited 4 years ago by kencu (Ken) (next)

comment:12 Changed 4 years ago by kencu (Ken)

Oh, one more thing -- Cameron's latest TFF version pulled in some newer parts, and so far I haven't had the time with Riccardo to sort out how to get that last version of TFF to build on Intel Tiger... so we're still at FPR19, I believe -- for the moment.

comment:13 Changed 4 years ago by kencu (Ken)

I haven't uploaded any of my TFF Intel builds recently to Cameron's sourceforge site -- just lazy -- here's where I put them <https://sourceforge.net/projects/tenfourfox/files/unstable/contrib/> but my TFF FPR19 build for Tiger Intel isn't there... too many things to do I guess.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:14 Changed 4 years ago by kencu (Ken)

Here's what I did to build ld64-127 on Tiger (PPC). First copied over the MacOS10.5.sdk from a Leopard system, and then did these changes to the ld64 Portfile:

diff --git a/devel/ld64/Portfile b/devel/ld64/Portfile
index 2aba025c888..39184ee1eed 100644
--- a/devel/ld64/Portfile
+++ b/devel/ld64/Portfile
@@ -79,6 +79,10 @@ subport ld64-127 {
     # This was the last ld64 release that supported linking ppc executables.
     version             127.2
     revision            14
+configure.sdkroot /Developer/SDKs/MacOSX10.5.sdk
+configure.cppflags-append -isysroot ${configure.sdkroot}
+configure.cxxflags-append -isysroot ${configure.sdkroot}
+configure.cflags-append -isysroot ${configure.sdkroot}
 
     # multiple errors with macports clang versions newer than 3.7
     compiler.blacklist-append {macports-clang-[5-9].0} macports-clang-devel
@@ -396,11 +400,20 @@ if {${subport} eq ${name}} {
 
         if {${os.major} < 9} {
             # No CommonCrypto, use openssl
+
+if {$ld64_ver == 97} {
             reinplace "s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:" \
                 ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
             reinplace "s:CC_MD5:MD5:" \
                 ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
+}
 
+if {$ld64_ver == 127} {
+            reinplace "s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:" \
+                ${worksrcpath}/src/ld/OutputFile.cpp
+            reinplace "s:CC_MD5:MD5:" \
+                ${worksrcpath}/src/ld/OutputFile.cpp
+}
             reinplace "s:-Wl,-exported_symbol,__mh_execute_header::g" \
                 ${worksrcpath}/Makefile
 
@@ -512,8 +525,8 @@ if {![variant_isset universal]} {
     test.run     yes
     test.dir     ${workpath}/ld64-${version}/unit-tests/test-cases
     test.cmd     perl ../bin/make-recursive.pl \
-                 CXX="${configure.cxx} -arch ${configure.build_arch}"  \
-                 CC="${configure.cc} -arch ${configure.build_arch}" \
+                 CXX="${configure.cxx} -arch ${configure.build_arch} -isysroot ${configure.sdkroot}"  \
+                 CC="${configure.cc} -arch ${configure.build_arch} -isysroot ${configure.sdkroot}" \
                  BUILT_PRODUCTS_DIR="${workpath}/ld64-${version}" \
                  LD_SYSROOT="${configure.sdkroot}" \
                  LD="${workpath}/ld64-${version}/ld" \
Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:15 Changed 4 years ago by jmroot (Joshua Root)

Milestone: MacPorts Future

comment:16 Changed 4 years ago by programmingkidx

Thank you very much for the TenFourFox binary. It brought new life to my core duo MacBook. With your TenFourFox I am now able to watch Youtube videos on it :)

Because it took days to compile all the tools I needed to build TenFourFox, I was thinking about making a binary distribution that would save others literally days of work. It will include GCC 4.8 and all the other tools I was required to build.

As for building TenFourFox, I may do that at a later time. I would really suggest your x86 binary be made available on the main TenFourFox site. It would help a lot of people who still love their older Macs. I actually plan on bying a MacPro 3,1 to run Mac OS 10.4 on it. With the ability to play Youtube videos on it I can use it as my main computer now.

Thank you so much for you help.

comment:17 Changed 4 years ago by kencu (Ken)

That binary you downloaded from SourceForge already has all the libgcc parts and all the supporting libraries in it, so it is already self-contained and you don't need MacPorts or anything else to use it. So that part is done already.

I will (am) make a new TenFourFox FPR 18, 19, or 20 binary that is up-to-date, and I'll put it up on that sourceforge site for anyone to use.

If you are interested (and it seems like you are) then we could sure use some help keeping these things up-to-date...feel free to reach out. The GitHub repo that contains our TenFourFox Intel changes is held by Riccardo -- and most of the changes are upstreamed to Cameron, unless they are too wild for his main TFF repo. I'll let you know when I have a newer TFF Intel done.

One problem we have is that MacPorts has updated libgcc to a version that breaks on all older systems. So to make things work, we have to hold back the libgcc version to 7.4.0 (or go through lengths to set the default library path in every piece of software that uses libgcc, which does not fit in with Cameron's current plans). So I have held back to libgcc 7.4.0 on all my systems (although MacPorts has decided to give the library_path idea a shot). TFF could work with a wrapper script, if we had to use libgcc 7.5.0.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:18 Changed 4 years ago by kencu (Ken)

TenFourFox FPR18 built overnight on my Tiger Intel system, and it seems to be working as expected, so I uploaded that to <https://sourceforge.net/projects/tenfourfox/files/unstable/contrib/> as well just now. Please let me know if somehow isn't working as expected for you.

Later this week perhaps I'll work on FPR20 -- just trying to get updates of clang-10 and cctools out the door first.

comment:19 Changed 4 years ago by programmingkidx

When I watch a youtube video in full screen mode, I can see the top and bottom of the desktop. The full screen mode does not fully hide the everything.

I was using TenFourFox 18 on Mac OS 10.12.

Thank you.

comment:20 Changed 4 years ago by programmingkidx

https://github.com/classilla/tenfourfox/wiki/HowToBuildFPR
I don't think these directions to build TenFourFox are enough to build for x86. Could a new page be created for directions on how to build TenFourFox for x86 be made? I would love to help. What I came up with is the software for building TenFourFox pre-built for the user. That way the user can save days of building and go straight to building TenFourFox. Here are all the prerequisites that can be installed on the user's computer in minutes:

autoconf213: http://www.mediafire.com/file/zdtlokx6hrc72i3/autoconf213-2.13_1.dmg/file

  • db48
  • gawk
  • gdbm
  • gettext
  • libiconv
  • m4
  • ncurses
  • perl5
  • perl5.28
  • readline
  • autoconf213


freetype: http://www.mediafire.com/file/a4g3oleyqt5n7sw/freetype-2.10.1.dmg/file

  • bzip2
  • libpng
  • zlib
  • freetype


gcc48: http://www.mediafire.com/file/spzqjn4065ce1sd/gcc48-4.8.5_5.dmg/file

  • cctools
  • cloog
  • gcc_select
  • gmp
  • isl
  • isl14
  • ld64
  • ld64-97
  • libgcc6
  • libgcc7
  • libiconv
  • libmpc
  • mpfr
  • zlib
  • gcc48


git-2.26: http://www.mediafire.com/file/rfjfmovgbt2uolh/git-2.26.2.dmg/file

  • bzip2
  • curl
  • curl-ca-bundle
  • db48
  • expat
  • gdbm
  • gettext
  • glib2
  • kerberos5
  • libcomerr
  • libedit
  • libffi
  • libiconv
  • libidn
  • libidn2
  • libpsl
  • libunistring
  • ncurses
  • openssl
  • p5.28-authen-sasl
  • p5.28-cgi
  • p5.28-digest-hmac
  • p5.28-digest-sha1
  • p5.28-error
  • p5.28-gssapi
  • p5.28-html-parser
  • p5.28-html-tagset
  • p5.28-io-socket-ssl
  • p5.28-mozilla-ca
  • p5.28-net-libidn
  • p5.28-net-smtp-ssl
  • p5.28-net-ssleay
  • p5.28-term-readkey
  • pcre
  • pcre2
  • perl5.28
  • popt
  • python27
  • python2_select
  • python_select
  • readline
  • rsync
  • sqlite3
  • zlib
  • git


gmake: http://www.mediafire.com/file/cctb65tgvc89gxu/gmake-4.3.dmg/file

  • gettext
  • libiconv
  • ncurses
  • gmake


Libidl: http://www.mediafire.com/file/bfysbj5k0qgg4vr/libidl-0.8.14_2.dmg/file

  • bzip2
  • db48
  • expat
  • gettext
  • glib2
  • libedit
  • libffi
  • libiconv
  • ncurses
  • openssl
  • pcre
  • python27
  • python2_select
  • python_select
  • sqlite3
  • zlib
  • libidl

comment:21 Changed 4 years ago by programmingkidx

I did try your mozconfig file. I still saw the same error message with ld-64:

configure: error: c++ -fno-exceptions -fno-strict-aliasing -fno-rtti failed to compile and link a simple C++ source.


return 0; ; return 0; } configure:9536: checking for -allow_heap_execute option to ld configure:9547: gcc -o conftest -std=gnu99 -fno-strict-aliasing -fno-exceptions -Wl,-allow_heap_execute conftest.c 1>&5 ld: library not found for -lcrt1.10.6.o collect2: error: ld returned 1 exit status

I was trying to build the official repo version of TenFourFox. I will try your custom repo next.

comment:22 Changed 4 years ago by kencu (Ken)

I have the Intel build of TenFourFox automated in a an add-on MacPorts repo, and that is what I use (and what I suggest you might try, at least until you can build it once). All the deps that I found required are in the Portfile.

If you like, add this repo to your MacPorts config -- it takes only a few seconds to do that, the full instructions on how exactly to accomplish that are written up on the first page of the repo <https://github.com/kencu/tenfourfox-macports>.

Then just do this:

sudo port -v install tenfourfox

and you will be delivered with a perfectly beautiful TenFourFox.app in /Applications/MacPorts and you can do anything you like with it.

I haven't updated it beyond 18 yet -- once you can at least build 18, I would appreciate any help you might have to offer to build 22. Don't be too frustrated if you get stuck -- hacking in on Mozilla is not child's play...

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:23 Changed 4 years ago by programmingkidx

I tried your fix to build ld64-127 on Mac OS 10.4. I could not make it work. It reported missing symbols:

:info:build /usr/bin/ld: Undefined symbols:

:info:build _backtrace

:info:build _lto_codegen_add_module

:info:build _lto_codegen_add_must_preserve_symbol

:info:build _lto_codegen_compile

:info:build _lto_codegen_create

:info:build _lto_codegen_debug_options

:info:build _lto_codegen_set_assembler_path

:info:build _lto_codegen_set_pic_model

:info:build _lto_codegen_write_merged_modules

:info:build _lto_get_error_message

:info:build _lto_get_version

:info:build _lto_module_create_from_memory

:info:build _lto_module_dispose

:info:build _lto_module_get_num_symbols

:info:build _lto_module_get_symbol_attribute

:info:build _lto_module_get_symbol_name

:info:build _lto_module_is_object_file_in_memory_for_target

:info:build collect2: ld returned 1 exit status

There was a missing header file called llvm-c/lto.h that I was able to find online and install on my system. On Leopard it is found here: /opt/local/libexec/llvm-3.3/include/llvm-c/lto.h. After continuing is when I saw the missing symbols. Is clang/llvm suppose to be installed first?

I do have a small favor to ask. Would you be able to create an installer of ld64-127? It would make things easier.

sudo port mdmg ld64-127

Last edited 4 years ago by programmingkidx (previous) (diff)

comment:24 Changed 4 years ago by kencu (Ken)

Although ld64-127 will build on Tiger:

 ld64-127 @127.2_14+llvm33 platform='darwin 8' archs='ppc' date='2020-02-03T18:00:47-0800

you cannot presently effectively run ld64-127 on Tiger, as it fails due to incompatibilities with crt0.o, and to make those work I had to do some surgery in the system libraries I don't want to own up to here :>

Do you know why you feel you want ld64-127 on Tiger? It is not needed for anything related to TenFourFox.

I would like to see you have success building TenFourFox! Please try this [60397#comment:22] instead. Once you get that working (very easy) then you can try skiing off-piste and see where you go. Best of luck!

comment:25 in reply to:  23 Changed 4 years ago by kencu (Ken)

Replying to programmingkidx:

I do have a small favor to ask. Would you be able to create an installer of ld64-127? It would make things easier.

I can make up an i386 archive for ld64-127 for you to try. Send me an email at my macports email: kencu-removethispart@…

comment:26 Changed 4 years ago by kencu (Ken)

Resolution: wontfix
Status: assignedclosed

ld64-127 is not presently supported on Tiger. I'll update you if I change my mind about that.

Note: See TracTickets for help on using tickets.