jpoet / HauppaugeUSB

MythTV wrapper around the Hauppauge HD-PVR2/Colossus2 driver
GNU General Public License v3.0
16 stars 5 forks source link

Compile on Mythbuntu 16.04.3? #2

Closed ForsGump closed 6 years ago

ForsGump commented 6 years ago

I have a system running Mythbuntu 16.04.3. I think I have installed the equivalent dev packages (all the libboost-*-dev and libusb-1.0-0-dev). Following the instructions in the readme.md led me first to errors like the following:

In file included from MythTV.cpp:21:0:
MythTV.h:152:23: error: field ‘m_ready’ has incomplete type ‘std::atomic<bool>’
     std::atomic<bool> m_ready;
                       ^
In file included from /usr/include/c++/5/bits/shared_ptr_atomic.h:33:0,
                 from /usr/include/c++/5/memory:83,
                 from /usr/include/boost/config/no_tr1/memory.hpp:21,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:23,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/date_time/time_clock.hpp:17,
                 from /usr/include/boost/thread/thread_time.hpp:9,
                 from /usr/include/boost/thread/lock_types.hpp:18,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread_only.hpp:17,
                 from /usr/include/boost/thread/thread.hpp:12,
                 from ./Wrappers/linux/../../Logger.h:26,
                 from ./Wrappers/linux/log.h:5,
                 from ./Wrappers/linux/baseif.h:14,
                 from ./Hauppauge/Common/FX2API/FX2Device.h:4,
                 from ./Hauppauge/Common/EncoderDev/encoderDev_DXT.h:5,
                 from Common.h:24,
                 from MythTV.h:24,
                 from MythTV.cpp:21:
/usr/include/c++/5/bits/atomic_base.h:126:12: note: declaration of ‘struct std::atomic<bool>’
     struct atomic;

So I added #include <atomic> to MythTV.h, which got me to:

g++ -g -c -Wall -std=c++11 -fdiagnostics-color -DBOOST_LOG_DYN_LINK -pthread -m64 -g -O3 -D_GNU_SOURCE -DDRIVER_BUILD -DHAUPPAUGE -DHCW_E5BDA `pkg-config --cflags libusb-1.0` -I..
 -I./Hauppauge/Common -I./Wrappers/linux -I./Hauppauge/Common/FX2API -I./Hauppauge/Common/Rx/ADV7842 -I./Hauppauge/Common/Rx/ADV7842/RX -I./Hauppauge/Common/Rx/ADV7842/RX/LIB -I./
Hauppauge/Common/Rx/ADV7842/RX/HAL -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G/ADV7842/HAL -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G/ADV784
2/MACROS -I./Hauppauge/Common/Rx -I./Hauppauge/Common/EncoderDev -I./Hauppauge/Common/EncoderDev/HAPIHost -I./Hauppauge/Common/EncoderDev/HAPIHost/MChip `pkg-config --cflags libus
b-1.0` HauppaugeDev.cpp -o HauppaugeDev.o
g++ -g -c -Wall -std=c++11 -fdiagnostics-color -DBOOST_LOG_DYN_LINK -pthread -m64 -g -O3 -D_GNU_SOURCE -DDRIVER_BUILD -DHAUPPAUGE -DHCW_E5BDA `pkg-config --cflags libusb-1.0` -I..
 -I./Hauppauge/Common -I./Wrappers/linux -I./Hauppauge/Common/FX2API -I./Hauppauge/Common/Rx/ADV7842 -I./Hauppauge/Common/Rx/ADV7842/RX -I./Hauppauge/Common/Rx/ADV7842/RX/LIB -I./
Hauppauge/Common/Rx/ADV7842/RX/HAL -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G/ADV7842/HAL -I./Hauppauge/Common/Rx/ADV7842/RX/HAL/4G/ADV784
2/MACROS -I./Hauppauge/Common/Rx -I./Hauppauge/Common/EncoderDev -I./Hauppauge/Common/EncoderDev/HAPIHost -I./Hauppauge/Common/EncoderDev/HAPIHost/MChip `pkg-config --cflags libus
b-1.0` hauppauge2.cpp -o hauppauge2.o
g++ Logger.o Common.o MythTV.o HauppaugeDev.o hauppauge2.o -o hauppauge2  `pkg-config --libs libusb-1.0` -lpthread libADV7842.a -lboost_program_options -lboost_log -lboost_log_set
up -lboost_system -lboost_thread -lboost_filesystem
libADV7842.a(USBif.o): In function `USBWrapper_t::USBWrapper_t()':
/home/user/src/Hauppauge/HauppaugeUSB/./Wrappers/linux/USBif.cpp:20: undefined reference to `libusb_init'
/home/user/src/Hauppauge/HauppaugeUSB/./Wrappers/linux/USBif.cpp:32: undefined reference to `libusb_set_debug'

I'm stuck here -- is anyone else successful in compiling it on 16.04.3? I'll note that extracting the Hauppauge download to a separate directory compiles fine, but I do notice that it uses it's built-in libusb (1.0.18).

For reference:pkg-config --cflags libusb-1.0 gives -I/usr/include/libusb-1.0.

jpoet commented 6 years ago

I just pushed a change which includes atomic. I also re-ordered the libraries when linking. Maybe that will fix your issue.

jpoet commented 6 years ago

Can you give me the list of packages you had to install for Ubuntu? I will add them to the README.

ForsGump commented 6 years ago

Thanks! I'll update my repo and try again when I get home.

I'll look in my apt history to see what all I installed, as well. I can say for sure that if your patched version still requires xxd for the firmware (which is required for compiling the driver by itself), that is vim-common. I'll get the rest later.

ForsGump commented 6 years ago

Thanks for the patches, I got it compiled and hauppauge2 --list works! I'll consider this closed.

Follow up--here are the dependencies on (myth|u)buntu 16.04: sudo apt install build-essential libusb-1.0.0-dev libboost-dev libboost-program-options-dev libboost-log-dev vim-common