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

Library tinfow required in Linking #11

Closed
AtjonTV opened this issue Sep 5, 2020 · 3 comments
Closed

Library tinfow required in Linking #11

AtjonTV opened this issue Sep 5, 2020 · 3 comments

Comments

@AtjonTV
Copy link

AtjonTV commented Sep 5, 2020

I was looking around to find a TUI library for C++, and I ended up here. I was trying this fork of tvision out yesterday and I noticed that all applications would segfault after compilation.

After debugging I found out that I need to link tinfow after ncursesw for it to work.

So with

if (TV_PLATF EQUAL TV_PLATF_UNIX)
    find_library(NCURSESW ncursesw REQUIRED)
    if (NCURSESW)
-        list(APPEND LIBS ${NCURSESW})
+        list(APPEND LIBS ${NCURSESW} tinfow)
        target_compile_definitions(tvision PRIVATE HAVE_NCURSES)
    endif()
    # Optional dependencies
    find_library(GPM gpm)
    if (GPM)
        list(APPEND LIBS ${GPM})
        target_compile_definitions(tvision PRIVATE HAVE_GPM)
    endif()
endif()

(This was also for the GPL fork of tvision, they have the same issue)

I am on Gentoo Linux with ncurses 6.2-r1 and gcc 9.3.0.

I would suggest checking if tinfow is available and linking it when it and ncursesw do.

Please note that tinfow is required. It will NOT work with tinfo!

Info for Gentoo Uses: tinfo and tinfow are installed when the tinfo use flag is set on ncruses.

@magiblot
Copy link
Owner

magiblot commented Sep 5, 2020

Hi Atjon, thanks for finding out!

From what I can see, in many Linux systems there is no tinfow, just tinfo. So tinfow should be only linked when available.

Can you check if the following works for you?

if (TV_PLATF EQUAL TV_PLATF_UNIX)
    find_library(NCURSESW ncursesw REQUIRED)
    if (NCURSESW)
        list(APPEND LIBS ${NCURSESW})
        target_compile_definitions(tvision PRIVATE HAVE_NCURSES)
+       find_library(TINFOW tinfow)
+       if (TINFOW)
+           list(APPEND LIBS ${TINFOW})
+       endif()
    endif()
    # Optional dependencies
    find_library(GPM gpm)
    if (GPM)
        list(APPEND LIBS ${GPM})
        target_compile_definitions(tvision PRIVATE HAVE_GPM)
    endif()
endif()

Cheers.

magiblot added a commit that referenced this issue Sep 5, 2020
The 'if (NCURSESW)' has been removed because ncurses is already compulsory. The REQUIRED option of find_library is not available in older CMake versions, so the only way to trigger an error is to dereference NCURSESW unconditionally.

tinfow has to be linked in systems where both tinfo and tinfow are available. See #11.
@magiblot
Copy link
Owner

magiblot commented Sep 5, 2020

Alternatively, just upgrade to the latest commit and try again.

@AtjonTV
Copy link
Author

AtjonTV commented Sep 5, 2020

Jap, its working. Thanks!

@AtjonTV AtjonTV closed this as completed Sep 5, 2020
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

2 participants