Skip to content

[BUG] GCC/POSIX port does not compile on FreeBSD #1239

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

Closed
tymmej opened this issue Feb 6, 2025 · 3 comments
Closed

[BUG] GCC/POSIX port does not compile on FreeBSD #1239

tymmej opened this issue Feb 6, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@tymmej
Copy link
Contributor

tymmej commented Feb 6, 2025

Describe the bug
GCC/POSIX port does not compile on FreeBSD target. Using FreeRTOS 202406.1 LTS

Target

  • Development board: POSIX/GCC
  • Instruction Set Architecture: x86-64
  • IDE and version: none
  • Toolchain and version: clang13

Host

  • Host OS: FreeBSD
  • Version: 13.4

To Reproduce

  • Compile demo app on FreeBSD

Expected behavior
No errors during compilation.

Screenshots

../../mocks/freertos/port.c:261:23: error: expected expression
    hSigSetupThread = PTHREAD_ONCE_INIT;
                      ^
/usr/include/pthread.h:97:27: note: expanded from macro 'PTHREAD_ONCE_INIT'
#define PTHREAD_ONCE_INIT       { PTHREAD_NEEDS_INIT, NULL }
                                ^
1 error generated.

Additional context
To fix problem it is enough to add cast (pthread_once_t)PTHREAD_ONCE_INIT

On main version it looks like https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/ThirdParty/GCC/Posix/port.c#L307 also needs cast.

@tymmej tymmej added the bug Something isn't working label Feb 6, 2025
@kar-rahul-aws
Copy link
Member

Hi @tymmej
Thank you for reporting the issue. Would you be willing to raise a PR for the change you suggested ?

tymmej pushed a commit to tymmej/FreeRTOS-Kernel that referenced this issue Feb 6, 2025
On FreeBSD pthread_once_t is a struct and cast is required.
Otherwise there's compilation error:
../../mocks/freertos/port.c:261:23: error: expected expression
    hSigSetupThread = PTHREAD_ONCE_INIT;
                      ^
PTHREAD_ONCE_INIT is defined as: { PTHREAD_NEEDS_INIT, NULL } on FreeBSD
@tymmej
Copy link
Contributor Author

tymmej commented Feb 6, 2025

I've created #1240.

kar-rahul-aws pushed a commit that referenced this issue Feb 7, 2025
On FreeBSD pthread_once_t is a struct and cast is required.
Otherwise there's compilation error:
../../mocks/freertos/port.c:261:23: error: expected expression
    hSigSetupThread = PTHREAD_ONCE_INIT;
                      ^
PTHREAD_ONCE_INIT is defined as: { PTHREAD_NEEDS_INIT, NULL } on FreeBSD

Co-authored-by: Jakub Tymejczyk <jakub.tymejczyk@enigma.com.pl>
@kar-rahul-aws
Copy link
Member

The PR #1240 which addresses this issue has been verified and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants