Fix Object libraries cause problem on the mac build bot#2472
Fix Object libraries cause problem on the mac build bot#2472ImmanuelHaffner wants to merge 1 commit intoWebAssembly:masterfrom ImmanuelHaffner:libbinaryen-fix-objectlibary-not-linkable
Conversation
|
Thanks @ImmanuelHaffner! Testing locally, I see the same errors as on CI, |
|
Oh damn. Could that mean that dependencies are missing...? |
|
Doing some searching, I think the issue is that object libraries must be sources, not link flags, see https://cmake.org/pipermail/cmake/2018-June/067721.html With this patch I seem to get further, but hit another error, https://gist.github.com/kripken/56fbec00a34be9ed50522a0d5ddb298a |
|
Oh, with that patch it looks like none of those libraries are linked in at all :( Anyhow, I'm not sure what's going on here, but that link does look relevant? |
|
Oh I see the problem. The |
|
Yes, but that doesn't seem to work in my patch when I tried it... but maybe I did something wrong? |
|
It looks like we don't have a fix for this today - I looked into a little more myself, but didn't figure it out. So I think we should revert the breaking PR. I'll wait a bit just in case you were about to update this PR, but otherwise will revert it. We can continue to figure out a proper fix after that. |
using the `$<TARGET_OBJECTS:objlib>` syntax. Use this variable when adding `libbinaryen` as static or shared library. Using the object files in the `add_library` command should be most portable. Additionally, use the variable with the object files to simplify the `TARGET_LINK_LIBRARIES` commands: add the object libraries to the sources of executables and drop the use of our libraries in `TARGET_LINK_LIBRARIES`. (Object libraries cannot be linked but must be used as sources. See https://cmake.org/pipermail/cmake/2018-June/067721.html)
Collect all object files from the object libraries in a CMake variable using the
$<TARGET_OBJECTS:objlib>syntax.Use this variable when adding
libbinaryenas static or shared library.Using the object files in the
add_librarycommand should be mostportable.
Additionally, use the variable with the object files to simplify the
TARGET_LINK_LIBRARIEScommands.This fixes #2471.