Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#62533 closed enhancement (duplicate)

llvm 11: include lld in installation

Reported by: gpanders (Gregory Anders) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), kencu (Ken), cooljeanius (Eric Gallager), saagarjha (Saagar Jha)
Port: llvm-11

Description

Currently, installing LLVM via either the clang-11 or llvm-11 port does not include lld. I noticed this when trying to update the zig port to 0.7.1. When building, it failed with

-- Could NOT find lld (missing: LLD_LIBRARIES LLD_INCLUDE_DIRS)
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LLD_INCLUDE_DIRS (ADVANCED)
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1
   used as include directory in directory /opt/local/var/macports/build/_private_var_tmp_zig/zig/work/zig-0.7.1

CMake Error in CMakeLists.txt:
  Found relative path while evaluating include directories of
  "embedded_softfloat":

    "LLD_INCLUDE_DIRS-NOTFOUND"

Looking at the llvm include dirs, lld is indeed missing:

$ ls -al /opt/local/libexec/llvm-11/include/
total 0
drwxr-xr-x   3 root  admin    96B Mar 23 09:31 c++/
drwxr-xr-x  25 root  admin   800B Mar 23 09:31 clang/
drwxr-xr-x  11 root  admin   352B Mar 23 09:31 clang-c/
drwxr-xr-x  36 root  admin   1.1K Mar 23 09:31 clang-tidy/
drwxr-xr-x  47 root  admin   1.5K Mar 23 09:30 llvm/
drwxr-xr-x  29 root  admin   928B Mar 23 09:30 llvm-c/

Compare this to the Homebrew version of the LLVM installation:

$ ls -al /usr/local/opt/llvm/include/
total 0
drwxr-xr-x   3 greande  SANDIA\Domain Users    96B Feb  3 14:51 c++/
drwxr-xr-x  25 greande  SANDIA\Domain Users   800B Feb  3 14:51 clang/
drwxr-xr-x  11 greande  SANDIA\Domain Users   352B Feb  3 14:51 clang-c/
drwxr-xr-x  36 greande  SANDIA\Domain Users   1.1K Feb  3 14:51 clang-tidy/
drwxr-xr-x   5 greande  SANDIA\Domain Users   160B Feb  3 14:51 lld/
drwxr-xr-x  25 greande  SANDIA\Domain Users   800B Feb  3 14:51 lldb/
drwxr-xr-x  47 greande  SANDIA\Domain Users   1.5K Feb  3 14:51 llvm/
drwxr-xr-x  29 greande  SANDIA\Domain Users   928B Feb  3 14:51 llvm-c/
drwxr-xr-x  20 greande  SANDIA\Domain Users   640B Feb  3 14:51 mlir/
drwxr-xr-x   3 greande  SANDIA\Domain Users    96B Feb  3 14:51 mlir-c/
drwxr-xr-x  28 greande  SANDIA\Domain Users   896B Feb  3 14:51 polly/

Change History (10)

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

Yes, I haven't enabled lld in MacPorts as yet.

So far, there was no visible point to doing so, as we build and use Apple's ld64 instead.

If zig requires lld then it is the first software I've heard that does.

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

Somewhere there is another ticket from several years ago wondering if we needed lld -- so this might turn out to be a duplicate if that ticket can be located.

comment:3 Changed 3 years ago by gpanders (Gregory Anders)

According to their installation docs, it looks like zig does require lld.

Edit to add: it looks like zig 0.5.0 (the version currently in MacPorts) included lld in its distribution, which is why this wasn't an issue until trying to upgrade to 0.7.1.

Last edited 3 years ago by gpanders (Gregory Anders) (previous) (diff)

comment:4 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

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

for historical reasons, macports has factored it's llvm tree build. we have lldb, polly, mlir, and flang available separately.

The reason this was done has to do with the Apple cctools and ld64 ports using only llvm. By factoring llvm out, you save space for all users and make bootstrapping easier, as llvm has simpler build requirements compared to the rest.

But as the llvm family grows, and more software uses more parts of it, things get complicated and increasingly I am leaning towards two ports, llvm and "everything else that builds on a given os version except llvm".

llvm offers no targets that match that latter group, of course, There are lots of places in the MP code that expect clang to be a separate port. I might add everything other than llvm into the clang port, rather than factor things even more than they are now. But there will be arguments made against doing that.

comment:6 in reply to:  3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: duplicate
Status: assignedclosed

Replying to kencu:

Somewhere there is another ticket from several years ago wondering if we needed lld -- so this might turn out to be a duplicate if that ticket can be located.

#58042.

Replying to gpanders:

According to their installation docs, it looks like zig does require lld.

I see that their documentation makes that claim, but who knows if it's accurate. I would first try to build without lld and see what happens.

comment:7 Changed 3 years ago by saagarjha (Saagar Jha)

Cc: saagarjha added

comment:8 Changed 3 years ago by gpanders (Gregory Anders)

I see that their documentation makes that claim, but who knows if it's accurate. I would first try to build without lld and see what happens.

I did try that and it failed, which is when I opened this ticket.

From their CMakeLists.txt file, here is where they use the lld headers and here is where they link against lld.

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

I put this lld addition to the clang-11 port together for some early testers <https://github.com/macports/macports-ports/pull/10404>.

Note: See TracTickets for help on using tickets.