With upcoming changes to data protection and privacy laws in Europe coming into effect soon, we thought this would be a good time to remind everyone that we do have a privacy policy.
This applies to all users and visitors world-wide.

We have made a few changes to the language to make it clearer in relation to this new regulation but fundamentally, the terms and your rights are unchanged.

If you have any questions about this, please feel free to ask in the General Forum

Fails compiling libhb/work.c to libhb/work.o

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
tps800
Posts: 12
Joined: Sat Dec 02, 2017 2:48 am

Fails compiling libhb/work.c to libhb/work.o

Post by tps800 » Wed Dec 06, 2017 3:05 am

Description of problem or question

Fails compiling libhb/work.c to libhb/work.o

Steps to reproduce the problem (If Applicable)

Code: Select all

# git clone ...
# cd HandBrake
# ./configure
patch '-Werror=implicit-function-declaration' to '-Wimplicit-function-declaration'
checkout libbluray from http://git.videolan.org/git/libbluray.git and fake gmake to compile the checked out version instead of downloaded libbluray-1.0.1 (gets around bug within compiling libbluray-1.0.1).

Code: Select all

# cd build
# gmake
HandBrake version (e.g., 1.0.0)

Handbrake – trunc
libbluray – trunc

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.3 High Sierra, Windows 10 Creators Update)

* Ubuntu 17.10
* FreeBSD 11.1

Error message text or screenshot (If Applicable)

Code: Select all

../libhb/work.c: In function 'hb_work_init':
../libhb/work.c:56:53: error: 'HB_LOW_PRIORITY' undeclared (first use in this function)
     return hb_thread_init( "work", work_func, work, HB_LOW_PRIORITY );
                                                     ^~~~~~~~~~~~~~~
../libhb/work.c:56:53: note: each undeclared identifier is reported only once for each function it appears in
../libhb/work.c: In function 'do_job':
../libhb/work.c:1717:62: error: 'HB_LOW_PRIORITY' undeclared (first use in this function)
         w->thread = hb_thread_init(w->name, hb_work_loop, w, HB_LOW_PRIORITY);
HB_LOW_PRIORITY is defined within libhb/ports.h:

Code: Select all

# grep -R 'HB_LOW_PRIORITY' *
libhb/ports.h:#  define HB_LOW_PRIORITY    5
libhb/ports.h:#  define HB_LOW_PRIORITY    0
libhb/ports.h:#  define HB_LOW_PRIORITY    0
libhb/ports.h:#  define HB_LOW_PRIORITY    0
libhb/ports.h:#  define HB_LOW_PRIORITY    0
The include path is set to:#

Code: Select all

 ./libhb/
 ./contrib/include
 /usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.0/6.4.0/include
 /usr/local/include
 /usr/include
And 'ports.h' is included from 'common.h':

Code: Select all

# grep -Ri 'ports.h' *
common.h:#include "ports.h"
'../libhb/work.c' includes 'qsv_common.h' and never includes 'common.h' or 'ports.h' but uses variables defined in 'ports.h'

-> ports.h has to be included somewhere to make it compile!

tps800
Posts: 12
Joined: Sat Dec 02, 2017 2:48 am

Re: Fails compiling libhb/work.c to libhb/work.o

Post by tps800 » Wed Dec 06, 2017 3:25 am

Looks like there are two 'ports.h':
* build/libhb/ports.h
* libhb/ports.h

Seems like

Code: Select all

/usr/local/bin/gcc -std=gnu99 -pipe -fmessage-length=0 -Wall -g0 -O3 -mfpmath=sse -msse2 -DUSE_LIBAV_AAC -D__LIBHB__ -DUSE_PTHREAD -DUSE_X265 -DHAS_STRERROR_R -DARCH_X86_64 -I./libhb/ -I./contrib/include -I/usr/include/libxml2 -c ../libhb/work.c -o libhb/work.o
includes 'ports.h' from HandBrake 'libhb/ports.h', not the generated one in 'build/libhb/ports.h'. The generated one holds missing definitions, the one found in HandBrakes libhb/ports.h' does not.

Code: Select all

. ../libhb/hb.h
.. ../libhb/common.h
... ../libhb/hbtypes.h
... ../libhb/hb_dict.h
.... /usr/local/include/jansson.h
..... /usr/include/stdio.h
...... /usr/include/sys/cdefs.h
...... /usr/include/sys/_null.h
...... /usr/include/sys/_types.h
....... /usr/include/machine/_types.h
........ /usr/include/x86/_types.h
......... /usr/include/machine/_limits.h
.......... /usr/include/x86/_limits.h
..... /usr/include/stdlib.h
..... /usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.0/6.4.0/include/stdarg.h
..... /usr/local/include/jansson_config.h
... /usr/include/math.h
.... /usr/include/machine/_limits.h
... /usr/include/string.h
.... /usr/include/strings.h
..... /usr/include/xlocale/_strings.h
.... /usr/include/xlocale/_string.h
... /usr/include/unistd.h
.... /usr/include/sys/types.h
..... /usr/include/machine/endian.h
...... /usr/include/x86/endian.h
..... /usr/include/sys/_pthreadtypes.h
..... /usr/include/sys/_stdint.h
..... /usr/include/sys/select.h
...... /usr/include/sys/_sigset.h
...... /usr/include/sys/_timeval.h
...... /usr/include/sys/timespec.h
....... /usr/include/sys/_timespec.h
.... /usr/include/sys/unistd.h
... /usr/include/inttypes.h
.... /usr/include/machine/_inttypes.h
..... /usr/include/x86/_inttypes.h
.... /usr/include/sys/stdint.h
..... /usr/include/machine/_stdint.h
...... /usr/include/x86/_stdint.h
....... /usr/include/machine/_limits.h
... /usr/include/sys/stat.h
.... /usr/include/sys/time.h
..... /usr/include/time.h
...... /usr/include/xlocale/_time.h
... /usr/include/dirent.h
.... /usr/include/sys/dirent.h
... ../libhb/ports.h
... ../libhb/internal.h
.... ../libhb/hbffmpeg.h
-> includes wrong ports.h

tps800
Posts: 12
Joined: Sat Dec 02, 2017 2:48 am

Re: Fails compiling libhb/work.c to libhb/work.o

Post by tps800 » Wed Dec 06, 2017 3:40 am

Last thing to do:

* SYS_...

is not defined and no defaults given for 'HB_LOW_PRIORITY' and 'HB_NORMAL_PRIORITY'

Adding '-DSYS_LINUX' or '-DSYS_FREEBSD' solves this issue.

User avatar
BradleyS
Moderator
Posts: 1279
Joined: Thu Aug 09, 2007 12:16 pm

Re: Fails compiling libhb/work.c to libhb/work.o

Post by BradleyS » Thu Dec 07, 2017 9:55 pm

Also fixed for FreeBSD as part of viewtopic.php?p=175432#p175432

Post Reply