-
Notifications
You must be signed in to change notification settings - Fork 217
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
"duplicate symbol '_main'" on macOS when building tests #363
Comments
@jphickey are your BSP updates addressing this? |
See #384 (comment), may be related and has a short-term potential fix. |
@jphickey your clean-up likely fixes this? If so self-assign? |
Likely solved by #404, @stanislaw could you confirm if it resolves your issue? |
Thanks for getting back to this. #404 is a big changeset so I am not sure if I can follow the exact vector of change but did it remove either of the main functions from the linkage? I have rebased my branch in #352 and I can confirm that I see the issue like is described in the description of this issue:
I have double-check the changes in my branch and I see nothing in my changes that would additionally contribute to this issue. This is what my commit is now built on top of:
Hope this helps. |
In particular the changes that are relevant here are for issues #261 and #312. In your case, it looks like you were linking with both the OSAL BSP (bsp_start.c) as well as the UT BSP (bsp_ut.c). In short, there was a thing (call it a hack) in the OSAL build that caused it to NOT build the OSAL BSP if you were building with CFE (because the PSP duplicated this), but that hack doesn't get invoked if you build OSAL standalone, which became apparent if unit tests were enabled because now you have a duplicate symbol. This is all reworked in the pull #404. |
@jphickey it's been a while since I last time worked on my macos branch here so I didn't realize you are still integrating those changes in #404 and therefore they are not merged yet into the master branch. I have just tried to rebase my branch on top of your |
I did just confirm on linux the issue was solved. It showed up on there if CFE_SYSTEM_PSPNAME wasn't defined: |
I have rebased my macOS branch on top of the It is great to hear that #403 is being prepared. When both #403 and #404 are merged I would be happy to rebase my branch again and confirm this issue has gone on macOS. |
Closed by #404 |
Is your feature request related to a problem? Please describe.
This is one of the issues addressed by #352. I am extracting it hereby to be considered separately from the rest of my work of macOS port.
I am getting linker errors on macOS because the test targets link in
libosal
library that has amain()
function and they linklibut_bsp.a
which has amain()
that launches tests. This causes a conflict with these test target' own main() function as follows:Describe the solution you'd like
Usually the cases like this resolved by extracting the main function from one of the conflicting libraries. In this case it could make sense to extract the
main
function fromlibosal
to a separate library such aslibosal-init
orlibosal-main
to avoid any conflicts with test targets. That separate library would then not be linked to the tests and the conflict would go away.Describe alternatives you've considered
There seems to be no alternative to this behavior on macOS. You either have one
main()
function or there is a conflict.Additional context
This is a more complete fragment of the output:
Requester Info
Stanislav Pankevich
The text was updated successfully, but these errors were encountered: