NS-3: module errors while building - simulator

I have problem in newest ns-3.26 with nsc-0.5.3 and gccxml-ns3 - system is very up-to-date so that's not the case.
Building nsc-0.5.3 - Problem
Problem: Optional dependency, module "nsc-0.5.3" failed
This may reduce the functionality of the final build. However, bake will continue since "nsc-0.5.3" is not an essential dependency. For more information call bake with -v or -vvv, for full verbose mode.

Found the solution - NSC doesn't work properly with gcc/g++-6 so I had to change default version of gcc and g++ (for example from 6.3.0 to 5.4.1)
1) Find installed compilers:
dpkg --list | grep compiler
2) Change default gcc, g++, cc and c++ (via https://askubuntu.com/questions/26498/choose-gcc-and-g-version):
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
Also, to check if changes are saved:
gcc -v
It should say: "gcc version 5.4.1" at the end.
After that, NSC was installed successfully.
It's worth mentioning that it didn't fix gccxml's problem, but in my case I needed NSC working so...

Related

AzerothCore build error: charconv file not found

On Ubuntu 18.04 tried both using clang 6 and clang 10, AzerothCore fails to build:
solution by polly
update to latest clang and cmake, also install gcc-10
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-10 g++-10

How to compile sqlite-1.0.1, which released 18 years ago

I want to study sqlite by reading its source code. I found sqlite-1.0.1 only contained 10,000+ lines code, maybe it is easy to read. But unfortunately, modern gcc cannot compile sqlite-1.0.1.
wget "https://www.sqlite.org/src/tarball/e8521fc1/SQLite-e8521fc1.tar.gz"
tar xzvf SQLite-e8521fc1.tar.gz
mkdir bld && cd bld
../SQLite-e8521fc1/configure --prefix=/opt/sqlite-1.0.1 --with-tcl=no
make
When I issued make, it reported
gcc -std=c89 -g -O2 -o lemon ../SQLite-e8521fc1/tool/lemon.c
In file included from ../SQLite-e8521fc1/tool/lemon.c:29:
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:4:2: #error "GCC no longer implements <varargs.h>."
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:5:2: #error "Revise your code to use <stdarg.h>."
I tried appending -std=c89 following gcc in Makefile, but it did not work.
I specially installed a old Fedora Core release 3 virtual machine to compile SQLite-1.0.1, but it looks like the gcc(gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)) within Fedora 3 is still too modern for the 18 years ago code.
I found a check in which <varargs.h> was replaced by <stdarg.h>, and the author said maybe he has used gcc to compile lemon.c in 1989.
Maybe a very old gcc or Linux (before 2000) can solve this problem, but how can I get that one?
I have modified the code of sqlite 1.0.1 and can now compile and run successfully on fedora 36 & MacOS 12.3. You can find this code on github. It can be compiled in docker as follows.(Note: You can also use gcc instead of clang)
docker pull fedora:36
docker run -dt --name f36 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined fedora:36
docker exec -it f36 bash
dnf update -y
dnf install -y ncurses git hostname clang diffutils readline-devel tcl-devel gdbm-devel
mkdir ~/src && cd ~/src
git clone https://github.com/ruomeng0x/sqlite.git
cd ~/src/sqlite
git checkout badcc1d968fdb7cf0ff5d89468248468b8329f4e
mkdir ../build && cd ../build
CC=clang CFLAGS="-std=c89" bash ../sqlite/configure
make

Compile using GCC 6.3 on QT 5.7 Ubuntu

I want to use c++14 features so I wanted to use the GCC 6.3 compiler.
I've done the list of commands found here
Afterwards, I created a new kit, and used the newly installed xg++ compiler here's the compiler description and added the following in my .pro CONFIG += c++11 c++14
Still the compiler doesn't recognize strings/cout/endl and can't use auto for automatic return type deduction. Also, the binary literals are not recognized.
what I am missing here?
It turns out that it's a bug in Qt Creator not switching to use the given compiler by providing its path in the kit. However, I executed the following steps from terminal:
// Update & Build Essentials & add ppa of the gcc & update again
$ sudo apt-get update
$ sudo apt-get install build-essential software-properties-common -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y // ppa of gcc 6.3
$ sudo apt-get update
$ sudo apt-get install gcc-snapshot -y
$ sudo apt-get update
// Install the gcc and Add the gcc as an alternative
$ sudo apt-get install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
// You can switch the gcc verions via
$ sudo update-alternatives --config gcc
and made an alternative to my existing GCC. Once I restored the default kit of Qt creator and set the default GCC to 6.3 instead of 4.8, I was able to run C++14 features with ease provided that
CONFIG += c++14 is in the .pro.

Build error in OpenWRT

I followed the following steps given on the OpenWrt website to setup the OpenWrt build system.
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev
git clone https://github.com/openwrt/openwrt.git
git clone -b chaos_calmer git://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
I made the necessary changes in the configuration file and ran the make command. It gives the following error: make: *** [world] Error 1
Any solutions?
use following command options to know the exact error you are getting
make -j1 V=s
Sometimes due to slow internet speed(while fetching package source code for openwrt) or due to less RAM availability or wrong configuration leads to this error. Post the error message block you are getting, to understand more about the problem.
Please, follow up the following prerequisities:
https://wiki.openwrt.org/doc/howto/buildroot.exigence
Take a look especially at the table "Table of known prerequisites and their corresponding packages".
You have to install version7 of gcc and g++ so Try this:
sudo apt install gcc-7 g++-7 build-essential
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7

Install therubyracer on OSX

I have a fresh install of ruby 2.1.1, a clean set of gem and I reinstalled V8 with homebrew but I get this 'unrecognized command line option' error.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/jspooner/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling accessor.cc
g++: error: unrecognized command line option '-rdynamic'
make: *** [accessor.o] Error 1
make failed, exit code 2
g++ version
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.3/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/lto-wrapper
Target: x86_64-apple-darwin13.2.0
Configured with: ../configure --build=x86_64-apple-darwin13.2.0 --prefix=/usr/local/Cellar/gcc/4.8.3 --enable-languages=c,c++,objc,obj-c++,fortran --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 4.8.3 (GCC)
if Ubuntu users having this situation (e.g.: on a Ubuntu VM)
gem install therubyracer -v '0.11.4'
\Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/home/deploy/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile
make "DESTDIR="
compiling accessor.cc
make: g++: Command not found
make: *** [accessor.o] Error 127
Gem files will remain installed in /home/deploy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4 for inspection.
Results logged to /home/deploy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4/ext/v8/gem_make.out
Ubuntu solution:
sudo apt-get install build-essential g++
I had to run brew update gcc.
brew upgrade gcc
==> Upgrading 1 outdated package, with result:
gcc 4.9.1
==> Upgrading gcc
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gcc-4.9.1.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring gcc-4.9.1.mavericks.bottle.2.tar.gz
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
🍺 /usr/local/Cellar/gcc/4.9.1: 1152 files, 203M
Changing the symbolic link of g++ and gcc worked for me on Mac OS 10.10.
ls -al /opt/local/bin/gcc
ls -al /opt/local/bin/g++
sudo rm /opt/local/bin/gcc
sudo rm /opt/local/bin/g++
sudo ln -s /usr/bin/llvm-gcc /opt/local/bin/gcc
sudo ln -s /usr/bin/llvm-g++ /opt/local/bin/g++
gem install therubyracer -v '0.12.1'
sudo rm /opt/local/bin/g++
sudo rm /opt/local/bin/gcc
sudo ln -s /opt/local/bin/g++-mp-4.9 /opt/local/bin/g++
sudo ln -s /opt/local/bin/gcc-mp-4.9 /opt/local/bin/gcc

Resources