bas-t / ffdecsawrapper

FFdecsa empowered softcam for MythTV
GNU General Public License v3.0
17 stars 9 forks source link

plugin_showioctl.c build errors with ArchLinux (since 2/2017) and Ubuntu 18.04 #53

Closed wdirksen closed 6 years ago

wdirksen commented 6 years ago

Hi Tycho (or anyone in the know)

Trying to get ffdecsawrapper working with Intel Coffeelake which requires 4.15 using tbddtv open source drivers. Issue reproducible with gcc 6 and 7. Builds good on Debian 9 on the standard 4.9 and 4.15 kernels but later errors with dvbloopback during runtime so now looking at Ubuntu which give same build error as Arch has had for a long time. Maybe this is not a hard fix for those who know.

(I just tried to remove showioctl from makefile to see if it is an isolated problem with that plugin but it is not. It will eventually fall with a number of these 'sc' plugins so there is a lot wrong here)

If this can't be fixed easily, it would be nice to know what is actually causing this so I know what to avoid. Next I just might try to 'necrofit' of the newer intel video modules from 4.15 into Debian 4.9

g++ -Wall -D__user=  -o objs/plugin_showioctl.o -c  -DRELEASE_VERSION=\"\" -D__KERNEL_STRICT_NAMES -Idvbloopback/src -Idvbloopback/module dvbloopback/src/plugin_showioctl.c
dvbloopback/src/plugin_showioctl.c: In function ‘void demux_ioctl(parser_cmds*, poll_ll*, cmdret_t*, int*, long unsigned int, unsigned char*)’:
dvbloopback/src/plugin_showioctl.c:252:34: error: ‘DMX_KERNEL_CLIENT’ was not declared in this scope
                    (dmx->flags & DMX_KERNEL_CLIENT ? " KERNEL_CLIENT" : ""));
                                  ^~~~~~~~~~~~~~~~~
dvbloopback/src/plugin_showioctl.c:303:34: error: ‘DMX_KERNEL_CLIENT’ was not declared in this scope
                    (dmx->flags & DMX_KERNEL_CLIENT ? " KERNEL_CLIENT" : ""));
                                  ^~~~~~~~~~~~~~~~~
dvbloopback/src/plugin_showioctl.c:327:12: error: ‘DMX_GET_CAPS’ was not declared in this scope
       case DMX_GET_CAPS:
            ^~~~~~~~~~~~
dvbloopback/src/plugin_showioctl.c:327:12: note: suggested alternative: ‘DMX_OUT_TAP’
       case DMX_GET_CAPS:
            ^~~~~~~~~~~~
            DMX_OUT_TAP
dvbloopback/src/plugin_showioctl.c:330:70: error: invalid use of incomplete type ‘struct demux_ioctl(parser_cmds*, poll_ll*, cmdret_t*, int*, long unsigned int, unsigned char*)::dmx_caps’
           tmprintf("","DMX_GET_CAPS(%d): %u num:%d\n", fdptr->fd, dmx->caps,
                                                                      ^~
dvbloopback/src/plugin_showioctl.c:329:18: note: forward declaration of ‘struct demux_ioctl(parser_cmds*, poll_ll*, cmdret_t*, int*, long unsigned int, unsigned char*)::dmx_caps’
           struct dmx_caps *dmx = (struct dmx_caps*)data;
                  ^~~~~~~~
dvbloopback/src/plugin_showioctl.c:331:21: error: invalid use of incomplete type ‘struct demux_ioctl(parser_cmds*, poll_ll*, cmdret_t*, int*, long unsigned int, unsigned char*)::dmx_caps’
                  dmx->num_decoders);
                     ^~
dvbloopback/src/plugin_showioctl.c:329:18: note: forward declaration of ‘struct demux_ioctl(parser_cmds*, poll_ll*, cmdret_t*, int*, long unsigned int, unsigned char*)::dmx_caps’
           struct dmx_caps *dmx = (struct dmx_caps*)data;
                  ^~~~~~~~
dvbloopback/src/plugin_showioctl.c:334:12: error: ‘DMX_SET_SOURCE’ was not declared in this scope
       case DMX_SET_SOURCE:
            ^~~~~~~~~~~~~~
dvbloopback/src/plugin_showioctl.c:334:12: note: suggested alternative: ‘_XOPEN_SOURCE’
       case DMX_SET_SOURCE:
            ^~~~~~~~~~~~~~
            _XOPEN_SOURCE
Makefile:70: recipe for target 'objs/plugin_showioctl.o' failed
make: *** [objs/plugin_showioctl.o] Error 1
bas-t commented 6 years ago

Hi Wessel,

I got a couple of those errors trying to rebuild lirc on debian buster and ubuntu 18.04 They were gcc c++ version related and easy to fix. I'm out of spare time right now, but I will look into this matter asap.

bas-t commented 6 years ago

BTW, debian 9 (stretch) comes with linux 4.9 and 4.15 in backports. Don't know where your 3.x versions originated.

wdirksen commented 6 years ago

Good news and thanks for the time you have. I edited the reference to '3.15' above. Stupid typo I meant 4.9 and 4.15 off course. What is interesting that everything builds fine on Debian with 4.15 kernel out of stretch backports together with the gcc6 upgrade dependency but it has run time errors. I have not tried using gcc7 with Debian (only Arch and Ubuntu 18.04) which is also available in Debian somewhere, backports or sid. This will likely also have to update glibc which I'm wondering is related to the build error.

wdirksen commented 6 years ago

Some good news, albeit preliminary. I built ffdecsawrapper with gcc-7 from Sid on kernel 4.15 without errors. However now for the first time on this new machine dmesg is looking proper without errors with loopback running with the 6985. I won't get the chance to test if it actually tunes until later but looking good so far...

bas-t commented 6 years ago

Nice, i planned to do massive research whenever I have enough time, but mayby I don"t need to do that.

wdirksen commented 6 years ago

Alas, too good to be true...

As always on this machine up to now, no firmware is being picked up and fail. Although it did build in this scenario, failure at the dvblb-ioctl plugin afterall. Gee I'm wondering if I'm screwed with this 'too new' system. Thanks Tycho whatever comes of this

