Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Use CMake's built-in toolchain detection #23998

Conversation

jkoritzinsky
Copy link
Member

Try removing manual resolution of toolchain for non-cross builds and let CMake resolve the toolchain itself.

@jkoritzinsky jkoritzinsky changed the title WIP: Use CMake's built-in toolchain detection Use CMake's built-in toolchain detection Apr 15, 2019
@jkoritzinsky jkoritzinsky requested a review from jkotas April 15, 2019 23:46
@jkoritzinsky jkoritzinsky marked this pull request as ready for review April 15, 2019 23:46
@jkotas jkotas requested a review from janvorli April 15, 2019 23:47
@jkotas
Copy link
Member

jkotas commented Apr 15, 2019

@janvorli understands the cmake plumbing

@janvorli
Copy link
Member

I've looked why we have added the stuff that is now being removed. It comes from the ancient #35 and it looks like it was fixing a problem related to building with clang 3.4 or 3.5.
But I want to verify that it always picks the same version of the llvm-xxx tools as the clang. I have many llvm versions installed on my Linux box side by side, so I can do that.

@jkoritzinsky
Copy link
Member Author

@janvorli sounds good. If you can take a look at that when you have some free cycles that'd be great!

@janvorli
Copy link
Member

Unfortunately, the results of my testing show this change is problematic. With your change, the cmake variables are set as follows for all versions of clang:

CMAKE_AR: /usr/bin/ar
CMAKE_LINKER: /usr/bin/ld
CMAKE_NM: /usr/bin/nm
CMAKE_OBJDUMP /usr/bin/objdump

Without your change, the correct llvm versions of the tools are used. Example - clang 4.0:

CMAKE_AR: /usr/bin/llvm-ar-4.0
CMAKE_LINKER: /usr/bin/llvm-link-4.0
CMAKE_NM: /usr/bin/llvm-nm-4.0
CMAKE_OBJDUMP /usr/bin/llvm-objdump-4.0

@jkoritzinsky
Copy link
Member Author

Ah well. Guess this isn’t gonna work without some additional work to preserve the behavior. I’ll close this for now and take another stab at it some time.

@janvorli
Copy link
Member

It causes the same issue for cross build. For example alpine arm32 build

CMAKE_AR: /usr/bin/armv6-alpine-linux-musleabihf-ar
CMAKE_LINKER: /usr/bin/armv6-alpine-linux-musleabihf-ld
CMAKE_NM: /usr/bin/armv6-alpine-linux-musleabihf-nm
CMAKE_OBJDUMP /usr/bin/armv6-alpine-linux-musleabihf-objdump

while the state before your change was the same as for x64.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants