asm/socket.h: No such file or directory cross compiling Dart for Raspberry pi - dart

I'm cross-compiling the Dart runtime using the instruction here.
I've installed all the dependencies as specified. I've also cloned the git repository with the necessary tool chain.
I'm running the runtime compilation with this command:
./tools/build.py -m release -a arm --toolchain=../tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf runtime
The compilation starts with no problem then it stops with this error:
LINK(target) out/ReleaseXARM/libdart_dependency_helper.target
CXX(host) out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o
In file included from /usr/include/sys/socket.h:38:0,
from /usr/include/netinet/in.h:23,
from /usr/include/arpa/inet.h:22,
from runtime/platform/globals.h:56,
from runtime/platform/assert.h:16,
from runtime/vm/allocation.h:8,
from runtime/vm/bootstrap.h:9,
from runtime/vm/bootstrap.cc:5:
/usr/include/bits/socket.h:345:24: fatal error: asm/socket.h: No such file or directory
#include <asm/socket.h>
^
compilation terminated.
CXX(host) out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o
In file included from /usr/include/sys/socket.h:38:0,
from /usr/include/netinet/in.h:23,
from /usr/include/arpa/inet.h:22,
from runtime/platform/globals.h:56,
from runtime/platform/assert.h:16,
from runtime/vm/allocation.h:8,
from runtime/vm/bootstrap.h:9,
from out/ReleaseXARM/obj/gen/async_gen.cc:5:
/usr/include/bits/socket.h:345:24: fatal error: asm/socket.h: No such file or directory
#include <asm/socket.h>
^
compilation terminated.
runtime/libdart_lib_withcore.host.mk:978: recipe for target 'out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o' failed
make: *** [out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o] Error 1
make: *** Waiting for unfinished jobs....
runtime/libdart_lib_withcore.host.mk:986: recipe for target 'out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o' failed
make: *** [out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o] Error 1
BUILD FAILED
Am I missing any dependency or package?

I hit the same problem. On my ubuntu 14.04 system /usr/include/asm didn't exist. It was called asm-generic instead. I sym-linked it and the build was able to continue.
cd /usr/include
sudo ln -s asm-generic/ asm
The build was able to continue after that.

This is probably because you're trying to build an application without some of the include paths correctly set, for example using a 32-bit gcc on a 64-bit platform.
To resolve:
sudo apt-get install gcc-multilib

I'm not sure why this happens, but sometimes /usr/include/asm gets deleted. My teammates who looked at their Ubuntu x86-64 workstations found that the asm symlink was:
0 lrwxrwxrwx 1 root root 20 May 22 2013 /usr/include/asm -> x86_64-linux-gnu/asm
And the command to recreate it is:
$ cd /usr/include
$ sudo ln -s x86_64-linux-gnu/asm asm
The files in /usr/include/asm-generic are sometimes, but not always, equivalent to the files in the x86-64 specific directory; so it's difficult to recommend symlinking it as a workaround.

Related

Make does not detect opencv_contrib even though I have it installed

