Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure #9

Open
CpuID opened this issue Sep 22, 2019 · 6 comments
Open

Build failure #9

CpuID opened this issue Sep 22, 2019 · 6 comments

Comments

@CpuID
Copy link

CpuID commented Sep 22, 2019

Hi there,

Has anyone come across this so far...?

root@dev1:/tmp/work_dir/freeswitch/src/mod/endpoints/mod_wsbridge# make
  CC       mod_wsbridge_la-mod_wsbridge.lo
mod_wsbridge.c: In function 'wsbridge_callback_ws':
mod_wsbridge.c:682:5: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
     strncpy(bugfree_message + 1, dtmf_json_unformatted, size);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mod_wsbridge.c:677:12: note: length computed here
     size = strlen(dtmf_json_unformatted);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mod_wsbridge.c:422:3: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
   strncpy(bugfree_message + 1, message, size);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mod_wsbridge.c:419:10: note: length computed here
   size = strlen(message);
          ^~~~~~~~~~~~~~~
In function 'wsbridge_strncpy_null_term.part.7',
    inlined from 'wsbridge_strncpy_null_term' at mod_wsbridge.c:1702:13,
    inlined from 'channel_outgoing_channel' at mod_wsbridge.c:1469:4:
mod_wsbridge.c:1707:2: error: 'strncpy' specified bound 50 equals destination size [-Werror=stringop-truncation]
  strncpy(dst, src, len);
  ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:717: mod_wsbridge_la-mod_wsbridge.lo] Error 1

Some system details below:

root@dev1:/tmp/work_dir/freeswitch/src/mod/endpoints/mod_wsbridge# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6) 


root@dev1:/tmp/work_dir/freeswitch/src/mod/endpoints/mod_wsbridge# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Possibly some minor C tweaks required...? Or adjust some CFLAGS...?

@CpuID
Copy link
Author

CpuID commented Sep 22, 2019

Also, when I tried doing the build using the normal make module helpers, it claimed Unknown target mod_wsbridge which is weird... which is why I tried make from within the module directory itself above.

root@dev1:/tmp/work_dir/freeswitch# make mod_wsbridge-install
make[1]: Entering directory '/tmp/work_dir/freeswitch'
 /bin/mkdir -p '/usr/local/freeswitch/lib'
 /bin/bash /tmp/work_dir/freeswitch/libtool   --mode=install /usr/bin/install -c   libfreeswitch.la '/usr/local/freeswitch/lib'
libtool: install: /usr/bin/install -c .libs/libfreeswitch.so.1.0.0 /usr/local/freeswitch/lib/libfreeswitch.so.1.0.0
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so.1 || { rm -f libfreeswitch.so.1 && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so.1; }; })
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so || { rm -f libfreeswitch.so && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so; }; })
libtool: install: /usr/bin/install -c .libs/libfreeswitch.lai /usr/local/freeswitch/lib/libfreeswitch.la
libtool: install: /usr/bin/install -c .libs/libfreeswitch.a /usr/local/freeswitch/lib/libfreeswitch.a
libtool: install: chmod 644 /usr/local/freeswitch/lib/libfreeswitch.a
libtool: install: ranlib /usr/local/freeswitch/lib/libfreeswitch.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/freeswitch/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/freeswitch/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[1]: Leaving directory '/tmp/work_dir/freeswitch'
make[1]: Entering directory '/tmp/work_dir/freeswitch/src/mod'
make[2]: Entering directory '/tmp/work_dir/freeswitch/src/mod'
Unknown target mod_wsbridge-install
make[2]: *** [Makefile:744: mod_wsbridge-install-all] Error 1
make[2]: Leaving directory '/tmp/work_dir/freeswitch/src/mod'
make[1]: *** [Makefile:744: mod_wsbridge-install] Error 2
make[1]: Leaving directory '/tmp/work_dir/freeswitch/src/mod'
make: *** [Makefile:4355: mod_wsbridge-install] Error 2
root@dev1:/tmp/work_dir/freeswitch# make mod_wsbridge         
make[1]: Entering directory '/tmp/work_dir/freeswitch'
make  libfreeswitch.la
make[2]: Entering directory '/tmp/work_dir/freeswitch'
make[2]: Leaving directory '/tmp/work_dir/freeswitch'
make[1]: Leaving directory '/tmp/work_dir/freeswitch'
make[1]: Entering directory '/tmp/work_dir/freeswitch/src/mod'
make[2]: Entering directory '/tmp/work_dir/freeswitch/src/mod'
Unknown target mod_wsbridge
make[2]: *** [Makefile:744: mod_wsbridge-all] Error 1
make[2]: Leaving directory '/tmp/work_dir/freeswitch/src/mod'
make[1]: *** [Makefile:744: mod_wsbridge] Error 2
make[1]: Leaving directory '/tmp/work_dir/freeswitch/src/mod'
make: *** [Makefile:4355: mod_wsbridge] Error 2

@dragos-oancea
Copy link

The C compiler on Debian Buster does not like strncpy. You need to replace the statement with snprintf.
It builds just fine on older Debian 9.

@CpuID
Copy link
Author

CpuID commented Sep 22, 2019

Thx will give it a try. If it works I'll drop a patch somewhere for others.

@svh-pad
Copy link

svh-pad commented Jan 31, 2020

I have tried replacing strncpy with snprintf but get a very similar error. What seemed to work for me is disable the stringop-truncation check. So I ran

CFLAGS="-g -O2 -Wno-stringop-truncation" MOD_CFLAGS="-g -O2 -Wno-stringop-truncation"  ./configure

instead of just ./configure

@we-do-ai-admin
Copy link

@svh-pad

I have tried replacing strncpy with snprintf but get a very similar error. What seemed to work for me is disable the stringop-truncation check. So I ran

CFLAGS="-g -O2 -Wno-stringop-truncation" MOD_CFLAGS="-g -O2 -Wno-stringop-truncation"  ./configure

instead of just ./configure

where did you make the replacement?

@svh-pad
Copy link

svh-pad commented Aug 19, 2020

@we-do-ai-admin

where did you make the replacement?

It's been a while so I don't remember the details, sorry. To be honest as I'm looking at it now I wonder if it was the wsbridge module or if I ran into the error somewhere else (I remember having had difficulty compiling FreeTDM). What I did was look up the line numbers for which I saw the error and for each of those lines replace strncpy by the (what seemed to me) appropriate snprintf statement. As I mentioned I solved my issue by just turning off the warnings, I didn't feel confident I'd be able to fix the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants