Opened 2 years ago

Closed 23 months ago

Last modified 8 months ago

#65575 closed defect (fixed)

[OSX 10.6.8] -- Error: Failed to build ld64-274: command execution failed

Reported by: lawlist Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: ld64-274

Description

  • Snow Leopard 10.6.8, with Xcode 3.2.6.
  • This particular attempt at building ld64-274 [with the ultimate goal of building the "rust" port] was performed _without_ any toolchain update as suggested in the following link:

https://trac.macports.org/wiki/LibcxxOnOlderSystems

  • I have made a couple of previous attempts at building the rust port _with_ the aforementioned toolchain update, but those prior attempts also failed.
  • Terminal Output:
--->  Fetching distfiles for ld64-274
--->  Attempting to fetch ld64-274.2.tar.gz from http://distfiles.macports.org/ld64
--->  Verifying checksums for ld64-274
--->  Extracting ld64-274
--->  Applying patches to ld64-274
--->  Configuring ld64-274
--->  Building ld64-274
Error: Failed to build ld64-274: command execution failed
Error: See ..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port rust failed
  • Build Log (main.log)
:info:build /.../bin/clang++-mp-11 -Os -Os -std=c++11 -stdlib=libc++ -stdlib=libc++ -arch x86_64 -I/.../libexec/llvm-3.4/include -DLTO_SUPPORT -Isrc/abstraction -Isrc/ld -Isrc/ld/parsers -I/.../include -I/.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/dyld-655.1.1/include  -c -o src/ld/parsers/macho_relocatable_file.o src/ld/parsers/macho_relocatable_file.cpp
:info:build In file included from src/ld/parsers/macho_relocatable_file.cpp:37:
:info:build In file included from src/ld/parsers/libunwind/DwarfInstructions.hpp:43:
:info:build In file included from src/ld/parsers/libunwind/AddressSpace.hpp:38:
:info:build /.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/dyld-655.1.1/include/mach-o/dyld_priv.h:255:5: error: 'TARGET_OS_WATCH' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
:info:build #if TARGET_OS_WATCH
:info:build     ^
:info:build /.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/dyld-655.1.1/include/mach-o/dyld_priv.h:270:5: error: 'TARGET_OS_BRIDGE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
:info:build #if TARGET_OS_BRIDGE
:info:build     ^
:info:build 2 errors generated.
:info:build make: *** [src/ld/parsers/macho_relocatable_file.o] Error 1
:info:build make: Leaving directory `/.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/ld64-274.2'
:info:build Command failed:  cd "/.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/ld64-274.2" && /usr/bin/make -j1 -w all CC="/.../bin/clang-mp-11" CXX="/.../bin/clang++-mp-11" OTHER_CPPFLAGS="-I/.../include -I/.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/work/dyld-655.1.1/include" OTHER_CFLAGS="-Os -arch x86_64" OTHER_CXXFLAGS="-Os -std=c++11 -stdlib=libc++ -stdlib=libc++ -arch x86_64" OTHER_LDFLAGS="-L/.../lib -Wl,-headerpad_max_install_names -lc++abi -stdlib=libc++ -arch x86_64" LLVM_CONFIG=/.../bin/llvm-config-mp-3.4 
:info:build Exit code: 2
:error:build Failed to build ld64-274: command execution failed
:debug:build Error code: CHILDSTATUS 89038 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /.../var/macports/logs/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ld64/ld64-274/main.log for details.

Attachments (5)

0.ld64-274_main.log (29.0 KB) - added by lawlist 2 years ago.
0.ld64-274_terminal.log (582.0 KB) - added by lawlist 2 years ago.
0.ld64-274_terminal_002.log (86.2 KB) - added by lawlist 2 years ago.
0.ld64-274_main_002.log (612.1 KB) - added by lawlist 2 years ago.
0.ld64-274_main_003.log (457.1 KB) - added by lawlist 2 years ago.

Download all attachments as: .zip

Change History (24)

Changed 2 years ago by lawlist

Attachment: 0.ld64-274_main.log added

Changed 2 years ago by lawlist

Attachment: 0.ld64-274_terminal.log added

comment:1 Changed 2 years ago by lawlist

Port: ld64-274 added

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

the likely issue here is that clang-11 is too new to tolerate small issues in the build that older clangs did tolerate.

Sure, someone should fix those. But for now, you could take 5 minutes and try building it with an older clang, perhaps like this:

sudo port clean ld64-274
sudo port install clang-5.0
sudo port -v install ld64-274 configure.compiler=macports-clang-5.0

Changed 2 years ago by lawlist

Attachment: 0.ld64-274_terminal_002.log added

Changed 2 years ago by lawlist

Attachment: 0.ld64-274_main_002.log added

comment:3 Changed 2 years ago by lawlist

Thank you, @kencu, your suggestion resulted in a successful build of ld64-274. The attempt to build rust, however, was unsuccessful. I will submit a separate ticket for the failed rust build. There were a couple of warnings building ld64-274, but I assume those are not important. In case the updated logs might be helpful, I've attached them as version ...002.

src/ld/parsers/lto_file.cpp:51:9: warning: '__STDC_LIMIT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_LIMIT_MACROS 1
        ^
/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/libexec/llvm-5.0/include/c++/v1/stdint.h:113:12: note: previous definition is here
#   define __STDC_LIMIT_MACROS
           ^
src/ld/parsers/lto_file.cpp:52:9: warning: '__STDC_CONSTANT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_CONSTANT_MACROS 1
        ^
/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/libexec/llvm-5.0/include/c++/v1/stdint.h:116:12: note: previous definition is here
#   define __STDC_CONSTANT_MACROS
           ^
2 warnings generated.

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

OK, progress. Your new error:

6755	:info:build running: /.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo build --manifest-path /.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/Cargo.toml --verbose --verbose --offline
6756	:info:build dyld: Library not loaded: /opt/local/lib/libiconv.2.dylib
6757	:info:build   Referenced from: /.../var/macports/build/_..._var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo
6758	:info:build   Reason: Incompatible library version: cargo requires version 9.0.0 or later, but libiconv.2.dylib provides version 7.0.0

seems to indicate that the version of libiconv you have installed is somehow too old...

I'm on Monterey right now, but my libconv seems to be the right version:

% port info libiconv                  
libiconv @1.17 (textproc)

% otool -L /opt/local/lib/libiconv.2.dylib
/opt/local/lib/libiconv.2.dylib:
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

do you have some old version of libiconv installed somehow? what does your installation show for the above ?

comment:5 Changed 2 years ago by lawlist

This is a barebones installation of OSX Snow Leopard retail DVD, with 10.6.8 update combo from Apple, and Xcode 3.2.6. The installation of Macports is a new/fresh install beginning with port -v selfupdate and then port install rust, _without_ the toolchain update described in the document section of ... LibcxxOnOlderSystems. Macports has chosen libiconv 1.17 during the installation of the prerequisites to building rust.

$ port info libiconv
libiconv @1.17 (textproc)
Variants:             universal

Description:          A character-set conversion library which implements the
                      iconv() API for dealing with unicode and other types of
                      conversion.
Homepage:             https://www.gnu.org/software/libiconv/

Build Dependencies:   gperf, clang-3.4
Library Dependencies: libcxx
Platforms:            darwin, freebsd, linux
License:              (LGPL-2+ or GPL-3+)
Maintainers:          Email: ryandesign@macports.org, GitHub: ryandesign

comment:6 Changed 2 years ago by lawlist

$ /.../macports_2_7_2/bin/otool -L /.../macports_2_7_2/lib/libiconv.2.dylib

/.../macports_2_7_2/lib/libiconv.2.dylib:
     /.../macports_2_7_2/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
     /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
Last edited 2 years ago by lawlist (previous) (diff)

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

what do you have at here, though?

/opt/local/lib/libiconv.2.dylib

your error shows you have some different libiconv.2.dylib that is supplying version 7.0.0 there, and that is the one that is not being accepted by cargo...

now, if you have absolutely nothing there:

/opt/local/lib/libiconv.2.dylib

then that is a mystery indeed, and may indicate some issue with the port using alternative prefixes.

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

If you have nothing at /opt/local/lib/libiconv.2.dylib then throw a copy of libiconv.2.dylib there, or symlink it to that location, or update the reference to libiconv in cargo that fails and point it to the one you actually have installed, or some similar workaround to make cargo happy.

Making rust work on 10.6.8 was a helluva project, and I'm not sure that anyone has actually tried alternative prefixes with it before. There could be some issues to be discovered still.

Changed 2 years ago by lawlist

Attachment: 0.ld64-274_main_003.log added

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

:info:build dyld: Library not loaded: /opt/local/libexec/openssl11/lib/libssl.1.1.dylib

just out of curiosity, do you have any version of macports installed in /opt/local??

Something sure thinks you do…

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

seems like 99% of your current troubles are being caused by your alternative prefix, for some reason or another…

whether it’s the rust port or your setup is not yet clear.

comment:11 Changed 2 years ago by lawlist

Yes, I'm using a custom configure installation path:

./configure --prefix=/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2 \
--with-applications-dir=/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/.0.applications

I have now created the directory structure of /opt/local/lib and copied the file libiconv.2.dylib to that location and made a clean and install. Nothing else is located at the new path of /opt/local/. I've attached the updated build log as ...03 to this ticket. It looks like Macports is now looking for other things at /opt/local/.... Perhaps I could set a configuration of CPPFLAGS and LDFLAGS in the terminal?

The past 30 years of my life is stored in /Users/HOME/.0.data/..., and that directory gets synced with rsync to a few different computers, and is also backed up to dedicated backup disks by date ... A custom directory structure for the Macports installation is what I have been using for several years now.

:info:build Building rustbuild
:info:build running: /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo build --manifest-path /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/Cargo.toml --verbose --verbose --offline
:info:build dyld: Library not loaded: /opt/local/libexec/openssl11/lib/libssl.1.1.dylib
:info:build   Referenced from: /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo
:info:build   Reason: image not found
:info:build Traceback (most recent call last):
:info:build   File "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/bootstrap.py", line 1342, in <module>
:info:build     main()
:info:build   File "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/bootstrap.py", line 1325, in main
:info:build     bootstrap(help_triggered)
:info:build   File "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/bootstrap.py", line 1299, in bootstrap
:info:build     build.build_bootstrap()
:info:build   File "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/bootstrap.py", line 1044, in build_bootstrap
:info:build     run(args, env=env, verbose=self.verbose)
:info:build   File "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/bootstrap.py", line 185, in run
:info:build     raise RuntimeError(err)
:info:build RuntimeError: failed to run: /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo build --manifest-path /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/Cargo.toml --verbose --verbose --offline
:info:build make: *** [all] Error 1
:info:build make: Leaving directory `/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src'
:info:build Command failed:  cd "/Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/build/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.61.0-src" && /usr/bin/make -j1 -w all BOOTSTRAP_ARGS="-j1" 
:info:build Exit code: 2
:error:build Failed to build rust: command execution failed
:debug:build Error code: CHILDSTATUS 63825 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /Users/HOME/.0.data/.0.emacs/.0.macports_2_7_2/var/macports/logs/_Users_HOME_.0.data_.0.emacs_.0.macports_2_7_2_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/main.log for details.

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

cargo seems to be looking for several different libs it needs it /opt/local.

see https://trac.macports.org/ticket/65468

there seems to be an embedded cargo binary. You may need to change all the lib references to your custom prefix in that cargo binary using install_name_tool

that’s a bit yuk, but easy enough to do…

comment:13 Changed 2 years ago by lawlist

Thank you for the suggestion. I will have another crack at this again tomorrow with a cup of coffee in hand ...

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

during bootstrap on 10.6 (and 10.5) the rust port, via the cargo portgroup, then via the rust portgroup, will download a bootstrap cargo binary from Marcus' personal github repo here:

https://github.com/MarcusCalhoun-Lopez/rust/releases/

that bootstrap cargo is hard-coded to look for it's libraries in /opt/local :

% otool -L cargo
cargo:
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.40)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
	/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 596.15.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
	/opt/local/libexec/openssl11/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/opt/local/libexec/openssl11/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

So to use that prebuilt cargo bootstrap binary with an alternate prefix, you will need to make it happy somehow.

Either install all those libraries it wants into "/opt/local", or use install_name_tool to change the library locations in the cargo binary itself.

This port, at present, cannot be installed in an alternate prefix on < 10.7 at least.

comment:15 Changed 2 years ago by lawlist

The installation of rust succeeded by adding three (3) of the files mentioned in the previous post, using the following directory structure:

/opt/local
/opt/local/lib
/opt/local/lib/libiconv.2.dylib
/opt/local/libexec
/opt/local/libexec/openssl11
/opt/local/libexec/openssl11/lib
/opt/local/libexec/openssl11/lib/libcrypto.1.1.dylib
/opt/local/libexec/openssl11/lib/libssl.1.1.dylib

I was able to see the cargo executable during the building process in one of the temporary working directories, but I did not see it anywhere else that would permit patching with the install-name-tool utility (which I have not yet learned how to use). Even after the successful build, I don't see a cargo executable in the bin directory of the Macports installation -- the new executables that appeared after the build was completed are .../bin/cargo-clippy and .../bin/cargo-fmt. Perhaps the cargo executable is only available on a temporary basis while building rust and is then later removed when the build completes ...

[Building the rust port in the virtual machine that I am using to test the Macports installation, with all the port prerequisites / dependencies already installed, is approximately 12 hours in duration.]

Last edited 2 years ago by lawlist (previous) (diff)

comment:16 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:17 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

There is a pull request that attempts to fix this problem.

comment:18 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Owner: set to MarcusCalhoun-Lopez
Resolution: fixed
Status: newclosed

In 35707d2f9532105ceac26781a113e6637ed612a4/macports-ports (master):

ld64-274: fix build with newer compilers

Newer versions of Clang are less forgiving of undefined macros.
Fixes #65575
No revbump since port either builds correctly or not at all.

comment:19 Changed 8 months ago by kencu (Ken)

In 8f23a82f1c0403f0828c2904d22fff1586762e4a/macports-ports (master):

ld64: more robust fix for missing conditionals

the previous fix only applied to one subport
patch in a fix for all subports
fixes ld64-latest and others

see #65575

Note: See TracTickets for help on using tickets.