Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Building Qt on Mac: Should I worry about LLVM and Clang clashes?



  • Hi all.

    With the offline installers now abolished, I decided to build Qt locally.

    After running the configure script for Qt 5.15, I'm told that "QDoc will not be compiled, probably because libclang could not be located."

    The config-script's output says, "Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation."

    Mac OS doesn't come with llvm-config, so I put this in .zshenv:
    LLVM_INSTALL_DIR=/Library/Developer/CommandLineTools/usr/bin

    The config script still reports the doc problem, most likely because that's not where Clang is. The Xcode-supplied Clang resides in /Library/Developer/CommandLineTools/usr/lib/clang/11.0.3/lib/darwin in the form of lots of versions for various target platforms:
    libclang_rt.ios.a
    libclang_rt.osx.a
    libclang_rt.profile_ios.a
    libclang_rt.profile_iossim.a
    libclang_rt.profile_osx.a
    ...

    I guess the workaround would be setting up a symlink to libclang_rt.osx.a and putting it somewhere (in the LLVM dir?), right, but this seems like a can of worms and maintenance nightmare.

    So if I just install another LLVM (and presumably Clang) with Homebrew, do I need to worry about conflicts with the Xcode-supplied tools?

    Thanks!


  • Lifetime Qt Champion

    @Stokestack said in Building Qt on Mac: Should I worry about LLVM and Clang clashes?:

    With the offline installers now abolished

    Any reason you don't want to use online installer?



  • @jsulm Yes. I have multiple systems to configure. Going forward, I'd like to create an installer.

    Meanwhile: I ran make (with default settings), and after the lengthy build process I don't find the products in /usr/local as described in the documentation.

    I don't see any obvious errors at the end of the build output in the terminal. It looks like it built into the source directory.


  • Lifetime Qt Champion

    @Stokestack said in Building Qt on Mac: Should I worry about LLVM and Clang clashes?:

    I don't find the products in /usr/local

    make install
    

    ?



  • @jsulm Thanks. I expected to have to do that, but this step is conspicuously missing from the instructions here: https://doc.qt.io/qt-5/macos-building.html

    This only says you do that "If -prefix is outside the build directory," and then it involves an additional option.


  • Lifetime Qt Champion

    @Stokestack said in Building Qt on Mac: Should I worry about LLVM and Clang clashes?:

    This only says you do that "If -prefix is outside the build directory

    Which is the case, right? You mentioned /usr/local
    "and then it involves an additional option" - do you mean "-j 1"? It simply instructs make to not spawn more than one process. -j n is usually used to reduce build time by utilising all processors/cores.



  • @jsulm Thanks for the reply.

    Farther up the page, it says:

    By default, Qt is configured for installation in the /usr/local/Qt-%VERSION% directory, but this can be changed by using the -prefix option.

    I didn't use this option, so an instruction that explicitly refers to it does not seem applicable.


  • Lifetime Qt Champion

    @Stokestack To my knowledge "/usr/local" is default prefix.
    "and after the lengthy build process I don't find the products in /usr/local " - why do you expect anything in /usr/local if you did no call "make install"? Why don't you simply try to call "make install"?



  • @jsulm I've already answered this. "make install" is not listed as a required step in the instructions.

    And I DID do that, which produced the desired result. But this should be included in the documentation.


  • Lifetime Qt Champion

    @Stokestack It is documented: "If -prefix is outside the build directory, you need to install the library, examples, and tools in the appropriate place". So, not sure what needs to be documented?



  • @jsulm

    I didn't use -prefix. The documentation only says to use "make install" if you've used -prefix to specify a directory outside the build one. I didn't.

    Check it out:
    By default, Qt is configured for installation in the /usr/local/Qt-%VERSION% directory, but this can be changed by using the -prefix option.

    So if you don't use the -prefix option, it's logical to conclude that this doesn't apply to you:
    If -prefix is outside the build directory, you need to install the library, examples, and tools in the appropriate place. To do this, type:

    sudo make -j1 install

    As it turns out, the default condition here is that you must issue the make install command. So why not say that? Wouldn't it make more sense to say,

    Unless you've used the -prefix option to specify installation in the build directory, type
    sudo make -j1 install

    And does even that make sense? The products are already in the build directory if you don't say make install, right? So maybe it should say,

    If you wish to install the products outside the build directory (either in the default location or that specified by the -prefix option), type
    sudo make -j1 install


Log in to reply