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

compile error with gcc 11 #5

Closed
fedefava86 opened this issue Jan 15, 2024 · 0 comments · Fixed by #6
Closed

compile error with gcc 11 #5

fedefava86 opened this issue Jan 15, 2024 · 0 comments · Fixed by #6
Assignees

Comments

@fedefava86
Copy link
Contributor

Compiling on Ubuntu 22.04 LTS gives an error (actually, a warning transformed to error due to Werror flag)

Host/ns-2.34/trace -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/adc -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/apps -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/routing -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/tools -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/classifier -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/mcast -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/diffusion3/lib -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/diffusion3/lib/main -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/diffusion3/lib/nr -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/diffusion3/ns -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/diffusion3/filter_core -I/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/ns-2.34/asim -Wall -Werror -I../nsmiracle -I../ip -I../mphy -I../mmac -I../routing -I../mobility -Wno-write-strings -MT libMiracleAodv_la-aodv-tracer.lo -MD -MP -MF .deps/libMiracleAodv_la-aodv-tracer.Tpo -c aodv-tracer.cc  -fPIC -DPIC -o .libs/libMiracleAodv_la-aodv-tracer.o
aodv-tracer.cc: In member function ‘virtual void MrclAodvTracer::format(Packet*, SAP*)’:
aodv-tracer.cc:116:41: error: ‘%s’ directive writing up to 287 bytes into a region of size 44 [-Werror=format-overflow=]
  116 |                 sprintf(pktinfo, "RREP s%s d%s sno%d hc%d", saddr, daddr, rp->rp_dst_seqno, rp->rp_hop_count);
      |                                         ^~                  ~~~~~
aodv-tracer.cc:116:24: note: ‘sprintf’ output between 18 and 605 bytes into a destination of size 50
  116 |                 sprintf(pktinfo, "RREP s%s d%s sno%d hc%d", saddr, daddr, rp->rp_dst_seqno, rp->rp_hop_count);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aodv-tracer.cc:85:41: error: ‘%s’ directive writing up to 287 bytes into a region of size 44 [-Werror=format-overflow=]
   85 |                 sprintf(pktinfo, "RREQ s%s d%s id%d hc%d ", saddr, daddr, rq->rq_bcast_id, rq->rq_hop_count);
      |                                         ^~                  ~~~~~
aodv-tracer.cc:85:24: note: ‘sprintf’ output between 18 and 605 bytes into a destination of size 50
   85 |                 sprintf(pktinfo, "RREQ s%s d%s id%d hc%d ", saddr, daddr, rq->rq_bcast_id, rq->rq_hop_count);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:767: libMiracleAodv_la-aodv-tracer.lo] Error 1
make[3]: Leaving directory '/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/nsmiracle-1.1.3/aodv'
make[2]: *** [Makefile:800: all-recursive] Error 1
make[2]: Leaving directory '/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/nsmiracle-1.1.3/aodv'
make[1]: *** [Makefile:632: all] Error 2
make[1]: Leaving directory '/home/federico/work/uwsignet/DESERT_Underwater_private/DESERT_buildCopy_LOCAL/.buildHost/nsmiracle-1.1.3/aodv'
make: *** [Makefile:450: all-recursive] Error 1
ERROR: EXIT FROM THE INSTALLATION PROCEDURE!

Used gcc is

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --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-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

@MetalKnight MetalKnight linked a pull request Jan 16, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants