Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Zoneminder Segfault after MariaDB-10.1.34
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Sun Sep 23, 2018 12:27 am    Post subject: Reply with quote

While I would need to see the specific bug explanation to be sure, my first inclination is to say that it is not a problem with old code bases failing to keep up. It is a problem of old code bases that were always wrong, and are no longer permitted to be silently wrong. Old code that was right the first time does not mysteriously break on glibc upgrades. If it were, we would have far bigger problems with far more central packages.
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Sun Sep 23, 2018 3:27 pm    Post subject: Reply with quote

That's a good way to look at it.
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
jiminim
n00b
n00b


Joined: 18 Jun 2002
Posts: 14
Location: Starkvegas, MS

PostPosted: Wed Sep 26, 2018 2:55 am    Post subject: Reply with quote

I just made my first custom ebuild tonight to install zoneminder-1.32.0 after getting the same glibc segfault issue. It works!

I removed the patches from the zoneminder-1.30.4 ebuild and found a problem with /var/tmp/portage/www-misc/zoneminder-1.32.0/image///etc/conf.d/README
The README has mismatched single quotes that break the build. Deleting it while the build is running is a hacky way to get around the problem, but it works.

Had to make these sql changes before zmupdate.pl would run cleanly:
Code:
GRANT ALL PRIVILEGES on zm.* to 'zmuser'@localhost identified by 'password';
SET GLOBAL log_bin_trust_function_creators = 1;

In 16 years of using Gentoo, I've contributed nothing back, so maybe it is time to make this ebuild work without the hack and get it submitted.
Back to top
View user's profile Send private message
WintermuteX
n00b
n00b


Joined: 29 Apr 2006
Posts: 48
Location: Germany

PostPosted: Wed Sep 26, 2018 2:13 pm    Post subject: Reply with quote

Raffi wrote:
It is possible to get zoneminder working with the latest mariadb, but you will not have a "normal" system when you are done.

To get all the blocks resolved, everything compiled and not segfaulting, I had to do the following

emerge -C virtual/libmysqlclient

I then had to modify the ebuild for dev-db/mariadb to allow it to depend on mariadb-connector-c[mysqlcomap]. I then had to modify dev-perl/DBD-mysql to do the same. DBD-mysql also needed a patch to properly compaile against mariadb-connector-c.

Looks like portage is really not yet ready to have mariadb-connector-c replace mysql-connector-c without quite a bit of work.


Yeah, this is a solution. A pitty gentoo will take ages until they get this solved ... if ever ...
I really love gentoo, but the project has slowed downed and the enthusiasm is also a thing of the past somehow. At least that's how it feels to me.


Last edited by WintermuteX on Wed Sep 26, 2018 2:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
WintermuteX
n00b
n00b


Joined: 29 Apr 2006
Posts: 48
Location: Germany

PostPosted: Wed Sep 26, 2018 2:23 pm    Post subject: Reply with quote

jiminim wrote:
I just made my first custom ebuild tonight to install zoneminder-1.32.0 after getting the same glibc segfault issue. It works!

I removed the patches from the zoneminder-1.30.4 ebuild and found a problem with /var/tmp/portage/www-misc/zoneminder-1.32.0/image///etc/conf.d/README
The README has mismatched single quotes that break the build. Deleting it while the build is running is a hacky way to get around the problem, but it works.

Had to make these sql changes before zmupdate.pl would run cleanly:
Code:
GRANT ALL PRIVILEGES on zm.* to 'zmuser'@localhost identified by 'password';
SET GLOBAL log_bin_trust_function_creators = 1;

In 16 years of using Gentoo, I've contributed nothing back, so maybe it is time to make this ebuild work without the hack and get it submitted.


This would be great, I also thought about trying to modify the existing ebuild to give 1.32.0 a try. Maybe, as I now know this would fix it, I will try it for myself :).
Back to top
View user's profile Send private message
n3r0
n00b
n00b


Joined: 27 Feb 2007
Posts: 25
Location: Western Australia

PostPosted: Thu Sep 27, 2018 2:26 am    Post subject: Reply with quote

Inspired by jiminim and frustrated by a lack of zoneminder, I figured I'd give it a go as well.

I copied the old 1.30.4 ebuild, migrated the diskspace patch and dropped the others.
Code:
@@ -1361,7 +1361,7 @@
   return( $load[0] );
 }

-function getDiskPercent($path = ZM_DIR_EVENTS) {
+function getDiskPercent($path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS) {
   $total = disk_total_space($path);
   if ( $total === false ) {
     Error("disk_total_space returned false. Verify the web account user has access to " . $path );

I also mangled src_prepare to delete the README file.
Code:
rm "${WORKDIR}/${PN}-1.32.0/conf.d/README" || die


zmupdate.pl ran cleanly for me, but I needed to do the following.
I created the file /etc/conf.d/10-zm.conf, to which I needed to add
Code:
ZM_DB_PASS=password

You'd also need to add any other variables that we're previously overwritten in /etc/zm.conf
I'm not entirely sure if it was just laziness back when I originally setup zoneminder or if it's just good practice now (probably laziness).

I also needed the SQL change of
Code:
SET GLOBAL log_bin_trust_function_creators = 1;

Which zmupdate.pl recommends anyway.

So, now zoneminder runs and the cameras are back up and operational when accessing the server directly.
However I have several warnings in the log file which have apparently been fixed in the master Zoneminder #2209.
I also have several console artefacts due to missing css links.

Finally, I need to investigate a few issues with my (admittedly dodgy) Apache config as the reverse proxy is fairly broken now.
I might plug away a bit at it later on and I'll update with any fixes.

Update: css issues are resolved by reading the documentation (sigh).
First off, if it doesn't already exist, you need to create /var/cache/zoneminder

My apache zoneminder.include file now looks like this:
Code:
Alias /zoneminder/cache "/var/cache/zoneminder"

<Directory "/var/cache/zoneminder">
  Options -Indexes +MultiViews +FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

Alias /zoneminder "/usr/share/zoneminder/www"

<Directory "/usr/share/zoneminder/www">
  Options Indexes MultiViews FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

ScriptAlias /cgi-bin/zms "/usr/libexec/zoneminder/cgi-bin/zms"
ScriptAlias /cgi-bin/nph-zms "/usr/libexec/zoneminder/cgi-bin/nph-zms"

<Directory "/usr/libexec/zoneminder/cgi-bin">
  AllowOverride All
  Options ExecCGI MultiViews FollowSymLinks
  Require all granted
</Directory>

The order of which for Apache 2.4 is quite important.
This just leaves the reverse proxy and Log errors to resolve.
Back to top
View user's profile Send private message
WintermuteX
n00b
n00b


Joined: 29 Apr 2006
Posts: 48
Location: Germany

PostPosted: Thu Sep 27, 2018 6:23 am    Post subject: Reply with quote

n3r0 wrote:
Inspired by jiminim and frustrated by a lack of zoneminder, I figured I'd give it a go as well.


I also built a custom ebuild now using your experiences. Thanks :)
I added a patchfile to fix the problem in Storage.php, which you linked, to my own ebuild:

zoneminder-1.32.0-storage.patch:
--- ZoneMinder-1.32.0.orig/web/includes/Storage.php   2018-09-12 14:27:45.000000000 +0200
+++ ZoneMinder-1.32.0/web/includes/Storage.php
@@ -3,15 +3,27 @@

 $storage_cache = array();
 class Storage {
+  private $defaults = array(
+    'Id'        => null,
+    'Path'      => '',
+    'Name'      => '',
+    'Type'      => 'local',
+    'Url'       => '',
+    'DiskSpace' => null,
+    'Scheme'    => 'Medium',
+    'ServerId'  => 0,
+    'DoDelete'  => 1,
+  );
+
   public function __construct( $IdOrRow = NULL ) {
     global $storage_cache;

     $row = NULL;
     if ( $IdOrRow ) {
-      if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
-        $row = dbFetchOne( 'SELECT * FROM Storage WHERE Id=?', NULL, array( $IdOrRow ) );
+      if ( is_integer($IdOrRow) or is_numeric($IdOrRow) ) {
+        $row = dbFetchOne('SELECT * FROM Storage WHERE Id=?', NULL, array($IdOrRow));
         if ( ! $row ) {
-          Error("Unable to load Storage record for Id=" . $IdOrRow );
+          Error('Unable to load Storage record for Id=' . $IdOrRow);
         }
       } else if ( is_array($IdOrRow) ) {
         $row = $IdOrRow;
@@ -59,7 +71,13 @@
     if ( array_key_exists($fn, $this) )
       return $this->{$fn};

+    if ( array_key_exists( $fn, $this->defaults ) )
+      return $this->defaults{$fn};
+
     $backTrace = debug_backtrace();
+    $file = $backTrace[0]['file'];
+    $line = $backTrace[0]['line'];
+    Warning("Unknown function call Storage->$fn from $file:$line");
     $file = $backTrace[1]['file'];
     $line = $backTrace[1]['line'];
     Warning("Unknown function call Storage->$fn from $file:$line");
@@ -73,6 +91,7 @@
         isset($storage_cache[$parameters['Id']]) ) {
       return $storage_cache[$parameters['Id']];
     }
+
     $results = Storage::find($parameters, $options);
     if ( count($results) > 1 ) {
       Error("Storage Returned more than 1");
@@ -111,12 +130,12 @@
       } # end if options
       if ( isset($options['limit']) ) {
         if ( is_integer($options['limit']) or ctype_digit($options['limit']) ) {
-          $sql .= ' LIMIT ' . $limit;
+          $sql .= ' LIMIT ' . $option['limit'];
         } else {
           $backTrace = debug_backtrace();
           $file = $backTrace[1]['file'];
           $line = $backTrace[1]['line'];
-          Error("Invalid value for limit($limit) passed to Control::find from $file:$line");
+          Error("Invalid value for limit(".$options['limit'].") passed to Control::find from $file:$line");
           return array();
         }
       } # end if limit
@@ -124,9 +143,9 @@
     $storage_areas = array();
     $result = dbQuery($sql, $values);
     if ( $result ) {
-      $results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Storage');
-      foreach ( $results as $row => $obj ) {
-        $storage_areas[] = $obj;
+      $results = $result->fetchALL();
+      foreach ( $results as $row ) {
+        $storage_areas[] = new Storage($row);
       }
     }
     return $storage_areas;


This goes to /usr/local/portage/www-misc/zoneminder/files/zoneminder-1.32.0-storage.patch and the ebuild must be extended by

Code:
 "${FILESDIR}/${PN}-1.32.0"-storage.patch


in the PATCHES section.
Back to top
View user's profile Send private message
n3r0
n00b
n00b


Joined: 27 Feb 2007
Posts: 25
Location: Western Australia

PostPosted: Thu Sep 27, 2018 8:11 am    Post subject: Reply with quote

Yeah, I ended up applying all the changes from b0c5555.
As well as a few other tweaks to Monitor.php and Event.php which were missed in that commit.

So everything looks perfect and is behaving quite well with no errors in the console.

I do however seem to have an issue where zmaudit.pl keeps ending up with a stale pid file.
And I still haven't fixed the reverse proxy :roll:

Still, progress!
It otherwise seems really stable which is great given the amount of sins committed to get it going.
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Sat Oct 13, 2018 5:55 pm    Post subject: Reply with quote

Could someone who got it working post the ebuild and files folder additions so we don't have to do everything by hand following the posts as a guide?
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
n3r0
n00b
n00b


Joined: 27 Feb 2007
Posts: 25
Location: Western Australia

PostPosted: Sun Oct 14, 2018 12:11 pm    Post subject: Reply with quote

Sure thing.
Everything is working fine as near as I can tell... it's doing the job I need it to do at least.

There have been two minor releases since this threads started, so this ebuild is for 1.32.2.
I've modified it to create the cache directory and it does not require any extra patching.
So this should just work :D

The problem I mentioned earlier in the thread with zmaudit.pl was caused by a missing perl dependency (as always).
Just run the script manually and it'll highlight anything missing for your system.
I also had a missing dependancy for zmtrigger.pl.
I needed to install
Code:
dev-perl/Number-Bytes-Human
dev-perl/Device-SerialPort


If this works for a few other people i'll post it to bug #666607

Good Luck!

Updated Ebuild for zomeminder-1.32.2:
Code:
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# TO DO:
# * dependencies of unknown status:
#       dev-perl/Device-SerialPort
#       dev-perl/MIME-Lite
#       dev-perl/MIME-tools
#       dev-perl/PHP-Serialization
#       virtual/perl-Archive-Tar
#       virtual/perl-libnet
#       virtual/perl-Module-Load

EAPI=6

inherit versionator perl-functions readme.gentoo-r1 cmake-utils depend.apache flag-o-matic systemd

MY_PN="ZoneMinder"

MY_CRUD_VERSION="3.1.0"

DESCRIPTION="Capture, analyse, record and monitor any cameras attached to your system"
HOMEPAGE="http://www.zoneminder.com/"
SRC_URI="
        https://github.com/${MY_PN}/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
        https://github.com/FriendsOfCake/crud/archive/v${MY_CRUD_VERSION}.tar.gz -> Crud-${MY_CRUD_VERSION}.tar.gz
"

LICENSE="GPL-2"
KEYWORDS="~amd64"
IUSE="curl encode ffmpeg gcrypt gnutls +mmap +ssl libressl vlc"
SLOT="0"

REQUIRED_USE="
        || ( ssl gnutls )
"

DEPEND="
        app-eselect/eselect-php[apache2]
        dev-lang/perl:=
        dev-lang/php:*[apache2,cgi,curl,gd,inifile,pdo,mysql,mysqli,sockets]
        dev-libs/libpcre
        dev-perl/Archive-Zip
        dev-perl/Class-Std-Fast
        dev-perl/Data-Dump
        dev-perl/Date-Manip
        dev-perl/Data-UUID
        dev-perl/DBD-mysql
        dev-perl/DBI
        dev-perl/IO-Socket-Multicast
        dev-perl/SOAP-WSDL
        dev-perl/Sys-CPU
        dev-perl/Sys-MemInfo
        dev-perl/URI-Encode
        dev-perl/libwww-perl
        dev-php/pecl-apcu:*
        sys-auth/polkit
        sys-libs/zlib
        ffmpeg? ( virtual/ffmpeg )
        encode? ( media-libs/libmp4v2 )
        virtual/httpd-php:*
        virtual/jpeg:0
        virtual/mysql
        virtual/perl-ExtUtils-MakeMaker
        virtual/perl-Getopt-Long
        virtual/perl-Sys-Syslog
        virtual/perl-Time-HiRes
        www-servers/apache
        curl? ( net-misc/curl )
        gcrypt? ( dev-libs/libgcrypt:0= )
        gnutls? ( net-libs/gnutls )
        mmap? ( dev-perl/Sys-Mmap )
        ssl? (
                !libressl? ( dev-libs/openssl:0= )
                libressl? ( dev-libs/libressl:0= )
        )
        vlc? ( media-video/vlc[live] )
"
RDEPEND="${DEPEND}"

# we cannot use need_httpd_cgi here, since we need to setup permissions for the
# webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
need_apache

PATCHES=(
)

MY_ZM_WEBDIR=/usr/share/zoneminder/www

src_prepare() {
        cmake-utils_src_prepare

        rmdir "${S}/web/api/app/Plugin/Crud" || die
        mv "${WORKDIR}/crud-${MY_CRUD_VERSION}" "${S}/web/api/app/Plugin/Crud" || die
        rm "${WORKDIR}/${P}/conf.d/README" || die
}

src_configure() {
        append-cxxflags -D__STDC_CONSTANT_MACROS
        perl_set_version
        export TZ=UTC # bug 630470
        mycmakeargs=(
                -DZM_PERL_SUBPREFIX=${VENDOR_LIB#/usr}
                -DZM_TMPDIR=/var/tmp/zm
                -DZM_SOCKDIR=/var/run/zm
                -DZM_WEB_USER=apache
                -DZM_WEB_GROUP=apache
                -DZM_WEBDIR=${MY_ZM_WEBDIR}
                -DZM_NO_MMAP="$(usex mmap OFF ON)"
                -DZM_NO_X10=OFF
                -DZM_NO_FFMPEG="$(usex ffmpeg OFF ON)"
                -DZM_NO_CURL="$(usex curl OFF ON)"
                -DZM_NO_LIBVLC="$(usex vlc OFF ON)"
                -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL="$(usex ssl OFF ON)"
                -DHAVE_GNUTLS="$(usex gnutls ON OFF)"
                -DHAVE_GCRYPT="$(usex gcrypt ON OFF)"
        )

        cmake-utils_src_configure

}

src_install() {
        cmake-utils_src_install

        # the log directory
        keepdir /var/log/zm
        fowners apache:apache /var/log/zm

        # the logrotate script
        insinto /etc/logrotate.d
        newins distros/ubuntu1204/zoneminder.logrotate zoneminder

        # now we duplicate the work of zmlinkcontent.sh
        keepdir /var/lib/zoneminder /var/lib/zoneminder/images /var/lib/zoneminder/events /var/lib/zoneminder/api_tmp
        fperms -R 0775 /var/lib/zoneminder
        fowners -R apache:apache /var/lib/zoneminder
        dosym /var/lib/zoneminder/images ${MY_ZM_WEBDIR}/images
        dosym /var/lib/zoneminder/events ${MY_ZM_WEBDIR}/events
        dosym /var/lib/zoneminder/api_tmp ${MY_ZM_WEBDIR}/api/app/tmp

        # the cache directory
        keepdir /var/cache/zoneminder
        fowners apache:apache /var/cache/zoneminder

        # bug 523058
        keepdir ${MY_ZM_WEBDIR}/temp
        fowners -R apache:apache ${MY_ZM_WEBDIR}/temp

        # the configuration file
        fperms 0640 /etc/zm.conf
        fowners root:apache /etc/zm.conf

        # init scripts etc
        newinitd "${FILESDIR}"/init.d zoneminder
        newconfd "${FILESDIR}"/conf.d zoneminder

        # systemd unit file
        systemd_dounit "${FILESDIR}"/zoneminder.service

        cp "${FILESDIR}"/10_zoneminder.conf "${T}"/10_zoneminder.conf || die
        sed -i "${T}"/10_zoneminder.conf -e "s:%ZM_WEBDIR%:${MY_ZM_WEBDIR}:g" || die

        dodoc AUTHORS BUGS ChangeLog INSTALL NEWS README.md TODO "${T}"/10_zoneminder.conf

        perl_delete_packlist

        readme.gentoo_create_doc
}

pkg_postinst() {
        readme.gentoo_print_elog

        local v
        for v in ${REPLACING_VERSIONS}; do
                if ! version_is_at_least ${PV} ${v}; then
                        elog "You have upgraded zoneminder and may have to upgrade your database now using the 'zmupdate.pl' script."
                fi
        done
}


Edit: spelling :roll:
Edit 2: Added media-libs/libmp4v2 dependency as per gkmac's suggestion below


Last edited by n3r0 on Wed Oct 24, 2018 8:07 am; edited 2 times in total
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Mon Oct 15, 2018 5:36 pm    Post subject: Reply with quote

Thanks!

I created my own ebuild over the weekend and got 32.1 working. I had a few database issues, but this thread helped me figure it out.

I'll try updating with your ebuild as soon as I get some time.
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Tue Oct 16, 2018 1:44 am    Post subject: Reply with quote

n3r0 wrote:
Code:
src_install() {
        # the cache directory
        keepdir /var/cache/zopneminder
        fowners apache:apache /var/cache/zopneminder
This is probably not what you want. The package likely expects the name of its cache directory to be spelled correctly.
Back to top
View user's profile Send private message
n3r0
n00b
n00b


Joined: 27 Feb 2007
Posts: 25
Location: Western Australia

PostPosted: Tue Oct 16, 2018 10:42 am    Post subject: Reply with quote

Well spotted... I was consistent too :lol:

Post edited above in case someone copy/pastes.

Code:
drwxr-xr-x  2 apache  apache  12288 Oct 15 22:25 zoneminder
drwxr-xr-x  2 apache  apache   4096 Oct 14 19:49 zopneminder
Back to top
View user's profile Send private message
gkmac
Guru
Guru


Joined: 19 Jan 2003
Posts: 333
Location: West Sussex, UK

PostPosted: Mon Oct 22, 2018 9:14 pm    Post subject: Reply with quote

Gave n3r0's ebuild a whirl at the weekend and it compiled and installed without a hitch.

One of the new features of v1.32.2 is the ability to encode x264 videos of events as they happen, but this needs media-libs/libmp4v2 installed at compile time. Zoneminder will still compile and run without it, but setting the "video writer" to "x264 encode" will cause event recording to fail silently.

But I don't know...
  • if ffmpeg is needed as well for x264 encoding or not.
  • if the ebuild should always pull in libmp4v2, or if the USE flag "encode" or "x264" should let the user decide.

Unfortunately I've had to roll back to v1.30.2 since I encountered a regression that stops the playback controls working. Not a fault with the ebuild at all, as someone running Fedora 28 has reported the same issue.
_________________
If ~amd64 ebuilds are cutting edge, then git-9999 ebuilds are chainsaws.
"Not everyone can ride a unicycle, does that mean we should put another wheel on it?" - Lokheed
Back to top
View user's profile Send private message
n3r0
n00b
n00b


Joined: 27 Feb 2007
Posts: 25
Location: Western Australia

PostPosted: Wed Oct 24, 2018 8:03 am    Post subject: Reply with quote

Interesting, I had a look and I have the same issue with the controls returning 500 errors on the old jpeg stored events.

My cameras are setup such that I have a primary channel which is high res h264 and a sub channel which is lower res mjpg.
Modect is setup on the sub channels and used to trigger the primaries (shared across cameras).

Events on the primary channels are setup as h264 passthrough and work as expected, including the feed controls.
Events on the sub channels display the events, but indeed the feed controls return 500 errors.

I've been meaning to try the new ffmpeg support in zoneminder... so now's as good a time as any.
I modified the ebuild (I'll edit my earlier post again for anyone finding this later) to include libmp4v2 under the encode flag.
This was automatically pulled into my setup when I re-emerged the package.

Changed the storage of the two sub channels to X264 Encode and... everything just works.

1.32.3 should bring a fix for all, but for myself, the switch to using the x264 encoder is acceptable.
Back to top
View user's profile Send private message
therealjrd
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 120

PostPosted: Tue Nov 06, 2018 9:23 pm    Post subject: Reply with quote

I also fell into the DB trap, and couldn't back out of it because the .31-r1 version of mariadb has fallen out of the tree.

Grabbed n3r0's 1.32.2 ebuild, but that doesn't compile for me. It claims

Code:

/var/tmp/portage/www-misc/zoneminder-1.32.2/work/zoneminder-1.32.2/src/zm_image.h:158:25: error: ‘AVFrame’ does not name a type
   explicit Image( const AVFrame *frame );
                         ^~~~~~~
make[2]: *** [src/CMakeFiles/zm.dir/build.make:111: src/CMakeFiles/zm.dir/zm_camera.cpp.o] Error 1


I guess I'll start following some of the other leads in this thread, including pulling in some of the other ZM patches.

Any hints appreciated.

[Later]

D'oh! Never mind. USE=ffmpeg
Back to top
View user's profile Send private message
gkmac
Guru
Guru


Joined: 19 Jan 2003
Posts: 333
Location: West Sussex, UK

PostPosted: Tue Nov 06, 2018 10:17 pm    Post subject: Reply with quote

Had another bash after finding out what caused my playback controls to stop working. It turns out it uses semaphores which are not compiled into PHP by default, unless the sysvipc USE flag is set. Re-emerging PHP with this USE flag solves the problem for me.

A patch was merged to make it work properly without sysvipc so only the ebuild for this version should need PHP with that USE flag set, assuming the patch makes it into the next release.
therealjrd wrote:
Grabbed n3r0's 1.32.2 ebuild, but that doesn't compile for me. It claims

Code:

/var/tmp/portage/www-misc/zoneminder-1.32.2/work/zoneminder-1.32.2/src/zm_image.h:158:25: error: ‘AVFrame’ does not name a type
   explicit Image( const AVFrame *frame );
                         ^~~~~~~
make[2]: *** [src/CMakeFiles/zm.dir/build.make:111: src/CMakeFiles/zm.dir/zm_camera.cpp.o] Error 1

D'oh! Never mind. USE=ffmpeg

So it would appear that ffmpeg is a mandatory dependency now? The v1.34.0 roadmap does seem to mention removing support for no-ffmpeg.
_________________
If ~amd64 ebuilds are cutting edge, then git-9999 ebuilds are chainsaws.
"Not everyone can ride a unicycle, does that mean we should put another wheel on it?" - Lokheed
Back to top
View user's profile Send private message
therealjrd
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 120

PostPosted: Tue Nov 06, 2018 11:22 pm    Post subject: Reply with quote

gkmac wrote:

So it would appear that ffmpeg is a mandatory dependency now? The v1.34.0 roadmap does seem to mention removing support for no-ffmpeg.


Looks like it.

I've gotten a bit further. I was updating from DB version 1.30. zmupdate.pl flamed out partway through with

Code:

DBD::mysql::st execute failed: Data too long for column 'DefaultValue' at row 1 at /usr/lib64/perl5/vendor_perl/5.24.3/ZoneMinder/Config.pm line 260.
Can't execute: Data too long for column 'DefaultValue' at row 1 at /usr/bin/zmupdate.pl line 316.


I manually altered table Config to change DefaultValue to a varchar(256). That didn't fix it, so I bumped it up to 1024. That got past that problem, but then I encountered

Code:

ERROR 1142 (42000) at line 17: ALTER command denied to user 'zmuser'@'localhost' for table 'Monitors'


This appears to have failed all the updates in /usr/share/zoneminder/db/zm_update-1.31.0.sql. I ran those updates by hand, and fixed the permissions for the stock zm user.

Next: recompile php. Thanks for the hint gkmac.

Sorry about all the stream of conciousness, I figure the breadcrumbs might help somebody else in a similar situation.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Wed Nov 07, 2018 3:11 am    Post subject: Reply with quote

For versions where dev-lang/php[sysvipc] is mandatory for proper ZoneMinder operation, the ZoneMinder ebuild should use a USE dependency to declare this. That will cause Portage to require the user to fix this flag at install time, before the user has a chance to have ZoneMinder fail and require debugging.
Back to top
View user's profile Send private message
therealjrd
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 120

PostPosted: Wed Nov 07, 2018 1:12 pm    Post subject: Reply with quote

Epilogue: I'm now running ZM 1.32.2 with mysql-connector-c 6.1.11-r1 and mariadb 10.3.8. It all seems to be working fine (though the CPU load appears to be higher, I may have to give that VM some more cores)

I used the ebuild posted above, with the mod suggested by Hu to require dev-lang/php[ffmpeg]. As above, I had a few issues getting the DB migrated/upgraded, but nothing too egregious to get through.

I'm masking higher versions of these components, so I'll have a chance to proceed more cautiously when they show up.
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Sun Nov 11, 2018 8:23 pm    Post subject: Reply with quote

therealjrd wrote:
Epilogue: I'm now running ZM 1.32.2 with mysql-connector-c 6.1.11-r1 and mariadb 10.3.8. It all seems to be working fine (though the CPU load appears to be higher, I may have to give that VM some more cores)

I used the ebuild posted above, with the mod suggested by Hu to require dev-lang/php[ffmpeg]. As above, I had a few issues getting the DB migrated/upgraded, but nothing too egregious to get through.

I'm masking higher versions of these components, so I'll have a chance to proceed more cautiously when they show up.


Please post your final ebuild so others can benefit from your work.
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Sat Nov 17, 2018 3:47 pm    Post subject: Reply with quote

I just realized that even though it looks like recordings are being made, they don't play back... Has anyone see this?

I'm going to start digging in now, but I was hoping for a pointer from someone who had a similar problem.

I'm getting this warning:

Cannot write to content dirs('/var/lib/zoneminder/events','/var/lib/zoneminder/images'). Check that these exist and are owned by the web account user

/etc/zm.conf is in the apache group.

zm.conf points to a completely different directory for storing the events:

Code:
snip...
# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/usr/share/zoneminder

# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin

# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib64

# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc

# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www
# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/usr/share/zoneminder

# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin

# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib64

# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc

# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www
snip...


And the permissions on those folders are correct also...
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2060
Location: San Jose, CA

PostPosted: Sun Nov 18, 2018 9:54 pm    Post subject: Reply with quote

For those who are trying to figure this out. There is a file called *.conf (it can be anything, mine is called, 'zmcustom.conf') which contains overrides for zoneminder. The paths were set in that file and I updated them to the proper path and fixed the issue.

Code:
# These values were autogenerated by zmupdate.pl
# You may edit these values. ZoneMinder will not overwrite them.
#

ZM_PATH_ARP=/sbin/arp
ZM_DIR_EVENTS=/usr/share/zoneminder/www/events
ZM_DIR_IMAGES=/usr/share/zoneminder/www/images


However, I can't get the file structure to be deep. I've checked the storage settings. I even checked the msyql database setting. Everything is okay, but it's looking for my recordings in the wrong folder structure... It's looking in YYYY-MM-DD/ instead of YY/MM/DD/.
_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
Melsion
n00b
n00b


Joined: 01 Nov 2007
Posts: 34

PostPosted: Mon Nov 26, 2018 1:50 am    Post subject: Reply with quote

Raffi wrote:
It is possible to get zoneminder working with the latest mariadb, but you will not have a "normal" system when you are done.

To get all the blocks resolved, everything compiled and not segfaulting, I had to do the following

emerge -C virtual/libmysqlclient

I then had to modify the ebuild for dev-db/mariadb to allow it to depend on mariadb-connector-c[mysqlcomap]. I then had to modify dev-perl/DBD-mysql to do the same. DBD-mysql also needed a patch to properly compaile against mariadb-connector-c.

Looks like portage is really not yet ready to have mariadb-connector-c replace mysql-connector-c without quite a bit of work.


Could you explain how you did it? Or share the modified files? I don't have the expertise with portage and ebuilds to do it. Tried installing ZM 1.32.2 but it was a mess....
Back to top
View user's profile Send private message
shimitar
Guru
Guru


Joined: 23 Nov 2003
Posts: 320
Location: Italy, Torino

PostPosted: Thu Dec 13, 2018 7:48 am    Post subject: Reply with quote

Chipping in on this thread, i am working on installing ZoneMinder 1.32.3 now.

I have updated the ebuild, since one perl dependency was missing:

Code:

# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# TO DO:
# * dependencies of unknown status:
#       dev-perl/Device-SerialPort
#       dev-perl/MIME-Lite
#       dev-perl/MIME-tools
#       dev-perl/PHP-Serialization
#       virtual/perl-Archive-Tar
#       virtual/perl-libnet
#       virtual/perl-Module-Load

EAPI=6

inherit versionator perl-functions readme.gentoo-r1 cmake-utils depend.apache flag-o-matic systemd

MY_PN="ZoneMinder"

MY_CRUD_VERSION="3.1.0"

DESCRIPTION="Capture, analyse, record and monitor any cameras attached to your system"
HOMEPAGE="http://www.zoneminder.com/"
SRC_URI="
    https://github.com/${MY_PN}/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
    https://github.com/FriendsOfCake/crud/archive/v${MY_CRUD_VERSION}.tar.gz -> Crud-${MY_CRUD_VERSION}.tar.gz
"

LICENSE="GPL-2"
KEYWORDS="amd64"
IUSE="curl encode ffmpeg gcrypt gnutls +mmap +ssl libressl vlc"
SLOT="0"

REQUIRED_USE="
    || ( ssl gnutls )
"

DEPEND="
app-eselect/eselect-php[apache2]
dev-lang/perl:=
dev-lang/php:*[apache2,cgi,curl,gd,inifile,pdo,mysql,mysqli,sockets]
dev-libs/libpcre
dev-perl/Archive-Zip
dev-perl/Class-Std-Fast
dev-perl/Data-Dump
dev-perl/Date-Manip
dev-perl/Data-UUID
dev-perl/DBD-mysql
dev-perl/DBI
dev-perl/IO-Socket-Multicast
dev-perl/SOAP-WSDL
dev-perl/Sys-CPU
dev-perl/Sys-MemInfo
dev-perl/URI-Encode
dev-perl/libwww-perl
dev-perl/Number-Bytes-Human
dev-php/pecl-apcu:*
sys-auth/polkit
sys-libs/zlib
ffmpeg? ( virtual/ffmpeg )
encode? ( media-libs/libmp4v2 )
virtual/httpd-php:*
virtual/jpeg:0
virtual/mysql
virtual/perl-ExtUtils-MakeMaker
virtual/perl-Getopt-Long
virtual/perl-Sys-Syslog
virtual/perl-Time-HiRes
www-servers/apache
curl? ( net-misc/curl )
gcrypt? ( dev-libs/libgcrypt:0= )
gnutls? ( net-libs/gnutls )
mmap? ( dev-perl/Sys-Mmap )
ssl? (
    !libressl? ( dev-libs/openssl:0= )
    libressl? ( dev-libs/libressl:0= )
)
vlc? ( media-video/vlc[live] )
"
RDEPEND="${DEPEND}"

# we cannot use need_httpd_cgi here, since we need to setup permissions for the
# webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
need_apache

PATCHES=(
)

MY_ZM_WEBDIR=/usr/share/zoneminder/www

src_prepare() {
    cmake-utils_src_prepare

    rmdir "${S}/web/api/app/Plugin/Crud" || die
    mv "${WORKDIR}/crud-${MY_CRUD_VERSION}" "${S}/web/api/app/Plugin/Crud" || die
    rm "${WORKDIR}/${P}/conf.d/README" || die
}

src_configure() {
    append-cxxflags -D__STDC_CONSTANT_MACROS
    perl_set_version
    export TZ=UTC # bug 630470
    mycmakeargs=(
                -DZM_PERL_SUBPREFIX=${VENDOR_LIB#/usr}
                -DZM_TMPDIR=/var/tmp/zm
                -DZM_SOCKDIR=/var/run/zm
                -DZM_WEB_USER=apache
                -DZM_WEB_GROUP=apache
                -DZM_WEBDIR=${MY_ZM_WEBDIR}
                -DZM_NO_MMAP="$(usex mmap OFF ON)"
                -DZM_NO_X10=OFF
                -DZM_NO_FFMPEG="$(usex ffmpeg OFF ON)"
                -DZM_NO_CURL="$(usex curl OFF ON)"
                -DZM_NO_LIBVLC="$(usex vlc OFF ON)"
                -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL="$(usex ssl OFF ON)"
                -DHAVE_GNUTLS="$(usex gnutls ON OFF)"
                -DHAVE_GCRYPT="$(usex gcrypt ON OFF)"
        )

    cmake-utils_src_configure

}

src_install() {
    cmake-utils_src_install

    # the log directory
    keepdir /var/log/zm
    fowners apache:apache /var/log/zm

    # the logrotate script
    insinto /etc/logrotate.d
    newins distros/ubuntu1204/zoneminder.logrotate zoneminder

    # now we duplicate the work of zmlinkcontent.sh
    keepdir /var/lib/zoneminder /var/lib/zoneminder/images /var/lib/zoneminder/events /var/lib/zoneminder/api_tmp
    fperms -R 0775 /var/lib/zoneminder
    fowners -R apache:apache /var/lib/zoneminder
    dosym  /var/cache/zoneminder ${MY_ZM_WEBDIR}/cache
    dosym /var/lib/zoneminder/images ${MY_ZM_WEBDIR}/images
    dosym /var/lib/zoneminder/events ${MY_ZM_WEBDIR}/events
    dosym /var/lib/zoneminder/api_tmp ${MY_ZM_WEBDIR}/api/app/tmp

    # the cache directory
    keepdir /var/cache/zoneminder
    fowners apache:apache /var/cache/zoneminder

    # bug 523058
    keepdir ${MY_ZM_WEBDIR}/temp
    fowners -R apache:apache ${MY_ZM_WEBDIR}/temp

    # the configuration file
    fperms 0640 /etc/zm.conf
    fowners root:apache /etc/zm.conf

    # init scripts etc
    newinitd "${FILESDIR}"/init.d zoneminder
    newconfd "${FILESDIR}"/conf.d zoneminder

    # systemd unit file
    systemd_dounit "${FILESDIR}"/zoneminder.service

    cp "${FILESDIR}"/10_zoneminder.conf "${T}"/10_zoneminder.conf || die
    sed -i "${T}"/10_zoneminder.conf -e "s:%ZM_WEBDIR%:${MY_ZM_WEBDIR}:g" || die

    dodoc AUTHORS BUGS ChangeLog INSTALL NEWS README.md TODO "${T}"/10_zoneminder.conf

    perl_delete_packlist

    readme.gentoo_create_doc
}

pkg_postinst() {
    readme.gentoo_print_elog

    local v
    for v in ${REPLACING_VERSIONS}; do
                if ! version_is_at_least ${PV} ${v}; then
                        elog "You have upgraded zoneminder and may have to upgrade your database now using the 'zmupdate.pl' script."
                fi
        done
}



And i am still working on a web gui issue (seems "cache" folder is missing)

Edit: added missing cache symlink
_________________
Willy Gardiol
willy@gardiol.org


Last edited by shimitar on Fri Dec 14, 2018 7:08 am; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum