CM.make cannot find file "smlnj-lib.cm" - sml

When I try to use smlnj-lib.cm in a .cm file, I get this error:
I installed SML/NJ using Homebrew on MAC OS X 10.14.2. /usr/local/smlnj/bin is in .bash_profile, .bash_profile is updated.
sources.cm file:
Group is
driver.sml
errormsg.sml
tokens.sig
tokens.sml
tiger.lex
smlnj-lib.cm
I try to run it:
CM.make "sources.cm";
And get this error:
sources.cm:8.1-8.13 Error: Io: openIn failed on "smlnj-lib.cm", No such file or directory

If i recall, you are using the old compilation manager format, in the new compilation manager
cm files which should be looked up relative to the standard ML installation directories should be prefixed by $/dir where smlnj-lib.cm exists in the root.
directories without such a prefix will be looked up relative to the current directory.
such as
Group is
driver.sml
...
$/smlnj-lib.cm

Related

How to get Rcpp to include the right header file path

I was trying to run a simple testing C++ file in my R package development directory with Rcpp located at say the directory "my_R_package_dir/src/my_file_location.cpp":
#include <Rcpp.h>
// [[Rcpp::export]]
int plusone() {
return 1 + 1;
}
But when running Rcpp::sourceCpp("src/my_file_location.cpp") the R console gives the following warning:
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Users/myself/my_R_package_dir/src/../inst/include": file not found
The function exported plusone() did work, but I can see clearly that its for some reason trying to access a non-existent file named "include" in the "inst" directory which I do have. I'm guessing it wants to access the Rcpp.h file but I probably need to somehow indicate it the path to point at? How do I do that?
P.S. This also causes the package build to fail and part of the message also indicates that theres no such file or directory Rcpp.h.
I thought I needed a Makevars.win and Makevars file, and I put them both into src and they look like this:
PKG_CPPFLAGS=`Rscript -e 'Rcpp:::CxxFlags()'`
PKG_LIBS=`Rscript -e 'Rcpp:::LdFlags()'`
CC=C:\msys64\mingw64\bin\g++.exe
CXX=C:\msys64\mingw64\bin\gcc.exe
But with no avail. I am on a windows device with Rtools 4.3, gcc, and g++.

Legato-AF platform [ Can’t find dependent .api file: ‘le_mdc.api’ ]

In Legato-af (legato) environment:
*Linux Ubuntu
*Sierra Wireless WP76xx and WP77xx target
*Legato shell (lsh:wp76stable)
I'm getting the following response:
(lsh:wp76stable) error: Can't find dependent .api file: 'le_mdc.api'
The same error is in wp77stable profile.
The error "Can't find dependent .api file: 'le_mdc.api'" typically occurs when the Legato build system is unable to find a required API file. This can be caused by a number of issues, such as:
The API file is not present in the expected location.
Make sure that the API file is located in the correct directory and is spelled correctly.
The API file is not included in the build.
Make sure that the API file is included in the build by adding it to the appropriate component.cdef or app.cdef file.
There is a problem with the build system configuration.
Make sure that the build system is properly configured and that all required dependencies are specified.
API file
$LEGATO_ROOT/interfaces/le_data.api
is referencing
$LEGATO_ROOT/interfaces/modemServices/le_mdc.api
what is the source of the problem.
What worked for me was a simple copy of le_mdc.api
into the same folder with le_data.api

Protoc Output Directory Issue - No Such File or Directory

I recently finished the basic tutorial for C++ here and wanted to set up a project based on the proto files from here. I followed a similar directory structure as the tutorial and changed up the CMakeLists.txt file to accommodate the new files.
I'm currently trying to just compile the manager.proto file. I was able to compile the file and get my server/client files, however the files are being outputted within cmake/build/minknow_api rather than the expected cmake/build folder. This meant the make command would return the error:
clang: error: no such file or directory: '/Users/name/Documents/grpc/examples/cpp/minknow_api/cmake/build/manager.grpc.pb.cc'
clang: error: no input files
I read that it was because protoc outputs based on the imports of the proto file, i.e the file comes with import minknow_api/device.proto for instance. I copied the files from within the cmake/build/minknow_api into cmake/build/ and reran make and it seemed to work, however, the C++ file imports as expected are searching within a minknow_api directory, meaning I'd have to manually edit these imports to look within the current directory instead of to then compile successfully.
I've tried experimenting with trying to get rid of the minknow_api from the proto imports, however had no luck and only got more import issues during compilation. It seems some files have the same names for messages etc, which means I had to keep the minknow.somename as the package so I can thus distinguish in the files which imported values I wanted to access. I've also tried moving files into their own directories like instance.proto which has package minknow.instance would go inside of instance directory, but still no luck.
I was wondering if anyone could figure out how to get rid of the minknow_api out of my proto imports properly so that I won't get these import and output directory issues down the track?

Debugging C in Eclipse - "Can't find source file"

I've installed Eclipse for C/C++ Developer and cygwin, following this guide. Also, in Preferences > C/C++ > Enviroment, I added all variables. I mounted /c to c: in cygwin, and now when I type mount in the terminal I get the following:
$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /c type ntfs (binary,user)
My program builds and runs successfully in Eclipse, but when I try to debug (adding a breakpoint on the first line), I get the error:
Can't find a source file at "/cygdrive/c/Users/steve/eclipse-workspace/myProgram/myProgram.c"
Locate the file or edit the source lookup path to include its location.
I then found this guide to deal with this error, so that my Path Mapping was /cygdrive/c C:\
However, I now get the following error when trying to debug:
Can't find a source file at "/usr/src/debug/gcc-7.4.0-1/libgcc/config/i386/cygwin.S"
Locate the file or edit the source lookup path to include its location.
I don't know where to go from here, could anyone help me out?

"unsupported/Eigen/CXX11/Tensor: No such file or directory" while working with TensorFlow

I'm trying to use tensorflow as a external library in my C++ application (mainly following this tutorial). What I done so far:
I have cloned the tensorflow reporitory (let's say, that the repo root dir is $TENSORFLOW)
Run /.configure (which all settings default, so no CUDA, no OpenCL etc.).
Build shared library with bazel build -c /opt //tensorflow:libtensorflow_cc.so (build completed successfully)
Now I'm trying to #include "tensorflow/core/public/session.h". But after including it (and adding $TENSORFLOW and $TENSORFLOW/bazel-genfiles to include path), I'm receiving error:
$TENSORFLOW/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42:
fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory
There is a github issue created for similar problem, but it's marked as closed without any solution provided. Also I tried with master branch as well as v.1.4.0 release.
Do you happen to know, what could cause this kind of problem and how to deal with it?
I (and many others) agonized over the same problem. It probably can be solved using bazel but I don't know that tool well enough and now I solve this using make. The source of confusion is that a file named Tensor is included and it itself includes a file named Tensor, which has caused some people to wrongly conclude Tensor is including itself.
If you built and installed the python .whl file there will be a tensorflow directory in dist-packages and an include directory below that, e.g. on my system:
/usr/local/lib/python2.7/dist-packages/tensorflow/include
From the include directory
find . -type f -name 'Tensor' -print
./third_party/eigen3/unsupported/Eigen/CXX11/Tensor
./external/eigen_archive/unsupported/Eigen/CXX11/Tensor
The first one has
#include "unsupported/Eigen/CXX11/Tensor"
and the file that should satisfy this is the second one.
So to compile session.cc that includes session.h, the following will work
INC_TENS1=/usr/local/lib/python2.7/dist-packages/tensorflow/include/
INC_TENS2=${INC_TENS1}external/eigen_archive/
gcc -c -std=c++11 -I $INC_TENS1 -I $INC_TENS2 session.cc
I've seen claims that you must build apps from the tensorflow tree and you must use bazel. However, I believe all the header files you need are in dist-packages/tensorflow/include and at least for starters you can construct makefile or cmake projects.
Slightly off-topic, but I had the same error with a C++ project using opencv-4.5.5 and compiled with Visual Studio (no problem with opencv-4.3.0, and no problem with MinGW).
To make it work, I had to add to my root CMakeLists.txt:
add_definitions(-DOPENCV_DISABLE_EIGEN_TENSOR_SUPPORT)
If that can help someone...
the problem was actually in the relative path of the header file taken in the Tensor file.
installed path for Tensor is /usr/include/eigen3/unsupported/Eigen/CXX11/Tensor
but mentioned in the Tensor file is "unsupported/Eigen/CXX11/Tensor"
So there should be an entry upto /usr/include/eigen3/ in the project path to run this correctly so that it can be used.