znc-buildmod doesn't compile modules as c++0x #551

Closed
opened 2026-10-05 04:29:19 +02:00 by adam · 4 comments
Owner

Since the modules are not compiled with the -std=c++0x build flags or equivalent, on OS X where the default compiler won't allow c++0x unless it's explicitly enabled causes the compiler fail to parse the ZNC headers (String.h) which uses C++0x features.

I would make a PR but not sure where to being with automake/conf.

Basically, to solve this locally I popped in -std=c++0x into CXXFLAGS in znc-buildmod.

The errors

[I] $ make
Building "palaver.so" for ZNC 1.6.0... In file included from palaver.cpp:11:
In file included from /usr/local/Cellar/znc/1.6.0/include/znc/Modules.h:21:
In file included from /usr/local/Cellar/znc/1.6.0/include/znc/WebModules.h:21:
In file included from /usr/local/Cellar/znc/1.6.0/include/znc/Template.h:21:
/usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:60:6: warning: scoped enumerations are a C++11 extension
      [-Wc++11-extensions]
enum class CaseSensitivity {
     ^
/usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:85:47: error: 'CaseSensitivity' is not a class, namespace, or
      scoped enumeration
        static const CaseSensitivity CaseSensitive = CaseSensitivity::CaseSensitive;
                                                     ^
/usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:86:49: error: 'CaseSensitivity' is not a class, namespace, or
      scoped enumeration
        static const CaseSensitivity CaseInsensitive = CaseSensitivity::CaseInsensitive;

From https://github.com/cocodelabs/znc-palaver/issues/20

Since the modules are not compiled with the `-std=c++0x` build flags or equivalent, on OS X where the default compiler won't allow c++0x unless it's explicitly enabled causes the compiler fail to parse the ZNC headers (String.h) which uses C++0x features. I would make a PR but not sure where to being with automake/conf. Basically, to solve this locally I popped in `-std=c++0x` into CXXFLAGS in znc-buildmod. ### The errors ``` [I] $ make Building "palaver.so" for ZNC 1.6.0... In file included from palaver.cpp:11: In file included from /usr/local/Cellar/znc/1.6.0/include/znc/Modules.h:21: In file included from /usr/local/Cellar/znc/1.6.0/include/znc/WebModules.h:21: In file included from /usr/local/Cellar/znc/1.6.0/include/znc/Template.h:21: /usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:60:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions] enum class CaseSensitivity { ^ /usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:85:47: error: 'CaseSensitivity' is not a class, namespace, or scoped enumeration static const CaseSensitivity CaseSensitive = CaseSensitivity::CaseSensitive; ^ /usr/local/Cellar/znc/1.6.0/include/znc/ZNCString.h:86:49: error: 'CaseSensitivity' is not a class, namespace, or scoped enumeration static const CaseSensitivity CaseInsensitive = CaseSensitivity::CaseInsensitive; ``` From https://github.com/cocodelabs/znc-palaver/issues/20 <!-- github-sync-id:100183330 -->
adam closed this issue 2026-10-05 04:29:19 +02:00
Author
Owner

./configure tries to find out what is the right argument to gcc for C++11 support. It records the result in CXXFLAGS itself. In the end of configure it generates znc-buildmod from znc-buildmod.in, and puts the value of CXXFLAGS to it.

My znc-buildmod has -std=c++11 in CXXFLAGS

How did you run ./configure? Was -std=c++0x at that time in CXXFLAGS? If it was, ./configure sees that g++ $CXXFLAGS already supports C++11, and doesn't record any special flag in CXXFLAGS itself.

`./configure` tries to find out what is the right argument to gcc for C++11 support. It records the result in CXXFLAGS itself. In the end of configure it generates znc-buildmod from znc-buildmod.in, and puts the value of CXXFLAGS to it. My znc-buildmod has `-std=c++11` in `CXXFLAGS` How did you run ./configure? Was `-std=c++0x` at that time in CXXFLAGS? If it was, ./configure sees that `g++ $CXXFLAGS` already supports C++11, and doesn't record any special flag in CXXFLAGS itself. <!-- github-comment-id:129635586 -->
Author
Owner
I think https://github.com/Homebrew/homebrew/blob/33aa9a09051c1260169f2de4e23834d68478ede3/Library/Formula/znc.rb#L31 adds `-std=c++11` to CXXFLAGS before calling ./configure <!-- github-comment-id:129639696 -->
Author
Owner

Homebrew has fixed this.

Update: ENV.cxx doesn't add -std=c++11 to CXXFLAGS, but it somehow bypasses that env variable, and enables C++11 in clang anyway.

Homebrew has fixed this. Update: `ENV.cxx` doesn't add `-std=c++11` to `CXXFLAGS`, but it somehow bypasses that env variable, and enables C++11 in clang anyway. <!-- github-comment-id:130485197 -->
Author
Owner

ENV.cxx adds x to the env var HOMEBREW_CCCFG. With this, some wrapper around the compiler automatically adds std=cxx11 to every invocation of the compiler.

https://github.com/Homebrew/homebrew/blob/5596e28f3c4551a56b4b45f7875d60c08d0b6f2f/Library/Homebrew/extend/ENV/super.rb#L283-L293
https://github.com/Homebrew/homebrew/blob/33aa9a09051c1260169f2de4e23834d68478ede3/Library/ENV/4.3/cc#L314-L316 (This is the tool that messes with the compiler args and automatically adds the flag in the function in line 201)

`ENV.cxx` adds `x` to the env var `HOMEBREW_CCCFG`. With this, some wrapper around the compiler automatically adds `std=cxx11` to every invocation of the compiler. https://github.com/Homebrew/homebrew/blob/5596e28f3c4551a56b4b45f7875d60c08d0b6f2f/Library/Homebrew/extend/ENV/super.rb#L283-L293 https://github.com/Homebrew/homebrew/blob/33aa9a09051c1260169f2de4e23834d68478ede3/Library/ENV/4.3/cc#L314-L316 (This is the tool that messes with the compiler args and automatically adds the flag in the function in line 201) <!-- github-comment-id:131731885 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#551