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

Fix #140: Add compile definitions for self-contained build #141

Closed
wants to merge 1 commit into from

Conversation

irowebbn
Copy link

@irowebbn irowebbn commented Oct 24, 2023

Describe the contribution
A clear and concise description of what the contribution is.

Testing performed
Steps taken to test the contribution:

  1. make distclean; make prep; make

Expected behavior changes
A clear and concise description of how this contribution will change behavior and level of impact.

  • No behavior changes

Contributor Info - All information REQUIRED for consideration of pull request
Isaac Rowe, NASA JSC (Jacobs Technology)

@dzbaker
Copy link
Collaborator

dzbaker commented Nov 30, 2023

30 November 2023: Closing as we are not targeting elf2cfetbl being runnable outside of cFE.

@dzbaker dzbaker closed this Nov 30, 2023
@irowebbn
Copy link
Author

I don't understand this rationale. The purpose of this is not to make elf2cfetbl runnable outside of cFE, but to correctly declare dependencies. mission_build_custom.cmake is marked as an example file, but the XOPEN_SOURCE directive is required for elf2cfetbl to compile correctly. If you want all the components to have it defined for them, then I guess it could go into mission_build.cmake, but ideally each CMake target should define its own requirements.

@dzbaker
Copy link
Collaborator

dzbaker commented Dec 7, 2023

@irowebbn XOPEN_SOURCE isn't something that elf2cfetbl needs/uses, but rather something needed by the development environment/C library. These definitions are intended to go in mission_build_custom.cmake.

@irowebbn
Copy link
Author

irowebbn commented Dec 7, 2023

I'm sorry, but I still don't understand. elf2cfetbl uses ctime_r, which is only visible when setting the XOPEN_SOURCE feature test macro.

Setting the macro in mission_custom_build.cmake is problematic for 2 reasons:

  1. The *_custom_*.cmake files are meant to override default build behavior. But setting this feature test macro is necessary for the elf2cfetbl target to compile. Necessary build steps should be separated from configurable options. There's nothing indicating that some of the options in what cFE provides in sample_defs should not be changed. This was the primary reason I submitted the patch.
  2. This defines the macro for all the targets for local tools. Do all the targets need to have those symbols visible in order to compile? No, each target should be able to control the visibilities for themselves. Imagine I had a target that strictly followed the C standard but had conflicts with symbols brought in by the feature test macro. Probably a bad idea, but permitted nonetheless. I would have to use target_remove_definitions to undo what the mission_custom_build.cmake brought in.

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.

Does not build without feature test macro set externally
2 participants