Skip to content
Merged
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
15 changes: 9 additions & 6 deletions make/compiler_flags
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ else
TBB_LIBRARIES ?= tbb
endif

# --disable-new-dtags only matters alongside -rpath, which Windows skips
# below; MacOS ld does not support it
ifneq ($(OS), Windows_NT)
ifneq ($(OS),Darwin)
LDFLAGS_TBB_DTAGS ?= -Wl,--disable-new-dtags
endif
endif

ifdef TBB_LIB

ifdef TBB_INC
Expand All @@ -299,11 +307,6 @@ endif
# Windows LLVM/Clang does not support -rpath, but is not needed on Windows anyway
ifneq ($(OS), Windows_NT)
LDFLAGS_TBB_RPATH ?= -Wl,-rpath,"$(TBB_LIB)"
# --disable-new-dtags only matters alongside -rpath; MacOS ld does not
# support it
ifneq ($(OS),Darwin)
LDFLAGS_TBB_DTAGS ?= -Wl,--disable-new-dtags
endif
endif

LDFLAGS_TBB ?= -Wl,-L,"$(TBB_LIB)" $(LDFLAGS_TBB_DTAGS) $(LDFLAGS_TBB_RPATH)
Expand All @@ -329,7 +332,7 @@ LDFLAGS_TBB ?= -Wl,-L,"$(TBB_BIN_ABSOLUTE_PATH)" $(LDFLAGS_FLTO_FLTO) $(LDFLAGS_

# Windows LLVM/Clang does not support -rpath, but is not needed on Windows anyway
ifneq ($(OS), Windows_NT)
LDFLAGS_TBB += -Wl,-rpath,"$(TBB_BIN_ABSOLUTE_PATH)"
LDFLAGS_TBB += $(LDFLAGS_TBB_DTAGS) -Wl,-rpath,"$(TBB_BIN_ABSOLUTE_PATH)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems redundant with line 309?

@jgabry jgabry Oct 14, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so (although I could be wrong). Line 309 is the case where a user points TBB_LIB at their own TBB, and it already included --disable-new-dtags. Line 335 is for the TBB in lib/tbb that CmdStan builds, which had -rpath without it. So this line is actually the fix, the rest of the diff is just because I moved the LDFLAGS_TBB_DTAGS definition above the ifdef so both cases can use it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah I see. These makefiles are really a mess that I think could be cleaned up significantly if only ever defined LDFLAGS_TBB in one place and just set the constituent parts conditionally, that way we wouldn’t have to totally duplicate the work in the case of a custom TBB location

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Definitely a mess. Do you want that before this fix or can this one go in before the makefile cleanup?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can try to clean it up after this and #3426

endif
LDLIBS_TBB ?= -ltbb

Expand Down
Loading