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

media split broke ncdirect #1300

Closed
dankamongmen opened this issue Jan 18, 2021 · 10 comments
Closed

media split broke ncdirect #1300

dankamongmen opened this issue Jan 18, 2021 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dankamongmen
Copy link
Owner

Somewhere in the course of #339, it appears that we broke ncdirect's capability to play media. ncls is broken; ncneofetch shows no image, zorn, alas.

@dankamongmen dankamongmen added the bug Something isn't working label Jan 18, 2021
@dankamongmen dankamongmen added this to the 2.2.0 milestone Jan 18, 2021
@dankamongmen dankamongmen self-assigned this Jan 18, 2021
@dankamongmen
Copy link
Owner Author

The relevant PR is #1297.

@dankamongmen
Copy link
Owner Author

I think what's going on here is that we're fouling up the linking. there's no libav in ncls or ncneofetch, which aren't showing images, but there is libav in notcurses-demo and ncplayer, which are:

[schwarzgerat](0) $ ldd ncneofetch | grep libav
[schwarzgerat](1) $ ldd ncls | grep libav
[schwarzgerat](1) $ ldd ncplayer | grep libav
	libavcodec.so.58 => /usr/lib/x86_64-linux-gnu/libavcodec.so.58 (0x00007f2f8c204000)
	libavformat.so.58 => /usr/lib/x86_64-linux-gnu/libavformat.so.58 (0x00007f2f8bf86000)
	libavutil.so.56 => /usr/lib/x86_64-linux-gnu/libavutil.so.56 (0x00007f2f8bc2c000)
[schwarzgerat](0) $ ldd notcurses-demo | grep libav
	libavcodec.so.58 => /usr/lib/x86_64-linux-gnu/libavcodec.so.58 (0x00007f231c21c000)
	libavformat.so.58 => /usr/lib/x86_64-linux-gnu/libavformat.so.58 (0x00007f231bf9e000)
	libavutil.so.56 => /usr/lib/x86_64-linux-gnu/libavutil.so.56 (0x00007f231bc44000)
[schwarzgerat](0) $ 

@dankamongmen
Copy link
Owner Author

It looks like this comes down to libnotcurses++.so not having libnotcurses.so in its linkage (nor av):

[schwarzgerat](0) $ ldd libnotcurses++.so
	linux-vdso.so.1 (0x00007ffe88540000)
	libnotcurses-core.so.2 => /home/dank/src/dankamongmen/notcurses/build/libnotcurses-core.so.2 (0x00007f9f66c78000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9f66a63000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9f66a49000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9f66884000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f9f66855000)
	libreadline.so.8 => /lib/x86_64-linux-gnu/libreadline.so.8 (0x00007f9f667fc000)
	libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f9f6667a000)
	libqrcodegen.so.1 => /usr/lib/x86_64-linux-gnu/libqrcodegen.so.1 (0x00007f9f66672000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9f66650000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9f6650c000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9f66cc2000)
[schwarzgerat](0) $ 

ncls uses libnotcurses++. ncneofetch does not, though, and likewise shows neither libnotcurses nor libav:

[schwarzgerat](0) $ ldd ncneofetch 
	linux-vdso.so.1 (0x00007fff9c343000)
	libnotcurses-core.so.2 => /home/dank/src/dankamongmen/notcurses/build/libnotcurses-core.so.2 (0x00007f863db3b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f863dad1000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f863d90c000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f863d8dd000)
	libreadline.so.8 => /lib/x86_64-linux-gnu/libreadline.so.8 (0x00007f863d886000)
	libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f863d704000)
	libqrcodegen.so.1 => /usr/lib/x86_64-linux-gnu/libqrcodegen.so.1 (0x00007f863d6fa000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f863d52d000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f863d3e9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f863dba7000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f863d3cf000)
[schwarzgerat](0) $ 

@dankamongmen
Copy link
Owner Author

This despite:

/usr/bin/cc -O2 -g -DNDEBUG CMakeFiles/ncneofetch.dir/src/fetch/main.c.o CMakeFiles/ncneofetch.dir/src/fetch/ncart.c.o -o ncneofetch  -Wl,-rpath,/home/dank/src/dankamongmen/notcurses/build: libnotcurses.so libnotcurses-core.so.2.1.5 -lpthread -lavcodec -lavformat -lswscale -lavutil 

@dankamongmen
Copy link
Owner Author

The point of failure in both is of course ncvisual_from_file().

@dankamongmen
Copy link
Owner Author

working ncplayer is linked thusly:

/usr/bin/cmake -E cmake_link_script CMakeFiles/ncplayer.dir/link.txt --verbose=1
/usr/bin/c++ -O2 -g -DNDEBUG CMakeFiles/ncplayer.dir/src/view/view.cpp.o CMakeFiles/ncplayer.dir/src/compat/compat.c.o -o ncplayer  -Wl,-rpath,/home/dank/src/dankamongmen/notcurses/build: libnotcurses++.so.2.1.5 libnotcurses.so libnotcurses-core.so.2.1.5 -lpthread -lavcodec -lavformat -lswscale -lavutil 

non-working ncls is linked:

/usr/bin/cmake -E cmake_link_script CMakeFiles/ncls.dir/link.txt --verbose=1
/usr/bin/c++ -O2 -g -DNDEBUG CMakeFiles/ncls.dir/src/ls/main.cpp.o -o ncls  -Wl,-rpath,/home/dank/src/dankamongmen/notcurses/build: libnotcurses++.so.2.1.5 libnotcurses.so libnotcurses-core.so.2.1.5 -lpthread -lavcodec -lavformat -lswscale -lavutil 

everything's the same except ncplayer includes compat.o. Argh!

@dankamongmen
Copy link
Owner Author

Nope, adding compat.o doesn't change anything (as expected).....

@dankamongmen
Copy link
Owner Author

-Wl,-no-as-needed fixes this up. can we embed that into pkg-config?

@dankamongmen
Copy link
Owner Author

Setting CMAKE_LINK_WHAT_YOU_USE to ON has resolved this problem, but I don't consider this a great fix by any means. I don't think it will propagate to other users of Notcurses, and it results in our binaries linking unnecessary materials. Maybe #1301 will give us a better solution?

@dankamongmen
Copy link
Owner Author

I'm thinking that ncls and ncneofetch both use only ncdirect_render_image(), and they're the two that don't get libnotcurses.so linked in. Even humble notcurses-input gets it. Strange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant