[MacPorts] #65100: weechat @3.5_0+ruby: error: invalid arch name '-arch -lx86_64'

MacPorts noreply at macports.org
Sun Jan 22 02:28:48 UTC 2023


#65100: weechat @3.5_0+ruby: error: invalid arch name '-arch -lx86_64'
---------------------------+----------------------
  Reporter:  hexadecagram  |      Owner:  cardi
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.7.2
Resolution:                |   Keywords:
      Port:  weechat       |
---------------------------+----------------------

Comment (by cardi):

 I poked around some more to understand why the architecture is being
 prefixed with `-l`, e.g., `-arch -l{arm64,x86_64}`, and I think I've
 figured it out.

 The `RUBY_LDFLAGS` is copied from `/opt/local/lib/pkgconfig/ruby-3.0.pc`:
 {{{
 DLDFLAGS=-L/opt/local/libexec/openssl11/lib -L/opt/local/lib
 -Wl,-headerpad_max_install_names
 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch
 arm64 -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup
 -L/opt/local/lib
 }}}

 When CMake finds Ruby (using
 [https://github.com/weechat/weechat/blob/v3.8/cmake/FindPkgConfig.cmake
 FindPkgConfig.cmake]), it copies the value of `DLDFLAGS` and replaces all
 spaces (` `) with semicolons (`;`). This leads to the following
 `RUBY_LDFLAGS`:
 {{{
 :info:configure -- Checking for one of the modules 'ruby-3.0'
 :info:configure -- CMAKE_SYSTEM_NAME="Darwin"
 :info:configure --
 RUBY_LDFLAGS="-L/opt/local/libexec/openssl11/lib;-L/opt/local/lib;-Wl,-headerpad_max_install_names;-Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk;-arch;arm64;-Wl,-multiply_defined,suppress;-Wl,-undefined,dynamic_lookup;-lruby.3.0"
 }}}

 Note in particular: `-arch;arm64;`.

 When the semicolons are converted back into spaces, `arm64` gets prefixed
 with `-l`: I'm not quite sure where this happens.

 Nonetheless, I think I'll have a patch that will remove `-arch;arm64;`
 since the architecture is already specified earlier in the command.

 Moving forward, either upstream will need to handle the space in `-arch
 arm64` or the MacPorts build of Ruby (or upstream Ruby?) needs to remove
 the space between the `-arch` flag and its value when writing the
 pkgconfig: I'm not sure what the "right" way should be.

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


More information about the macports-tickets mailing list