I am trying to get this running https://github.com/Katou2/Optical_Flow_GPU_Opencv3 but am facing an issue where make does not detect my opencv_contrib module. Here are the steps that I have done up till cmake.
conda create -n opticalflow python=3.6 anaconda
conda activate opticalflow
git clone https://github.com/Katou2/Optical_Flow_GPU_Opencv3
cd Optical_Flow_GPU_Opencv3
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -D BUILD_TIFF=ON ..
And this is the output that I get with no error.
-- version: 4.2.0
-- OPENCV include: /home/haziq/anaconda3/pkgs/libopencv-4.2.0-py36_3/include/opencv4
-- OPENCV libs dir:
-- OPENCV libs: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_cvvopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hdfopencv_hfsopencv_img_hashopencv_line_descriptoropencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_regopencv_rgbdopencv_saliencyopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphoto
-- Configuring done
-- Generating done
-- Build files have been written to: /home/haziq/Optical_Flow_GPU_Opencv3/build
The problem comes when I run make.
Scanning dependencies of target compute_flow_autogen
[ 25%] Automatic MOC for target compute_flow
[ 25%] Built target compute_flow_autogen
Scanning dependencies of target compute_flow
[ 50%] Building CXX object CMakeFiles/compute_flow.dir/compute_flow.o
/home/haziq/Optical_Flow_GPU_Opencv3/compute_flow.cpp:38:10: fatal error: opencv2/cudaoptflow.hpp: No such file or directory
#include "opencv2/cudaoptflow.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/compute_flow.dir/build.make:62: recipe for target 'CMakeFiles/compute_flow.dir/compute_flow.o' failed
make[2]: *** [CMakeFiles/compute_flow.dir/compute_flow.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/compute_flow.dir/all' failed
make[1]: *** [CMakeFiles/compute_flow.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
So the error mentions that the file opencv2/cudaoptflow.hpp is not found and I read through https://github.com/open-mmlab/mmaction/issues/39 says that the error is due to the opencv_contrib module not having been installed. However, I am certain that I already have opencv_contrib installed because I have this command executed.
pip install opencv-contrib-python
and have also verified it as I am able to call the cv2.xfeatures2d method which requires opencv_contrib to run.
import cv2
help(cv2.xfeatures2d) # cv2.xfeatures2d requires opencv_contrib

Cannot compile Open CV on Ubuntu 18.04 because of jasper.h not found

I am trying to compile Opencv on Ubuntu 18.04. I installed many dependencies packages but when I run make I get the error:
grfmt_jpeg2000.cpp:59:10: fatal error: jasper/jasper.h: No such file or directory
#include <jasper/jasper.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
I had already jasper installed and installed libjasperreports-java. However the file jasper.h cannot still be found in my system. Is there any library I can install with apt install to get that file? Or am I missing any other library?
EDIT 1
I tried also downloading the opencv_contrib to install extra moduels of openCV but first of all jaspar is not present and secondly setting the build with
cmake -D CMAKE_INSTALL_PREFIX=./ -D CMAKE_BUILD_TYPE=Debug -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ../openCV
returns the error:
Make Error at cmake/OpenCVModule.cmake:352 (message):
Duplicated modules NAMES has been found
while CMakeError.log contains many errors of the type:
Build output check failed:
Regex: 'command line option .* is valid for .* but not for C\+\+'
Output line: 'cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++'

TinyOS not compiling/uploading to TelosB mote

I'm running into a problem attempting to upload the "blink" app onto the motes. I can't seem to run the command make telosb reinstall bsl,/dev/ttUSB0 or make telosb reinstall while in the apps/Blink directory, which is preventing me from moving on with my project. I've tried as a user, superuser, and as root. I've outlined below the responses from variable commands. [Running Ubuntu 16.04, TinyOS 2.1.2, ncc version 1.4.2, nescc version 1.3.6]
(A)With root and the make telosb command I get back:
mkdir -p build/telosb
compiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"root\" -DIDENT_HOSTNAME=\"liam-Latitude-E\" -DIDENT_USERHASH=0x9236fe46L -DIDENT_TIMESTAMP=0x59384a62L -DIDENT_UIDHASH=0xdc08609fL BlinkAppC.nc -lm
compiled BlinkAppC to build/telosb/main.exe
2538 bytes in ROM
56 bytes in RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
writing TOS image
(B)With regular user and the make telosb command I get back:
mkdir -p build/telosb
/bin/sh: 1: cannot create build/telosb/ident_flags.txt: Permission denied
/home/liam/tinyos-main/support/make/ident_flags.extra:13: recipe for target 'ident_cache' failed
make: *** [ident_cache] Error 2
(C)With a super user and the sudo make telosb command I get back:
make: *** No rule to make target 'telosb'. Stop.
(D)With root and the make telosb reinstall command I get back:
cp build/telosb/main.ihex build/telosb/main.ihex.out
found mote on /dev/ttyUSB0 (using bsl,auto)
installing telosb binary using bsl
tos-bsl --telosb -c /dev/ttyUSB0 -r -e -I -p build/telosb/main.ihex.out
MSP430 Bootstrap Loader Version: 1.39-goodfet-8
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
MSP430 Bootstrap Loader Version: 1.39-goodfet-8
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Traceback (most recent call last):
File "/usr/bin/tos-bsl", line 1918, in <module>
main(0);
File "/usr/bin/tos-bsl", line 1843, in main
speed=speed,
File "/usr/bin/tos-bsl", line 1218, in actionStartBSL
self.actionChangeBaudrate(speed) #change baudrate
File "/usr/bin/tos-bsl", line 1345, in actionChangeBaudrate
self.serialport.setBaudrate(baudrate)
AttributeError: 'Serial' object has no attribute 'setBaudrate'
/home/liam/tinyos-main/support/make/msp/bsl.extra:45: recipe for target 'program' failed
make: *** [program] Error 1
(E)Whereas with a regular user and make telosb reinstall I get back:
cp build/telosb/main.ihex build/telosb/main.ihex.out
cp: cannot create regular file 'build/telosb/main.ihex.out': Permission denied
/home/liam/tinyos-main/support/make/msp/msp.rules:92: recipe for target 'setid' failed
make: *** [setid] Error 1
I have been all over the internet and online forums and haven't found a fix yet. I researched around (D) and found that perhaps python 2 might have changed the name of 'setBaudRate' variable. I'm not sure how to change that either.
Thank you for your time and help!
edit: added ncc and nescc versions.
This stack overflow answer is applicable to TinyOS.
So it turns out that pyserial 3.0.1 is not compatible with the TinyOS app, Blink. I'm fairly certain that pyserial 3.0.1 came with the package for TinyOS. To fix this, use the command sudo pip install "pySerial>=2.0,<=2.99999". For me, it kicked back:
The directory '/home/liam/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/liam/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pySerial<=2.99999,>=2.0
Installing collected packages: pySerial
Found existing installation: pyserial 3.0.1
DEPRECATION: Uninstalling a distutils installed project (pySerial) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyserial-3.0.1:
Successfully uninstalled pyserial-3.0.1
Successfully installed pySerial-2.7
But the blink app still uploaded and worked fine.

ERROR while code coverage report using lcov

I am trying to run coverage on my project, after updating to Ubuntu 16.04.
I get
Deleted 665 files
Writing data to coverage.info.cleaned
lcov: ERROR: cannot write to coverage.info.cleaned!
CMakeFiles/coverage.dir/build.make:57: recipe for target 'CMakeFiles/coverage' failed
make[3]: *** [CMakeFiles/coverage] Error 13
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/coverage.dir/all' failed
make[2]: *** [CMakeFiles/coverage.dir/all] Error 2
CMakeFiles/Makefile2:74: recipe for target 'CMakeFiles/coverage.dir/rule' failed
make[1]: *** [CMakeFiles/coverage.dir/rule] Error 2
Makefile:129: recipe for target 'coverage' failed
make: *** [coverage] Error 2
enter code here
Before the update I had no problem running the coverage
Does it help if you use absolute paths instead of relative paths when passing files to lcov?
I ran into a similiar problem where lcov also failed to write the file.
Not sure if it is a bug in lcov, but the problem was that it got confused with relative paths:
lcov -a test_fast_cxxtest_gcov__base.info -a test_fast_cxxtest_gcov__test.info \
-o test_fast_cxxtest_gcov__total.info
Combining tracefiles.
Reading tracefile test_fast_cxxtest_gcov__base.info
Reading tracefile test_fast_cxxtest_gcov__test.info
lcov: WARNING: function data mismatch at /home/phil/ghost/constants.h:1862
Writing data to test_fast_cxxtest_gcov__total.info
lcov: ERROR: cannot write to test_fast_cxxtest_gcov__total.info!
Running it with strace revealed that it executes chdir("/") on several locations, which changes the working directory to /. That explains why it cannot write the file.
One workaround is to use absolute paths. For instance, if you are using GNU make, you can use the abspath command:
lcov -a $(abspath test_fast_cxxtest_gcov__base.info) \
-a $(abspath test_fast_cxxtest_gcov__test.info) \
-o $(abspath test_fast_cxxtest_gcov__total.info)
After that change, it was finally able to write the file.
(Other options like trying to set the directories using the --base-directory or --directory option did not have an effect, as far as I saw.
The version of lcov that I tested with is 1.12.)
The problem is not limited to Ubuntu, as I ran into it on Arch Linux. It could be a regression introduced in 1.12, however, so I reported it (see issue #77630).
Update: Lcov is not part of GCC, so my original bug report was closed, but I got an answer from the Lcov mailing list. The problem is already fixed in commit 632c25. Users of Arch Linux based distros can try the latest snapshot with aur/lcov-git.

Errors due to vowpal wabbit's dependencies on boost library

I'm trying real hard to install vowpal wobbit and it fails when i run the make file, throwing:
cd library; make; cd ..
g++ -g -o ezexample temp2.cc -L ../vowpalwabbit -l vw -l allreduce -l boost_program_options -l z -l pthread
ld: library not found for -lboost_program_options collect2: ld returned 1 exit status make[1]: *** [ezexample] Error 1'
I then added the links to the boost library here by specifying -L/usr/local/lib
Now I get the following error:
g++ -g -o ezexample temp2.cc -L/usr/local/lib ../vowpalwabbit -l vw -l allreduce -l boost_program_options -l z -l pthread
ld: library not found for -lvw
collect2: ld returned 1 exit status
make: *** [ezexample] Error 1
I happened to get everything working on OS X 10.7 as follows:
Make sure you have a working Boost installation. As indicated on the Getting started page, usually we only need header files, but some Boost libraries must be built separately, including the program_options library which is used to process options from command line or config file. Go into your boost folder, and then at your shell prompt:
$ ./bootstrap.sh
$ ./bjam
This will compile and build everything. You should now have a bin.v2/ directory in your boost directory, with all built libraries for your system (static and threaded libs).
$ ls bin.v2/libs/
date_time iostreams python serialization test
filesystem math random signals thread
graph program_options regex system wave
More importantly, extra Boost libraries are made available in the stage/lib/ directory. For me, these are Mach-O 64-bit dynamically linked shared library x86_64.
The include path should be your_install_dir/boost_x_xx_x, where boost_x_xx_x is the basename of your working Boost. (I personally have boost_1_46_1 in /usr/local/share/ and I symlinked it to /usr/local/share/boost to avoid having to remember version number.) The library path (for linking) should read your_install_dir/boost_x_xx_x/stage/lib. However, it might be best to symlink or copy (which is what I did) everything in usual place, i.e. /usr/local/include/boost for header files, and /usr/local/lib for libraries.
Edit the Makefile from the vowpal_wabbit directory, and change the include/library paths to reflect your current installation. The Makefile should look like this (first 12 lines):
COMPILER = g++
UNAME := $(shell uname)
ifeq ($(UNAME), FreeBSD)
LIBS = -l boost_program_options -l pthread -l z -l compat
BOOST_INCLUDE = /usr/local/include
BOOST_LIBRARY = /usr/local/lib
else
LIBS = -l boost_program_options -l pthread -l z
BOOST_INCLUDE = /usr/local/share/boost # change path to reflect yours
BOOST_LIBRARY = /usr/local/share/boost/stage/lib # idem
endif
Then, you are ready to compile vowpal_wabbit (make clean in case you already compiled it):
$ make
$ ./vw --version
6.1
$ make test
You can also install vowpal wabbit on OS X using brew:
brew install vowpal-wabbit
Or you can just install boost, and then install vw from the github repo.
brew install boost
For installation on CentOS 7 (6.5 perl version is too old for latest vw source code), I've found the instructions at http://wkoplitz.blogspot.be/2012/12/vowpal-wabbit-on-centos.html to work fine:
yum install zlib-devel boost-devel
yum groupinstall "Development Tools"
git clone git://github.com/JohnLangford/vowpal_wabbit.git
cd vowpal_wabbit
./autogen.sh
make
make test
Good news:
As of the latest release VowpalWabbit version 9.1.0, vw no longer relies on Boost program_options
From the release highlights:
Removal of Boost Program Options dependency
For a long time we have depended on Boost Program Options
for command line options parsing. In this release, we have > replaced this dependency with our own implementation of
command line parsing. Apart from one place where we depend > on Boost Math in standalone mode, this means that VW core
and the command line tool are free of Boost dependencies
hopefully making the code a bit easier to build and package.
Vowpal Wabbit 9.1.0 release notes

Resources