This is an archive of the discontinued LLVM Phabricator instance.

Fix build for mingw.
ClosedPublic

Authored by abidh on Dec 14 2016, 8:40 AM.

Details

Summary

I was building lldb using cross mingw-w64 toolchain on Linux and observed some issues. This is first patch in the series to fix that build. It mostly corrects the case of include files and adjusts some #ifdefs from _MSC_VER to _WIN32 and vice versa. I built lldb on windows with VS after applying this patch to make sure it does not break the build there.

Diff Detail

Event Timeline

abidh updated this revision to Diff 81387.Dec 14 2016, 8:40 AM
abidh retitled this revision from to Fix build for mingw..
abidh updated this object.
abidh added reviewers: labath, zturner.
abidh added a subscriber: lldb-commits.
labath edited edge metadata.Dec 14 2016, 9:28 AM

I'll leave Zachary to approve, but it seems reasonable.

BTW, I am curious, are you planning on building python with mingw as well? If you are, I'd be interested in knowing how that works out.

cmake/modules/LLDBConfig.cmake
246

Could you check if it's enough to pass -DFOO regardless of the platform. This is the only usage of the /D version in the llvm codebase, which leads me to believe that msvc will accept the -D version as well (or cmake will somehow convert in for him.

source/Core/Mangled.cpp
12

Should we use LLVM_ON_WIN32 here? That seems to be the llvm preffered solution...

zturner added inline comments.Dec 14 2016, 9:35 AM
cmake/modules/LLDBConfig.cmake
246

I think the -D syntax works on both, so I would change this back to the original condition, and just change the / to a -

For example, right above this line you can see things like -wd4150, and right below this line you can see things like -D_LARGEFILE_SOURCE

abidh added a comment.Dec 14 2016, 9:47 AM

BTW, I am curious, are you planning on building python with mingw as well? If you are, I'd be interested in knowing how that works out.

I would like to do it but have not done it yet. I will keep you posted.

cmake/modules/LLDBConfig.cmake
246

OK. I will change it accordingly.

source/Core/Mangled.cpp
12

Do you mean use LLVM_ON_WIN32 everywhere instead of _WIN32 or just here?

Yeah, I meant using it everywhere as a generic "am I on windows, regardless of the compiler" check. (Assuming Zach is fine with that)

abidh added a comment.Dec 15 2016, 2:16 AM

Yeah, I meant using it everywhere as a generic "am I on windows, regardless of the compiler" check. (Assuming Zach is fine with that)

OK. If Zachary is fine with that then I can do that in a separate commit.

@zturner
Do you have any other comment on this patch ?

abidh updated this revision to Diff 81576.Dec 15 2016, 7:08 AM
abidh edited edge metadata.

Replaced /D with -D as per comments.

abidh accepted this revision.Dec 15 2016, 7:09 AM
abidh added a reviewer: abidh.
abidh marked an inline comment as done.

Accepted in email.

This revision is now accepted and ready to land.Dec 15 2016, 7:09 AM
abidh closed this revision.Dec 15 2016, 7:11 AM