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

Does not compile on macOS Ventura #13

Open
Trinity503 opened this issue Feb 1, 2023 · 10 comments
Open

Does not compile on macOS Ventura #13

Trinity503 opened this issue Feb 1, 2023 · 10 comments

Comments

@Trinity503
Copy link

Trinity503 commented Feb 1, 2023

Im sorry, but I cannot compile dvbcut on macOS Ventura.
autoconf -> no errors
./configure -> not errors
make -> /opt/local/libexec/qt5/lib/QtCore.framework/Headers/qcompilerdetection.h:590:6: error: Qt requires a C++11 compiler and yours does not seem to be that.

With macports I can install dvbcut without problems. Can you tell me, what I am doing wrong?

UPDATE: Ok, i figured out what went wrong: In the Makefile in the src directory I had to change the line:
CXX=g++
to
CXX=clang++ -std=c++14 -stdlib=libc++

After that, everything went fine and dvbcut is compiling. Can you change the way this Makefile is generated on macos? I am not a programmer, unfortunately.

Thanks for keeping dvbcut alive!!!!

@bernhardu
Copy link
Owner

Is configure detecting your Qt directories by itself, or do you tell it via an parametet? Can you provide the full command line to configure?

@thp
Copy link
Contributor

thp commented Feb 6, 2023

What's the output of g++ --version on your machine, could it be some custom version installed via MacPorts? I get the following on Ventura (no MacPorts, no custom GCC install):

$ g++ --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Maybe this is enough to get it working on your machine? (assuming clang and clang++ are the Xcode/macOS compilers in your $PATH).

./configure CC=clang CXX=clang++

@Trinity503
Copy link
Author

Trinity503 commented Feb 6, 2023

Is configure detecting your Qt directories by itself, or do you tell it via an parametet? Can you provide the full command line to configure?

`erhardma@MacBook-Pro-von-Markus dvbcut-deb-master % autoconf

erhardma@MacBook-Pro-von-Markus dvbcut-deb-master % ./configure

checking build system type... x86_64-apple-darwin22.2.0
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for strip... strip
checking for pkg-config... pkg-config
checking for main in -lswscale... yes
checking for mad_decoder_init in -lmad... yes
checking for a52_init in -la52... yes
checking for ao_initialize in -lao... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/param.h... yes
checking for ao/ao.h... yes
checking for mad.h... yes
checking for stdint.h... (cached) yes
checking for a52dec/a52.h... yes
checking for an ANSI C-conforming const... yes
checking for off_t... yes
checking for size_t... yes
checking host system type... x86_64-apple-darwin22.2.0
checking for getpagesize... yes
checking for working mmap... yes
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for Qt5Core >= 5.3 Qt5Gui >= 5.3 Qt5Xml >= 5.3 Qt5Widgets >= 5.3... yes
checking for moc-qt5... no
checking for moc... moc
checking for uic-qt5... no
checking for uic... uic
checking for rcc-qt5... no
checking for rcc... rcc
checking for lrelease-qt5... no
checking for lrelease... lrelease
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating dvbcut.desktop
`

@Trinity503
Copy link
Author

Trinity503 commented Feb 6, 2023

g++ --version

erhardma@MacBook-Pro-von-Markus dvbcut-deb-master % g++ --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I do not have Xcode installed. Perhaps that is the reason. And "target" is different than yours.

@Trinity503
Copy link
Author

./configure CC=clang CXX=clang++ make

This gives me the same error:
/opt/local/libexec/qt5/lib/QtCore.framework/Headers/qcompilerdetection.h:590:6: error: Qt requires a C++11 compiler and yours does not seem to be that.

@thp
Copy link
Contributor

thp commented Feb 6, 2023

Post the config.log that it generates.

@Trinity503
Copy link
Author

Post the config.log that it generates.

config.log

@thp
Copy link
Contributor

thp commented Feb 7, 2023

The relevant part of the log:

configure:4131: checking for g++ option to enable C++11 features
configure:4146: g++  -c -g -O2  conftest.cpp >&5
conftest.cpp:55:3: error: "Compiler does not advertise C++11 conformance"
# error "Compiler does not advertise C++11 conformance"
  ^
conftest.cpp:60:3: error: unknown type name 'constexpr'
  constexpr int get_val() { return 20; }
  ^
conftest.cpp:72:17: error: delegating constructors are permitted only in C++11
    delegate(): delegate(2354) {}
                ^~~~~~~~
conftest.cpp:83:26: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
    virtual int getval() override final { return this->n * 2; }
                         ^
conftest.cpp:83:35: warning: 'final' keyword is a C++11 extension [-Wc++11-extensions]
    virtual int getval() override final { return this->n * 2; }
                                  ^
conftest.cpp:90:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
    nocopy() = default;
               ^
conftest.cpp:91:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    nocopy(const nocopy&) = delete;
                            ^
conftest.cpp:92:41: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    nocopy & operator=(const nocopy&) = delete;
                                        ^
conftest.cpp:104:25: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  template <typename V> auto sum(V first) -> V
                        ^
conftest.cpp:104:25: error: 'auto' not allowed in function return type
  template <typename V> auto sum(V first) -> V
                        ^~~~
conftest.cpp:104:42: error: expected ';' at end of declaration
  template <typename V> auto sum(V first) -> V
                                         ^
                                         ;
conftest.cpp:104:43: error: cannot use arrow operator on a type
  template <typename V> auto sum(V first) -> V
                                          ^
conftest.cpp:108:33: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
  template <typename V, typename... Args> auto sum(V first, Args... rest) -> V
                                ^
conftest.cpp:108:43: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  template <typename V, typename... Args> auto sum(V first, Args... rest) -> V
                                          ^
conftest.cpp:108:43: error: 'auto' not allowed in function return type
  template <typename V, typename... Args> auto sum(V first, Args... rest) -> V
                                          ^~~~
conftest.cpp:108:74: error: expected ';' at end of declaration
  template <typename V, typename... Args> auto sum(V first, Args... rest) -> V
                                                                         ^
                                                                         ;
conftest.cpp:108:75: error: cannot use arrow operator on a type
  template <typename V, typename... Args> auto sum(V first, Args... rest) -> V
                                                                          ^
conftest.cpp:132:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto a1 = 6538;
  ^
conftest.cpp:133:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto a2 = 48573953.4;
  ^
conftest.cpp:134:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto a3 = "String literal";
  ^
conftest.cpp:137:8: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  for (auto i = a3; *i; ++i) { total += *i; }
       ^
conftest.cpp:153:8: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  for (auto &x : array) { x += 23; }
       ^
conftest.cpp:153:16: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
  for (auto &x : array) { x += 23; }
               ^
conftest.cpp:158:17: error: expected expression
  assert (eval ([](int x) { return x*2; }, 21) == 42);
                ^
conftest.cpp:160:17: error: expected expression
  assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0);
                ^
conftest.cpp:162:17: error: expected expression
  assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0);
                ^
conftest.cpp:168:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto a = sum(1);
  ^
conftest.cpp:168:12: error: no matching function for call to 'sum'
  auto a = sum(1);
           ^~~
conftest.cpp:169:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto b = sum(1, 2);
  ^
conftest.cpp:169:12: error: no matching function for call to 'sum'
  auto b = sum(1, 2);
           ^~~
conftest.cpp:170:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  auto c = sum(1.0, 2.0, 3.0);
  ^
conftest.cpp:170:12: error: no matching function for call to 'sum'
  auto c = sum(1.0, 2.0, 3.0);
           ^~~
conftest.cpp:175:25: warning: empty parentheses interpreted as a function declaration [-Wvexing-parse]
  cxx11test::delegate d2();
                        ^~
conftest.cpp:175:25: note: remove parentheses to declare a variable
  cxx11test::delegate d2();
                        ^~
conftest.cpp:188:16: error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?
  test_template<::test_template<int>> v(test_template<int>(12));
               ^~~
               < ::
conftest.cpp:188:36: error: a space is required between consecutive right angle brackets (use '> >')
  test_template<::test_template<int>> v(test_template<int>(12));
                                   ^~
                                   > >
conftest.cpp:192:22: error: use of undeclared identifier 'u8'
  char const *utf8 = u8"UTF-8 string \u2500";
                     ^
conftest.cpp:192:24: error: expected ';' at end of declaration
  char const *utf8 = u8"UTF-8 string \u2500";
                       ^
                       ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]

One easy way to work around might be to just set CXXFLAGS=-std=c++14 (like you had above, but CXXFLAGS instead of part of CXX).

Since you run autoconf to generate the configure script, what versions of autoconf, automake, etc.. do you have installed? Maybe updating those helps? What about running autoreconf with varying options?

@Trinity503
Copy link
Author

autoconf (Version 2.71) and automake (1.16.5) seem up to date

Running
./configure CXXFLAGS=-std=c++14
solved the problem! Great! Thank you!

Would it be a problem for other build environments if this would be a standard flag?

@thp
Copy link
Contributor

thp commented Feb 10, 2023

There are some suggestions how to deal with this here: https://stackoverflow.com/a/7995922/1047040

It seems like clang as shipped by Apple doesn't expose C++11 (or C++14) support by default unless explicitly requested.

So at least documenting it or just adding -std=c++14 unconditionally in one of the build files could do the trick. The flag should work fine for both clang and gcc.

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

No branches or pull requests

3 participants