Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issues on MacOS while building tools with static flag #162

Closed
nicosmd opened this issue Apr 17, 2023 · 3 comments
Closed

Build issues on MacOS while building tools with static flag #162

nicosmd opened this issue Apr 17, 2023 · 3 comments

Comments

@nicosmd
Copy link
Contributor

nicosmd commented Apr 17, 2023

Hey,

when building for MacOS M1 I get the following error: ld: library not found for -lcrt0.o while clang is trying to build the tools. I figured out that this might caused by the static flag here:

if (CMAKE_CROSSCOMPILING)
    # statically link when cross compiling so emulator doesn't need library paths
    if (MSVC)
        set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "/WHOLEARCHIVE")
    else()
        set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "-static") 
    endif()
endif()

which seems to be not supported: https://stackoverflow.com/questions/3801011/ld-library-not-found-for-lcrt0-o-on-osx-10-6-with-gcc-clang-static-flag

@foonathan
Copy link
Owner

Hm, I'm not sure what the best approach is here.

To clarify: are you cross-compiling on an M1 or cross-compiling to the M1? Can you add the appropriate logic to disable -static with that configuration?

@nicosmd
Copy link
Contributor Author

nicosmd commented Apr 24, 2023

Unfortunately, I'm not building it for my own. The issue came up while I was trying to allow cross compilation in the foonathan memory conan package: conan-io/conan-center-index#16997
I will most likely just remove the -static flag there using a patch since it is not needed to run in emulators in conan center. But that's not a feasible solution for this repo. I'm also not sure how to deal with it appropriately. But maybe it is already sufficient to add a CMake option like LINK_STATIC so it can be at least disabled from outside?

@foonathan
Copy link
Owner

Actually, I think that logic is no longer necessary.

As of #129, the node sizes are determined using compiler error messages; the tool doesn't matter anymore. So you can just remove the entire `if(). Can you do a PR?

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

No branches or pull requests

2 participants