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: add POSIX functionality for Linux compilation #51

Merged
merged 2 commits into from Mar 22, 2023

Conversation

valentynbez
Copy link
Contributor

@valentynbez valentynbez commented Mar 12, 2023

Small fix to compile binaries properly on Linux:

@prusnak
Copy link
Sponsor Collaborator

prusnak commented Mar 12, 2023

Can you add a short comment why this is required? (I assume some functions are not recognized but not obvious which ones)

@valentynbez
Copy link
Contributor Author

Sure!

@prusnak
Copy link
Sponsor Collaborator

prusnak commented Mar 12, 2023

Sure!

I meant into the source code just above the #define

Btw the issue #54 mentions _POSIX_C_SOURCE=199309L; why did you chose newer standard and thus less compatibility?

@prusnak
Copy link
Sponsor Collaborator

prusnak commented Mar 13, 2023

Small fix to compile binaries properly on Linux:

Which OS and which GCC version do you use?

For me the master compiles just fine on Debian 11 with GCC 10.2.1 (even without the proposed define).

@valentynbez
Copy link
Contributor Author

CentOS7 with GCC 10.2.0

@ggerganov
Copy link
Owner

This flags has been discussed in whisper.cpp too and I still don't know when it should be added and when not.
Hopefully someone can clarify.

ggerganov/whisper.cpp#37
ggerganov/whisper.cpp#576

@ggerganov ggerganov added the help wanted Extra attention is needed label Mar 14, 2023
@prusnak
Copy link
Sponsor Collaborator

prusnak commented Mar 18, 2023

Now thinking more about this, probably the cleanest option is to add compilation flags to the build system like suggested in ggerganov/whisper.cpp#37 + ggerganov/whisper.cpp#576

CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE

We can probably set this for all compilers on all OSes, because either a compiler understands the flag and sets the value to the supported level or the flag is ignored.

@valentynbez can you confirm this fixed the issue for you on CentOS 7?

@gjmulder gjmulder added the build Compilation issues label Mar 20, 2023
@ggerganov ggerganov merged commit 9794052 into ggerganov:master Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Compilation issues help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error: 'CLOCK_MONOTONIC' undeclared
4 participants