[  174.082307] BUG: unable to handle kernel paging request at 00007f6da6ffc010
[  174.082313] IP: dvblb_ioctl+0x453/0x660 [dvbloopback]
[  174.082314] PGD 800000046ff70067 P4D 800000046ff70067 PUD 46fee2067 PMD 46fedd067 PTE 800000046a3e6867
[  174.082317] Oops: 0001 [#1] SMP PTI
[  174.082319] Modules linked in: dvbloopback(O) cpufreq_userspace cpufreq_powersave cpufreq_conservative snd_hda_codec_hdmi snd_hda_codec_realtek av201x(O) snd_hda_codec_generic saa716x_tbs_dvb(O) intel_rapl cx24117(O) x86_pkg_temp_thermal intel_powerclamp tas2101(O) coretemp saa716x_core(O) snd_hda_intel i2c_mux snd_hda_codec kvm_intel dvb_core(O) snd_hda_core nls_ascii snd_hwdep videobuf2_vmalloc(O) kvm nls_cp437 irqbypass crct10dif_pclmul crc32_pclmul snd_pcm ghash_clmulni_intel videobuf2_memops(O) snd_timer vfat i915 videobuf2_common(O) intel_cstate snd fat drm_kms_helper videodev(O) efi_pstore wmi_bmof evdev joydev intel_uncore media(O) soundcore intel_rapl_perf drm efivars pcspkr iTCO_wdt iTCO_vendor_support i2c_algo_bit sg mei_me intel_pch_thermal mei shpchp wmi video acpi_pad button efivarfs
[  174.082344]  ip_tables x_tables autofs4 btrfs crc32c_generic xor zstd_decompress hid_logitech_hidpp zstd_compress xxhash hid_logitech_dj raid6_pq usbhid hid sd_mod crc32c_intel aesni_intel aes_x86_64 crypto_simd cryptd glue_helper ahci xhci_pci libahci e1000e xhci_hcd ptp libata r8169 pps_core i2c_i801 mii usbcore scsi_mod usb_common fan thermal
[  174.082359] CPU: 0 PID: 1912 Comm: Scanner Tainted: G        W  O     4.15.0-0.bpo.2-amd64 #1 Debian 4.15.11-1~bpo9+1
[  174.082360] Hardware name: Gigabyte Technology Co., Ltd. H370AORUSGAMING3/H370 AORUS GAMING 3-CF, BIOS F2 03/01/2018
[  174.082362] RIP: 0010:dvblb_ioctl+0x453/0x660 [dvbloopback]
[  174.082363] RSP: 0018:ffffc093052cbaa0 EFLAGS: 00010246
[  174.082364] RAX: fffffffffffffff2 RBX: 0000000040106f52 RCX: 0000000000000000
[  174.082365] RDX: 0000000000000000 RSI: 00007f6da6ffc020 RDI: ffffc093052cbdd8
[  174.082366] RBP: 00007f6da6ffc010 R08: ffff9fd34f108d00 R09: 000000000000001b
[  174.082367] R10: ffff9fd34f108d38 R11: 0000000000000000 R12: 0000000000000001
[  174.082367] R13: ffffc093052cbdc8 R14: 0000000000000000 R15: ffffffffc0a0b3f0
[  174.082369] FS:  00007f6da6ffd700(0000) GS:ffff9fd37e400000(0000) knlGS:0000000000000000
[  174.082370] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  174.082371] CR2: 00007f6da6ffc010 CR3: 000000046fdce002 CR4: 00000000003606f0
[  174.082372] Call Trace:
[  174.082376]  ? update_load_avg+0x5c0/0x6e0
[  174.082378]  ? do_sys_poll+0x3ab/0x5d0
[  174.082379]  ? account_entity_enqueue+0xc5/0xf0
[  174.082381]  ? enqueue_entity+0x10f/0x680
[  174.082382]  ? enqueue_task_fair+0x6c/0x7e0
[  174.082384]  ? __alloc_skb+0x82/0x1c0
[  174.082386]  ? check_preempt_curr+0x54/0x90
[  174.082387]  ? ttwu_do_wakeup+0x19/0x150
[  174.082388]  ? try_to_wake_up+0x54/0x490
[  174.082390]  ? __kmalloc_reserve.isra.39+0x2e/0x80
[  174.082391]  ? pollwake+0x75/0x90
[  174.082393]  ? wake_up_q+0x70/0x70
[  174.082395]  ? __wake_up_common+0x96/0x180
[  174.082396]  ? __wake_up_common_lock+0x89/0xc0
[  174.082398]  ? sock_def_readable+0x3c/0x60
[  174.082399]  ? unix_stream_sendmsg+0x3b2/0x3e0
[  174.082402]  ? sock_sendmsg+0x36/0x40
[  174.082403]  ? SYSC_sendto+0x11d/0x150
[  174.082405]  do_vfs_ioctl+0xa2/0x620
[  174.082407]  ? handle_mm_fault+0xc6/0x1b0
[  174.082408]  SyS_ioctl+0x74/0x80
[  174.082410]  do_syscall_64+0x8d/0x120
[  174.082412]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  174.082413] RIP: 0033:0x7f6de1062f07
[  174.082414] RSP: 002b:00007f6da6ffbf98 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[  174.082416] RAX: ffffffffffffffda RBX: 0000000090002a00 RCX: 00007f6de1062f07
[  174.082417] RDX: 00007f6da6ffc010 RSI: 0000000040106f52 RDI: 000000000000001b
[  174.082417] RBP: 00007f6da6ffc6a0 R08: 00007f6ccc013890 R09: 00007f6de4bb1980
[  174.082418] R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
[  174.082419] R13: 00007ffe3cb2cbef R14: 0000000000000000 R15: 000000000000001a
[  174.082420] Code: 89 c2 48 c7 c0 f2 ff ff ff 48 85 d2 0f 85 6b ff ff ff 81 fb 52 6f 10 40 4c 8b 44 24 08 74 0c 81 fb 53 6f 10 80 0f 85 79 fe ff ff <8b> 45 00 be c0 00 40 01 4c 89 04 24 48 8d 14 c0 48 8d 3c 50 48 
[  174.082439] RIP: dvblb_ioctl+0x453/0x660 [dvbloopback] RSP: ffffc093052cbaa0
[  174.082440] CR2: 00007f6da6ffc010
[  174.082441] ---[ end trace 1e8ed6ce18ee01e3 ]--- 
bas-t commented 6 years ago

