This is an archive of the discontinued LLVM Phabricator instance.

Fix ncurses/zlib in LLVM_SYSTEM_LIBS for Windows GNU
ClosedPublic

Authored by haampie on Aug 24 2020, 1:34 AM.

Details

Summary

For the Windows GNU platform, CMAKE_FIND_LIBRARY_PREFIXES is a list containing an empty string, which ended up in a regex capturing group, which is invalid in CMake's regex engine. With this change, we get the following:

set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
get_system_libname(path/to/libz.dll.a zlib)
message("${zlib}")

outputs z, as expected.

Diff Detail

Event Timeline

haampie created this revision.Aug 24 2020, 1:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2020, 1:34 AM
haampie requested review of this revision.Aug 24 2020, 1:34 AM

@mati865 can you test this on your platform? You only have to run cmake ../llvm and check whether tools/llvm-config/BuildVariables.inc: has a proper #define LLVM_SYSTEM_LIBS "-lrt -ldl -lpthread -lm -lz -ltinfo"

mati865 accepted this revision.Aug 24 2020, 1:51 AM

Thank you, now it works as expected:

$ cat tools/llvm-config/BuildVariables.inc | grep LLVM_SYSTEM_LIBS
#define LLVM_SYSTEM_LIBS "-lpsapi -lshell32 -lole32 -luuid -ladvapi32 -lz"
This revision is now accepted and ready to land.Aug 24 2020, 1:51 AM
This revision was landed with ongoing or failed builds.Aug 24 2020, 11:06 PM
This revision was automatically updated to reflect the committed changes.
hans added a subscriber: hans.Aug 25 2020, 2:23 AM

This broke Chromium's clang packaging:
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8871016556723646144/+/steps/package_clang/0/stdout

CMake Error at lib/Support/CMakeLists.txt:13 (string):

string sub-command REGEX, mode REPLACE: regex "^()" matched an empty
string.

Call Stack (most recent call first):

lib/Support/CMakeLists.txt:223 (get_system_libname)

I've reverted in 6da4f1199e7c3129f6e2ef7a24a2c75e386be32d