Page 1 of 1

error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 01, 2014 5:31 pm
by marvel
Hi folks,

I receive the following error trying to compile ZoneMinder on CentOS 7:

Code: Select all

In file included from /tmp/ZoneMinder-1.27.0/src/zm_libvlc_camera.h:25:0,
                 from /tmp/ZoneMinder-1.27.0/src/zm_libvlc_camera.cpp:21:
/tmp/ZoneMinder-1.27.0/src/zm_thread.h: In constructor ‘ThreadException::ThreadException(const string&)’:
/tmp/ZoneMinder-1.27.0/src/zm_thread.h:35:109: error: ‘SYS_gettid’ was not declared in this scope
     ThreadException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)syscall(SYS_gettid) ) )
                                                                                                             ^
/tmp/ZoneMinder-1.27.0/src/zm_thread.h: In member function ‘pid_t Thread::id() const’:
/tmp/ZoneMinder-1.27.0/src/zm_thread.h:208:32: error: ‘SYS_gettid’ was not declared in this scope
         return( (pid_t)syscall(SYS_gettid) );
                                ^
make[2]: *** [src/CMakeFiles/zm.dir/zm_libvlc_camera.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/zm.dir/all] Error 2
make: *** [all] Error 2
I could use some help! Thank you.

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 01, 2014 6:23 pm
by marvel
Found the problem. HAVE_SYS_SYSCALL_H was undefined and so sys/syscall.h was not being included.

In src/zm_thread.h:

Code: Select all

#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif // HAVE_SYS_SYSCALL_H
I added the line:

Code: Select all

#define HAVE_SYS_SYSCALL_H
to the file src/zm_thread.h and resolved the problem.

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 01, 2014 9:21 pm
by marvel
Got some more errors trying to compile:

Code: Select all

Linking CXX executable nph-zms
/bin/ld: CMakeFiles/nph-zms.dir/zms.cpp.o: undefined reference to symbol '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4'
/bin/ld: note: '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4' is defined in DSO /lib64/libstdc++.so.6 so try adding it to the linker command line
/lib64/libstdc++.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [src/nph-zms] Error 1
make[1]: *** [src/CMakeFiles/nph-zms.dir/all] Error 2
make: *** [all] Error 2
and

Code: Select all

Linking CXX executable nph-zms
/bin/ld: libzm.a(zm_image.cpp.o): undefined reference to symbol 'round@@GLIBC_2.2.5'
/bin/ld: note: 'round@@GLIBC_2.2.5' is defined in DSO /lib64/libm.so.6 so try adding it to the linker command line
/lib64/libm.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [src/nph-zms] Error 1
make[1]: *** [src/CMakeFiles/nph-zms.dir/all] Error 2
make: *** [all] Error 2
I had similar problems with zma, zmc, zmf, zms, zmstreamer and zmu.

I had to edit the following files:

./src/CMakeFiles/nph-zms.dir/link.txt
./src/CMakeFiles/zma.dir/link.txt
./src/CMakeFiles/zmc.dir/link.txt
./src/CMakeFiles/zmf.dir/link.txt
./src/CMakeFiles/zms.dir/link.txt
./src/CMakeFiles/zmstreamer.dir/link.txt
./src/CMakeFiles/zmu.dir/link.txt

and add "/lib64/libstdc++.so.6 /lib64/libm.so.6" to the "-o" arguments.

Example from first file:

Code: Select all

/bin/gcc   -Wall -D__STDC_CONSTANT_MACROS -O2    CMakeFiles/nph-zms.dir/zms.cpp.o  -o nph-zms -rdynamic libzm.a -lz -lcurl -ljpeg -lssl -lcrypto -lpthread -lpcre /usr/lib64/mysql/libmysqlclient.so -Wl,-rpath,/usr/lib64/mysql
becomes:

Code: Select all

/bin/gcc   -Wall -D__STDC_CONSTANT_MACROS -O2    CMakeFiles/nph-zms.dir/zms.cpp.o  -o nph-zms /lib64/libstdc++.so.6 /lib64/libm.so.6 -rdynamic libzm.a -lz -lcurl -ljpeg -lssl -lcrypto -lpthread -lpcre /usr/lib64/mysql/libmysqlclient.so -Wl,-rpath,/usr/lib64/mysql
Leaving all of this here in case it helps somebody else. I couldn't find any info on these errors using the search function, neither in the forums nor the wiki nor the main zoneminder page.

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 01, 2014 9:27 pm
by marvel
*sigh*, make install also failed. Had to modify the relink.txt files in the same fashion.

./src/CMakeFiles/nph-zms.dir/relink.txt
./src/CMakeFiles/zma.dir/relink.txt
./src/CMakeFiles/zmc.dir/relink.txt
./src/CMakeFiles/zmf.dir/relink.txt
./src/CMakeFiles/zms.dir/relink.txt
./src/CMakeFiles/zmstreamer.dir/relink.txt
./src/CMakeFiles/zmu.dir/relink.txt

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 08, 2014 2:16 pm
by knight-of-ni
Welcome to the bleeding edge of development. :-)
CentOS 7 was recently released, and I have yet to do anything with 7 other than install it into a virtual machine.

It is significantly different then CentOS 6, which means I fully expect to run into exactly the kinds of issues you have documented.
Thank you for documenting your trials as I'm sure I will refer to it when I get to a point where I can test zm on centos 7.

As an alternative, if developing zoneminder on an untested distro isn't your thing, I've got tested and working rpms for centos 6 here: http://www.zoneminder.com/forums/viewto ... =9&t=19119

I'd love to get these rpms hosted somewhere, but I have yet to get a volunteer to come through.

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 08, 2014 7:26 pm
by marvel
Thanks for the info. I'm struggling with ffmpeg now and your offer of the centos 6 RPMs is enticing. I may drop down just so I can get this damn thing operational.

Re: error: ‘SYS_gettid’ was not declared in this scope

Posted: Fri Aug 08, 2014 7:45 pm
by knight-of-ni
Glad to help.
Note the instructions in the link I gave you take care of all zoneminder's dependencies, including (and especially) ffmpeg.
Once the additional repos are installed and configured, all the dependencies get downloaded and installed for you.