Fix builds on MacOS Mojave [patch]

Hi!

I get build failures on Macos 10.14 Mojave.

How-to-repeat:
$ git clone <llvm-project>
$ cd llvm-project && mkdir build && cd build
$ cmake -G"Unix Makefiles" ../llvm
$ make # or "make -j${N}"
:
Building
:
In file included from /Users/marmur02/git/llvm-project/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp:20:
In file included from /opt/local/include/libxml2/libxml/xmlreader.h:14:
In file included from /opt/local/include/libxml2/libxml/tree.h:1307:
In file included from /opt/local/include/libxml2/libxml/xmlmemory.h:218:
In file included from /opt/local/include/libxml2/libxml/threads.h:35:
In file included from /opt/local/include/libxml2/libxml/globals.h:18:
In file included from /opt/local/include/libxml2/libxml/parser.h:810:
In file included from /opt/local/include/libxml2/libxml/encoding.h:31:
/opt/local/include/unicode/ucnv.h:52:10: fatal error: 'unicode/ucnv_err.h' file not found
#include "unicode/ucnv_err.h"
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

A fix is attached.

Thanks!

M

Mark Murray Staff Software Engineer | Arm
. . . . . . . . . . . . . . . . . . . . . . . . . . .
arm.com <http://www.arm.com>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

patch.diff (1.21 KB)

On an OS X install with Xcode, /opt/ is not expected to contain anything in particular; it doesn't make sense to hard-code it into the LLVM build system.

Are you trying to use homebrew to build LLVM?

-Eli

I get burned one thing or another almost every time I upgrade XCode. Recently I ran into this problem, but chose to solve it locally by adding the following to my cache file:

set(CMAKE_C_FLAGS “-I/opt/local/include ${CMAKE_C_FLAGS}” CACHE STRING “”)
set(CMAKE_CXX_FLAGS “-I/opt/local/include ${CMAKE_CXX_FLAGS}” CACHE STRING “”)

I use macports, which installs this stuff in /opt.

I sorta gave up on OSX working out of the box, so I patch as I go…

hth…
don

Hi

I have macports, but I'm not directly using it - it's just being found by the build process somehow.

The failure shows that /opt/... is being used, but that usage seems broken or incomplete.

M

    On an OS X install with Xcode, /opt/ is not expected to contain anything in particular; it doesn't make sense to hard-code it into the LLVM build system.

    Are you trying to use homebrew to build LLVM?

    -Eli

Hello Mark,

I think I ran into a similar problem at home with macports installed.
At the time I thought it more a problem with macports than clang. The
ticket https://trac.macports.org/ticket/58350 might cover it although
I don't know much more than that.

Peter

Hi Peter,

Thanks - now to encourage a fix :slight_smile:

M

    Hello Mark,

    I think I ran into a similar problem at home with macports installed.
    At the time I thought it more a problem with macports than clang. The
    ticket https://trac.macports.org/ticket/58350 might cover it although
    I don't know much more than that.

    Peter