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

Compilation error on macosx [curses.h] #39

Closed
ttohin opened this issue May 13, 2015 · 9 comments
Closed

Compilation error on macosx [curses.h] #39

ttohin opened this issue May 13, 2015 · 9 comments

Comments

@ttohin
Copy link
Contributor

ttohin commented May 13, 2015

I'm compiling latest master (0dc3752) with flag --enable-unicode
And I have errors like this.

window.cpp:1233:2: error: use of undeclared identifier 'waddwstr'; did you mean 'waddstr'?
        waddwstr(m_window, ws);
        ^~~~~~~~
        waddstr
/usr/local/Cellar/ncurses/5.9/include/ncursesw/curses.h:771:28: note: 'waddstr' declared here

In curses.h i see next lines related to waddwstr, but they should be disabled by some defines and I don't know how to manage it.

extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *);     /* generated:WIDEC */
...
#ifndef NCURSES_NOMACROS
/*
 * XSI curses macros for XPG4 conformance.
 */
...
#define addwstr(wstr)           waddwstr(stdscr,wstr)
@arybczak
Copy link
Collaborator

What happens if you add -D_XOPEN_SOURCE=500 to your CFLAGS/CXXFLAGS?

@ttohin
Copy link
Contributor Author

ttohin commented May 14, 2015

With -D_XOPEN_SOURCE=500 I have same errors but..
I added -D_XOPEN_SOURCE_EXTENDED to CXXFLAGS and it works. I can make pull request with changes but I don't sure that is cross platform solution. Could you check it?
And second thing:
Does ncmpcpp really depends on ICU? Because I configured the project with ICU_CFLAGS=trash ICU_LIBS=trash and it works (to avoid errors because I don't have icu libraries in pkg-config).
May be we should remove the dependency?

@arybczak
Copy link
Collaborator

With -D_XOPEN_SOURCE=500 I have same errors but..
I added -D_XOPEN_SOURCE_EXTENDED to CXXFLAGS and it works. I can make pull request with changes but I don't sure that is cross platform solution. Could you check it?

That it weird, from man feature_test_macros:

_XOPEN_SOURCE_EXTENDED
              If  this  macro  is defined, and _XOPEN_SOURCE is defined, then expose
              definitions corresponding to the XPG4v2 (SUSv1) UNIX extensions  (UNIX
              95).   This  macro  is  also  implicitly  defined  if _XOPEN_SOURCE is
              defined with a value of 500 or more.

So something fishy is going on there. Also, because of the above, defining _XOPEN_SOURCE_EXTENDED explicitly is definitely not a good general way to solve it.

ncmpcpp should depend on ICU only if boost was compiled with ICU. Does configure fail if ICU is not installed?

@ttohin
Copy link
Contributor Author

ttohin commented May 14, 2015

/*
 * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
 * conflicting) when _XOPEN_SOURCE is 500 or greater.
 */
#undef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5)
#define NCURSES_WIDECHAR
#endif

It is from my /usr/local/Cellar/ncurses/5.9/include/ncursesw/curses.h. And I see "you must define _XOPEN_SOURCE_EXTENDED"

@arybczak
Copy link
Collaborator

and after the comma it says exactly what I pasted above.

@ttohin
Copy link
Contributor Author

ttohin commented May 14, 2015

Yes.

defining _XOPEN_SOURCE_EXTENDED explicitly is definitely not a good general way to solve it.

So what is the good way? I'm not familiar with this feature_test_macros_magic.

@arybczak
Copy link
Collaborator

I have no idea. I'm also not familiar with it, what I wrote is just what I found after checking out yesterday the fragment of curses.h you pasted.

You can locally define XOPEN_SOURCE_EXTENDED if for some reason it's not defined by XOPEN_SOURCE.

@ttohin
Copy link
Contributor Author

ttohin commented May 14, 2015

I managed that it happens because there is no features.h on macosx. This feature_test_macros_magic is in the header. So I'll pass XOPEN_SOURCE_EXTENDED to homebrew formula (macosx package manager). You can close the issue. Thanks.

@nijikon
Copy link

nijikon commented Jan 9, 2016

I still need to add -D_XOPEN_SOURCE_EXTENDED in order to build ncmpcpp 0.7.1 on macosx El Capitan. Is this the correct way?

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