Motion-Project / motionplus

MotionPlus Home Page: https://motion-project.github.io/
GNU General Public License v3.0
319 stars 40 forks source link

Compile fails for me #146

Closed gene-git closed 6 months ago

gene-git commented 6 months ago

Did you read the guide?

Yes

What is the base version number of MotionPlus being used?

0.1.x

What was the install method?

Built from source code

What is base architecture?

x86/x64

What is the distro being used?

Other

Disto version number

Archlinux

Camera/Sound type(s) being used?

Network camera with RTSP

Describe the issue/problem and steps to reproduce

Compile as of commit 5d4a43ae64cf0ea8853837b91561e60e4810e115 fails for me:

...

g++ -DHAVE_CONFIG_H -I. -I..  -Dsysconfdir=\"/etc/motionplus\" -DLOCALEDIR=\"/usr/share/locale\" -D_THREAD_SAFE    -I/usr/include/p11-kit-1  -I/usr/include/webp  -I/usr/include/libcamera   -I/usr/include/mysql/   -D_REENTRANT    -W -O3 -Wall -Wextra -Wconversion -Wformat -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -ggdb -g3  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -std=c++17 -MT libcam.o -MD -MP -MF $depbase.Tpo -c -o libcam.o libcam.cpp &&\
mv -f $depbase.Tpo $depbase.Po

libcam.cpp: In member function ‘void cls_libcam::cam_config_orientation()’:
libcam.cpp:491:46: error: request for member ‘params_array’ in ‘((cls_libcam*)this)->cls_libcam::camctx->ctx_dev::libcam->cls_libcam::params’, which is of pointer type ‘ctx_params*’ (maybe you meant to use ‘->’ ?)
  491 |         p_lst *lst = &camctx->libcam->params.params_array;
      |                                              ^~~~~~~~~~~~
In file included from libcam.cpp:32:
libcam.cpp:515:43: error: ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} has no member named ‘cstr’; did you mean ‘c_str’?
  515 |                         , it->param_value.cstr());
      |                                           ^~~~
logger.hpp:55:76: note: in definition of macro ‘MOTPLS_LOG’
   55 |     #define MOTPLS_LOG(x, y, z, ...)  motpls_log(x, y, z, 1, __FUNCTION__, __VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
make[2]: *** [Makefile:495: libcam.o] Error 1

Compiler : gcc 13.2.1-6

Let me know if anything else I can do to help.

Relevant MotionPlus log output (at log_level 8)

N/A
Mr-Dave commented 6 months ago

I have to find a better development and testing platform....thanks for reporting I'll track it down.

gene-git commented 6 months ago

Thanks @Mr-Dave .

FYI, motionplus git head is in my daily build list and also gets tested (x86 with ip cams). So any little issues should show up pretty quickly on my end.

My build env is Arch fully updated from testing repo and the compile tool-chain is typically kept up to date - arch is good about things being current.

bitraid commented 6 months ago

I just saw this issue. I had already opened a PR with a fix.

gene-git commented 6 months ago

Thank you @bitraid.

gene-git commented 6 months ago

With cstr -> c_str, then I only see one complaint from compiler about possible use before set:

In function ‘void webu_mhd_deinit_counter(ctx_webui*)’,
    inlined from ‘void webu_mhd_deinit(void*, MHD_Connection*, void**, MHD_RequestTerminationCode)’ at webu.cpp:1051:28:
webu.cpp:1031:24: warning: ‘strm’ may be used uninitialized [-Wmaybe-uninitialized]
 1031 |             if ((strm->all_cnct == 0) &&
      |                  ~~~~~~^~~~~~~~
webu.cpp: In function ‘void webu_mhd_deinit(void*, MHD_Connection*, void**, MHD_RequestTerminationCode)’:
webu.cpp:978:22: note: ‘strm’ was declared here
  978 |     ctx_stream_data *strm;
      |                      ^~~~
depbase=`echo webu_file.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
Mr-Dave commented 6 months ago

I think this last one should be cleared up now.

gene-git commented 6 months ago

Looks good - Thank you.

FYI, for completeness, the only tiny, tiny thing I see now is:

g++ -DHAVE_CONFIG_H -I. -I..  -Dsysconfdir=\"/etc/motionplus\" -DLOCALEDIR=\"/usr/share/locale\" -D_THREAD_SAFE    -I/usr/include/p11-kit-1  -I/usr/include/webp  -I/usr/include/libcamera   -I/usr/include/mysql/   -D_REENTRANT    -W -O3 -Wall -Wextra -Wconversion -Wformat -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -ggdb -g3  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -std=c++17 -MT motionplus.o -MD -MP -MF $depbase.Tpo -c -o motionplus.o motionplus.cpp
 &&\
mv -f $depbase.Tpo $depbase.Po
logger.cpp: In function ‘void motpls_log(int, int, int, int, const char*, ...)’:
logger.cpp:198:23: warning: ignoring return value of ‘char* strerror_r(int, char*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  198 |             strerror_r(errno_save, buf + n, sizeof(buf) - n);    /* 2 for the ': ' */
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gene-git commented 6 months ago

Thank you