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

Use of _POSIX_C_SOURCE=200809L breaks build on OpenBSD #711

Closed
brad0 opened this issue Jun 9, 2023 · 3 comments
Closed

Use of _POSIX_C_SOURCE=200809L breaks build on OpenBSD #711

brad0 opened this issue Jun 9, 2023 · 3 comments
Labels
platform specific Issue only affects a specific platform

Comments

@brad0
Copy link
Contributor

brad0 commented Jun 9, 2023

The use of _POSIX_C_SOURCE=200809L breaks the build on OpenBSD. _BSD_SOURCE needs to be defined to have the headers do the right thing with _POSIX_C_SOURCE=200809L in use.

[25/33] /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/bin/c++ -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DHAVE_BZIP2 -DHAVE_ICONV -DHAVE_INTTYPES_H -DHAVE_LZMA -DHAVE_PKCRYPT -DHAVE_STDINT_H -DHAVE_WZAES -DHAVE_ZLIB -DHAVE_ZSTD -DLZMA_API_STATIC -DZLIB_COMPAT -D_POSIX_C_SOURCE=200809L -I/home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0 -I/home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/build-amd64 -isystem /usr/local/include -O2 -pipe -DNDEBUG -MD -MT test/CMakeFiles/gtest_minizip.dir/test_main.cc.o -MF test/CMakeFiles/gtest_minizip.dir/test_main.cc.o.d -o test/CMakeFiles/gtest_minizip.dir/test_main.cc.o -c /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc
FAILED: test/CMakeFiles/gtest_minizip.dir/test_main.cc.o
/home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/bin/c++ -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DHAVE_BZIP2 -DHAVE_ICONV -DHAVE_INTTYPES_H -DHAVE_LZMA -DHAVE_PKCRYPT -DHAVE_STDINT_H -DHAVE_WZAES -DHAVE_ZLIB -DHAVE_ZSTD -DLZMA_API_STATIC -DZLIB_COMPAT -D_POSIX_C_SOURCE=200809L -I/home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0 -I/home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/build-amd64 -isystem /usr/local/include -O2 -pipe -DNDEBUG -MD -MT test/CMakeFiles/gtest_minizip.dir/test_main.cc.o -MF test/CMakeFiles/gtest_minizip.dir/test_main.cc.o.d -o test/CMakeFiles/gtest_minizip.dir/test_main.cc.o -c /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc
In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:17: error: use of undeclared identifier 'vasprintf'; did you mean 'vsprintf'?
    int __res = vasprintf(__s, __format, __va);
                ^
/usr/include/c++/v1/cstdio:124:9: note: 'vsprintf' declared here
using ::vsprintf _LIBCPP_USING_IF_EXISTS;
        ^
In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:27: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'char **'
    int __res = vasprintf(__s, __format, __va);
                          ^~~
/usr/include/stdio.h:269:21: note: passing argument to parameter here
int      vsprintf(char *, const char *, __va_list);
                        ^
2 errors generated.
ninja: build stopped: subcommand failed.
@nmoinvaz
Copy link
Member

nmoinvaz commented Jun 10, 2023

Can you submit a PR? I don't have an OpenBSD setup.

@brad0
Copy link
Contributor Author

brad0 commented Jun 10, 2023

The PR is against master or develop?

@nmoinvaz
Copy link
Member

develop. Thx!

brad0 added a commit to brad0/minizip-ng that referenced this issue Jun 11, 2023
Setting _POSIX_C_SOURCE on OpenBSD breaks the build. _BSD_SOURCE needs
to be set at the same time to enable some functions.

In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:17: error: use of undeclared identifier 'vasprintf'; did you mean 'vsprintf'?
    int __res = vasprintf(__s, __format, __va);
                ^
/usr/include/c++/v1/cstdio:124:9: note: 'vsprintf' declared here
using ::vsprintf _LIBCPP_USING_IF_EXISTS;
        ^
In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:27: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'char **'
    int __res = vasprintf(__s, __format, __va);
                          ^~~
/usr/include/stdio.h:269:21: note: passing argument to parameter here
int      vsprintf(char *, const char *, __va_list);
                        ^
2 errors generated.
@nmoinvaz nmoinvaz added the platform specific Issue only affects a specific platform label Jun 11, 2023
nmoinvaz pushed a commit that referenced this issue Jun 11, 2023
Setting _POSIX_C_SOURCE on OpenBSD breaks the build. _BSD_SOURCE needs
to be set at the same time to enable some functions.

In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:17: error: use of undeclared identifier 'vasprintf'; did you mean 'vsprintf'?
    int __res = vasprintf(__s, __format, __va);
                ^
/usr/include/c++/v1/cstdio:124:9: note: 'vsprintf' declared here
using ::vsprintf _LIBCPP_USING_IF_EXISTS;
        ^
In file included from /home/brad/tmp/ffmpeg-ports/ports/pobj/minizip-4.0.0/minizip-ng-4.0.0/test/test_main.cc:5:
In file included from /usr/local/include/gtest/gtest.h:55:
In file included from /usr/include/c++/v1/ostream:140:
In file included from /usr/include/c++/v1/locale:218:
/usr/include/c++/v1/__bsd_locale_fallbacks.h:122:27: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'char **'
    int __res = vasprintf(__s, __format, __va);
                          ^~~
/usr/include/stdio.h:269:21: note: passing argument to parameter here
int      vsprintf(char *, const char *, __va_list);
                        ^
2 errors generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform specific Issue only affects a specific platform
Projects
None yet
Development

No branches or pull requests

2 participants