So you're having troubles with your TBS drivers too... My best guess is : build them in-tree and switch to tvheadend, I did so long time ago and up to linux-4.17.rcx it works fine. If you decide to make that switch I think I can help building your kernel with TBS drivers in-tree. I did look into the plugin_showioctl.c build errors issue, but sadly they don't come with an easy fix. Sorry.

bas-t commented 6 years ago

BTW, if I recall corectly, you need TBS6985 drivers, right?

wdirksen commented 6 years ago

Hi Tycho,

Yes, so now I'm a DVB-S2 man since moving to NZ. We've got a TBS 6984, 6985, and 6908. All 3 three cards work with the TBS drivers. The 6985 is my least favorite as it glitches more often and fails sporadically requiring reboots but it always initializes as well as the other 2 which is why it is my backup. The 6984 + 6908 are both in the old Sandybridge Intel i5 server as we speak. (quite hilarious, barely holding up with drives connected to a PCIe SATA card for the MB to remain functional) You mentioned the TBS drivers, they are verified working fine with 4.14, 4.15 + 4.16 ARCH built together with the dvbloopback module but without the binary. Then together with a very old ffdecsawrapper binary taken from from pre February 2017 ArchLinux when ffdecsawrapper still compiled perfectly prior to the move of openssl to ver 1.1.

Now to the new system where I need 4.15 or better. I have a small live CD installation of BBQLinux (Arch variant) from December 2016 which is frozen in time to build the ffdecsawrapper binary if I need it. Tonight I will attempt to build the ff binary with the untouched BBQLinux except updated to kernel 4.10 without changing any other dependencies. Since 4.10 was the first complete merge for Intel Kaby Lake whose CPU instruction set profile is identical to Coffee Lake, hopefully this will work together as the dvbloopback module and TBS drivers do compile fine with current Arch and Ubuntu 18.04. Incidentally, the 6985 works perfect on the new Coffee Lake machine with MythTV v29 without FFdecsawrapper on FTA channels on Arch, Ubuntu 18.04, but not Debian 9 with 4.15. Very weird as Debian is the only distro in this scenario that actually compiles the binary without halting on the plugin_showioctl.c error.

I really appreciate your support after all these years and its been fun to communicate with you again. I am interested in how to get the TBS drivers built in tree as then I suppose I could in theory then use your separate standalone binary and dvbloopback packages correct? Otherwise I have kept tvheadend + Kodi in mind. I did try it awhile back (+/- 2012) but the live TV pausing and replaying was atrocious then. We did also actually try Kodi with the cmyth addon but the WAF for Kodi as a frontend was very low. She really likes MythTV frontend. IMHO, MythTV + FFdecsawrapper is the absolute holy grail in PVR when it all works. Now with ver. 29 being a very good release for MythTV (0.28 was a nightmare) We don't want to change unless we need to.

I'm hoping to pop the cork on the champagne tonight with a 4.10 built binary and 4.15/4.16 built dvbloopback and TBS drivers. In theory it should work based on the above.

wdirksen commented 6 years ago

Do you know if the standalone FFdecsawrapper binary package builds without the plugin_showioctl.c error with Debian Buster or Ubuntu 18.04?

bas-t commented 6 years ago

I don't know about Debian Buster, I don't have it running right now. In Ubuntu 18.04 it does not build, due to these plugin_showioctl.c errors.

bas-t commented 6 years ago

I was totaly wrong, searchd in the wrong direction. Anyhow, I'm pushing a fix. Ceers!