Bug 1396683 - clarify bindgen error messages around clang; r=rillian

Stylo's recent enabled-by-default behavior, combined with some Linux
distributions's packaging of LLVM separately from Clang, causes
confusion.  To allay such confusion, rearrange the configure checks to
do two things:

1) Check for the clang binary prior to checking for clang's shared
   libraries; it should be more obvious what you need to install from
   an error about clang, and installing clang should pull in the
   necessary clang libraries, avoiding the following scenario:

     - run configure
     - get error message about libclang
     - install libclang
     - run configure
     - get error message about clang

2) Provide some context for what to do to avoid this error; the user may
not understand why we need a separate C/C++ compiler when they already
have a perfectly suitable one on their system.
This commit is contained in:
Nathan Froyd 2017-09-06 15:43:30 -04:00
Родитель bc3dc5264b
Коммит 1594b08efb
1 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -739,10 +739,19 @@ with only_when(building_stylo_bindgen):
# but not have other packages installed. Since the user is trying
# to use their system packages, we can't be more specific about what
# they need.
clang_resolved = find_program(clang_path)
if not clang_resolved:
die(dedent('''\
The file {} returned by `llvm-config {}` does not exist.
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(clang_path, '--bindir')))
if not os.path.exists(libclang_path):
die(dedent('''\
The directory {} returned by `llvm-config {}` does not exist.
Please check your system configuration.
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(libclang_path, libclang_arg)))
(found, searched) = search_for_libclang(libclang_path)
@ -750,16 +759,10 @@ with only_when(building_stylo_bindgen):
die(dedent('''\
Could not find the clang shared library in the path {}
returned by `llvm-config {}` (searched for files {}).
Please check your system configuration.
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(libclang_path, libclang_arg, searched)))
clang_resolved = find_program(clang_path)
if not clang_resolved:
die(dedent('''\
The file {} returned by `llvm-config {}` does not exist.
Please check your system configuration.
'''.format(clang_path, '--bindir')))
return namespace(
libclang_path=libclang_path,
clang_path=clang_resolved,