Opened 20 months ago

Last modified 6 months ago

#65763 assigned defect

ld64-274 @274.2: opportunistically uses libxar; possible dependency cycle

Reported by: RobK88 Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: lion Cc: cooljeanius (Eric Gallager)
Port: ld64-274

Description

I am able to build the x86_64 binary for ld64-274 on lion (10.7.5)

But I am unable to build the +universal variant.

Please see below and the attached main.log for more details.

ld: warning: ignoring file /opt/local/lib/libxar.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libxar.dylib
Undefined symbols for architecture i386:
  "_xar_add_frombuffer", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_close", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::~BundleHandler() in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_extract_tobuffersz", referenced from:
      ld::passes::bitcode_bundle::FileHandler::initFile() in bitcode_bundle.o
  "_xar_file_first", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
  "_xar_file_next", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
  "_xar_iter_free", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
  "_xar_iter_new", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
  "_xar_open", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_opt_set", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_prop_create", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_prop_first", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
  "_xar_prop_get", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::init() in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
  "_xar_prop_next", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
  "_xar_prop_set", referenced from:
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_prop_unset", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::copyXARProp(__xar_file_t const*, __xar_file_t const*) in bitcode_bundle.o
  "_xar_subdoc_first", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
  "_xar_subdoc_name", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
  "_xar_subdoc_new", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
      ld::passes::bitcode_bundle::BitcodeBundle::doPass() in bitcode_bundle.o
  "_xar_subdoc_next", referenced from:
      ld::passes::bitcode_bundle::BundleHandler::obfuscateAndWriteToPath(ld::passes::bitcode_bundle::BitcodeObfuscator*, char const*) in bitcode_bundle.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ld] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64-274/work/ld64-274.2'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64-274/work/ld64-274.2" && /usr/bin/make -j4 -w all CC="/usr/bin/clang" CXX="/usr/bin/clang++" OTHER_CPPFLAGS="-I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64-274/work/dyld-655.1.1/include" OTHER_CFLAGS="-Os -arch x86_64 -arch i386" OTHER_CXXFLAGS="-Os -std=c++11 -stdlib=libc++ -stdlib=libc++ -arch x86_64 -arch i386" OTHER_LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -lc++abi -stdlib=libc++ -arch x86_64 -arch i386" LLVM_CONFIG=/opt/local/bin/llvm-config-mp-3.4 
Exit code: 2
Error: Failed to build ld64-274: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_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 ld64-274 failed
bash-3.2$

Attachments (1)

main.log (71.2 KB) - added by RobK88 20 months ago.
main.log

Download all attachments as: .zip

Change History (8)

Changed 20 months ago by RobK88

Attachment: main.log added

main.log

comment:1 Changed 20 months ago by jmroot (Joshua Root)

Cc: jeremyhu@… removed
Owner: set to jeremyhu
Status: newassigned

comment:2 in reply to:  description Changed 20 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to RobK88:

ld: warning: ignoring file /opt/local/lib/libxar.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libxar.dylib

And what are the architectures of this file?

lipo -info /opt/local/lib/libxar.1.dylib
file /opt/local/lib/libxar.1.dylib

And for what architectures does MacPorts think it has installed it?

port -v installed xar

comment:3 Changed 20 months ago by RobK88

Ryan,

Sorry for the delay. I just realized that you had posted some questions.

Here are the answers to your questions:

bash-3.2$ lipo -info /opt/local/lib/libxar.1.dylib
Non-fat file: /opt/local/lib/libxar.1.dylib is architecture: x86_64
bash-3.2$ 
bash-3.2$ file /opt/local/lib/libxar.1.dylib
/opt/local/lib/libxar.1.dylib: Mach-O 64-bit dynamically linked shared library x86_64
bash-3.2$ 
bash-3.2$ port -v installed xar
The following ports are currently installed:
  xar @1.8.0.487.100.1_2 (active) requested_variants='' platform='darwin 11' archs='x86_64' date='2022-09-17T13:21:52-0400'
bash-3.2$ 

It looks like only the 64 bit version of xar is installed on my Mac.

comment:4 Changed 19 months ago by RobK88

P.S. I tried to install the universal variant of xar but was unable. When I try to do this, MacPorts first tries to install the universal variant of ld64-274 which of course fails.

bash-3.2$ sudo port clean ld64-274
--->  Cleaning ld64-274
bash-3.2$ sudo port clean xar
--->  Cleaning xar
bash-3.2$ 
bash-3.2$ sudo port install xar +universal
--->  Computing dependencies for ld64-274
--->  Fetching distfiles for ld64-274
--->  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 /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64-274/main.log for details.
Error: Unable to execute port: upgrade libxml2 failed
bash-3.2$

comment:5 Changed 7 months ago by RobK88

I just revisited this ticket, And for some reason, I am now able to build the +universal variant for ld64-274 on my old Mac Pro running Lion. See below:

bash-3.2$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.7.5
BuildVersion:	11G63
bash-3.2$
bash-3.2$ sudo port clean ld64-274 @274.2_0+llvm34+universal 
--->  Cleaning ld64-274
bash-3.2$ 
bash-3.2$ sudo port -st install ld64-274 +universal
--->  Computing dependencies for ld64-274
--->  Fetching distfiles for ld64-274
--->  Verifying checksums for ld64-274
--->  Extracting ld64-274
--->  Applying patches to ld64-274
--->  Configuring ld64-274
--->  Building ld64-274
--->  Staging ld64-274 into destroot                     
--->  Installing ld64-274 @274.2_0+llvm34+universal
--->  Activating ld64-274 @274.2_0+llvm34+universal
--->  Cleaning ld64-274
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
bash-3.2$

I suspect either ld64-274 was updated or one of is dependencies since the ticket was created that fixed the bug on Lion. (I am also now able to build the universal variant of xar).

We should probably close this ticket now.

comment:6 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Summary: ld64-274 - universal variant -- Linker Failed - Undefined symbols for architecture i386 & /opt/local/lib/libxar.dylib, file was built for unsupported file formatld64-274 @274.2: opportunistically uses libxar; possible dependency cycle

We shouldn't close the ticket because at least one of the problems still exists, namely that ld64-274 links with the MacPorts libxar.dylib without declaring a dependency on port:xar.

The second problem was:

When I try to [install the universal variant of xar], MacPorts first tries to install the universal variant of ld64-274 which of course fails

That would be a dependency cycle. If that still exists, it has to be resolved one way or another. (Either ld64-274 cannot use xar or xar cannot use ld64-274.)

comment:7 Changed 6 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added
Note: See TracTickets for help on using tickets.