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: Port micromamba-feedstock flags in micromamba's CMakeLists.txt #3547

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions micromamba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ find_package(Threads REQUIRED)
find_package(reproc REQUIRED)
find_package(reproc++ REQUIRED)

# Conda's binary relocation can result in string changing which can result in errors like:
#
# "warning: command substitution: ignored null byte in input"
#
# See: https://github.com/mamba-org/mamba/issues/1517
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-merge-constants")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-merge-constants")

if(APPLE)
# Needed for cross-compilation See:
# https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY=1")

# Dependency of libcurl-static missing in CMakeLists.txt
set(
frameworks_flags
"-framework CoreFoundation -framework CoreServices -framework Security -framework Kerberos"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${frameworks_flags}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${frameworks_flags}")
endif()

Copy link

@anutosh491 anutosh491 Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait shouldn't this be propagated from libmamba/CMakeLists.txt itself ?
We technically need these flags to have a clean build for libmamba.a (first followed by micromamba)
So I would still end up with.

[ 86%] Linking CXX static library libmamba.a
Error running link command: name too longmake[2]: *** [libmamba/libmamba.a] Error 2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to scope them for libmamba.a, indeed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you continue this PR and iterate on a solution?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW you should prefer target_compile_options to global cmake flags. By setting them as public on the target libmamba, they will automagically propagate to the target linking with libmamba.

macro(mambaexe_create_target target_name linkage output_name)
string(TOUPPER "${linkage}" linkage_upper)
if(NOT ${linkage_upper} MATCHES "^(SHARED|STATIC)$")
Expand Down
Loading