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 the compilation of OCaml 5 programs on Cygwin #11009

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

kit-ty-kate
Copy link
Member

Functions like strdup are not part of the C standard library but is part of POSIX. By default GCC and Clang both use the GNU variant of the C standard, so we are using strdup here to ensure users have access to it by default. If -std=c++11 is used instead of -std=gnu++11 this would fail to compile on non-POSIX platforms such as Cygwin.

This fixes an oversight from #10962

strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
@rgrinberg rgrinberg merged commit 4cb8c41 into ocaml:main Oct 10, 2024
27 checks passed
@maiste maiste mentioned this pull request Oct 29, 2024
9 tasks
maiste pushed a commit to maiste/dune that referenced this pull request Oct 29, 2024
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
maiste pushed a commit to maiste/dune that referenced this pull request Oct 29, 2024
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
maiste pushed a commit to maiste/dune that referenced this pull request Oct 29, 2024
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
maiste pushed a commit to maiste/dune that referenced this pull request Oct 29, 2024
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
maiste added a commit that referenced this pull request Oct 30, 2024
* Call the C++ compiler with -std=c++11 when using OCaml >= 5.0 (#10962)
* Call the C++ compiler with -std=c++11 when using OCaml >= 5.0
* Fix the compilation of OCaml 5 programs on Cygwin (#11009)
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.
* test: backport missing test file
---------
Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Kate <[email protected]>
Co-authored-by: Kate <[email protected]>
Co-authored-by: Kate <[email protected]>
anmonteiro pushed a commit to anmonteiro/dune that referenced this pull request Nov 17, 2024
strdup is not part of the C standard library but is part of POSIX.
By default GCC and Clang both use the GNU variant of the C standard,
so we are using strdup here to ensure users have access to it by default.
If -std=c++11 is used instead of -std=gnu++11 this would fail to compile
on non-POSIX platforms such as Cygwin.

Signed-off-by: Kate <[email protected]>
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