Skip to content

Fix TOOLCHAIN generation for cross builds and exampleApp on GCC 8#16

Merged
mdavidsaver merged 1 commit into
mdavidsaver:masterfrom
slac-epics:pr-upstream-toolchain-fix
May 15, 2026
Merged

Fix TOOLCHAIN generation for cross builds and exampleApp on GCC 8#16
mdavidsaver merged 1 commit into
mdavidsaver:masterfrom
slac-epics:pr-upstream-toolchain-fix

Conversation

@JJL772

@JJL772 JJL772 commented May 15, 2026

Copy link
Copy Markdown
Contributor

EPICS has the strange CCC variable instead of CXX. I was getting linker errors using GCC 8.3.0 for a cross target because it was checking the libstdc++ version from my host system's compiler.

Also links the exampleApp against libstdc++fs, since that was also generating linker errors. Uses the same snippets that statApp/src/Makefile uses.

* use CCC instead of CXX
* Link against libstdc++fs as needed for the example app
Comment thread configure/Makefile

TOOLCHAIN: toolchain.cpp
$(CXX) -E $< | grep '^LINSTAT_' > $@
$(CCC) -E $< | grep '^LINSTAT_' > $@

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Right. CXX is a builtin from Make. Well spotted. It really is too bad Make does not provide a way for a Makefile to disable the builtin rules and variables.

With PVXS I used CPP, but that would expand to $(CC) -x c -E. The selection of -x c does not work here. So CCC seems the way to go.

Comment thread exampleApp/src/Makefile
Comment on lines +39 to +43
ifeq (YES,$(LINSTAT_NEED_STDCXXFS))
# see configure/toolchain.cpp
PROD_SYS_LIBS += stdc++fs
endif

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Are you having to encode this in your IOC applications?

fyi. alternatives include what PVXS does to inject a dependency on libevent. This case would be simpler since, when needed, the library is always in the system search path. Or just to replace usage of std::filesystem. It is not that difficult to iterate the contents of a directory (opendir()).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I am having to add this. the target I'm building for enables only static libraries, the issue may not be present with shared objects.

@mdavidsaver mdavidsaver merged commit bf2ba2b into mdavidsaver:master May 15, 2026
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants