Using gperftools with a Jetson TX1 dev kit - c++

I've been recommended gperftools to simply and quickly profile my code. Furthermore, the integration of -lprofiler was already done in the CMAKE of the code I got. Now that I migrated the source code on to the Jetson TX1 and that it worked well, I've tried to use gperftools.
Unfortunately, segmentation faults start to appear as soon as I launch my program with perftools
env CPUPROFILE=./lts.prof /mybin
I've read the documentation and they talk about using the correct libunwind for 64 bit Linux. Unfortunately, the given library (0.99 libunwind, http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz) does not seem to like the Tegra platform.
First of all, there is a problem with the config.guess, that I had to change with the one located in /usr/share/automake*/.
configure: error: cannot guess build type; you must specify one
Then it goes wrong like this :
config.status: error: ./include/libunwind-aarch64.h: file not found
I've tried to use the master tree because they added AARCH64 (which appeared in the error messages), but then I get other messages :
aarch64/is_fpreg.c:31:21: error: 'UNW_AARCH64_V0' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
aarch64/is_fpreg.c:31:49: error: 'UNW_AARCH64_V31' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
As anyone been able to use gperftools on a Tegra Dev Kit or similar
platform ?
Is the libunwind part of the segfault problem ? Again the
code works without -lprofiler and CPUPROFILER.

Related

Fatal error: debugger does not support channel locks

I am trying to use ocamldebug with my project, to understand why a 3rd party lib I'm using is not behaving the way I expected.
https://ocaml.org/manual/debugger.html
The OCaml debugger is invoked by running the program ocamldebug with the name of the bytecode executable file as first argument
I have added (modes byte exe) to my dune file.
When I run dune build I can see the bytecode file output, alongside the exe, as _build/default/bin/cli.bc
When I pass this to ocamldebug I get the following error:
ocamldebug _build/default/bin/cli.bc
OCaml Debugger version 4.12.0
(ocd) r
Loading program... done.
Fatal error: debugger does not support channel locks
Lost connection with process 33035 (active process)
between time 170000 and time 180000
Restart from time 170000 and try to get closer of the problem ? (y or n)
If I choose y the console seems to hang indefinitely.
I found the source of the error here:
https://github.com/ocaml/ocaml/blob/f68acd1a618ac54790a8347fad466084f15a9a9e/runtime/debugger.c#L144
/* The code in this file does not bracket channel I/O operations with
Lock and Unlock, so fail if those are not no-ops. */
if (caml_channel_mutex_lock != NULL ||
caml_channel_mutex_unlock != NULL ||
caml_channel_mutex_unlock_exn != NULL)
caml_fatal_error("debugger does not support channel locks");
...but I don't know what might be triggering it.
My project is using cmdliner and lwt ...I think at this early point of execution it hasn't hit any lwt code though.
Is ocamldebug incompatible with cmdliner?
If that's the case then I will need to make a new entrypoint just for debugging I guess. (currently the bin/cli is the only executable artefact in my project, the code I need to debug is all under lib/s)
It looks like that the OCaml debugger is broken for your version of macOS. Please, report the issue to the OCaml issue tracker including the detailed information on your system. I can't reproduce it on my machine, but I am using a pretty old version of macOS (10.11.6) and I have the 4.12 debugger working flawlessly.
As a workaround, try using an older version of OCaml, as this channel lock test was introduced very recently you can install any version prior to 4.12,
opam switch create 4.11.0
eval $(opam env)
Then, do not forget to rebuild your project (previously installing the required dependencies),
opam install lwt cmdliner
dune build
and then you can use the debugger to your taste.

can't compile or-tools examples on Mac due to "make: *** No rule to make target `run'."

I have installed Google's or-tools on my Mac running 11.1 (Big Sur). When I run make test_cc, I get a long list with different results and also some messenges like ---- Integer programming example with CPLEX ---- Supports for solver CPLEX not linked in.
However, if I try an example from https://developers.google.com/optimization/introduction/cpp, I get the above error (see header) when trying to make and run the program (I have copy pasted the complete program). I have executed the make command with
Death-Star:or-tools me$ make run SOURCE=../Routing/Routing/main.cpp. ls ../Routing/Routing/main.cpp shows the file.
What have I done wrong?
or-tools version is 8.1.8487

Is it possible to use Kotlin Native on macOS 10.12?

I'm trying to port a simple Go macOS application over to Kotlin Native. After struggling with various errors I decided to take a step back, and have a look at the official examples provided with Kotlin Native.
I found a basic OpenGL example here:
https://github.com/JetBrains/kotlin-native/tree/master/samples/opengl
But so far I haven't been able to get this to compile.
I tried downloading the complete sources for Kotlin, but that wont build. I followed a few suggestions generated at build time, including the change to 'ignoreXcodeVersionCheck' and downloading prebuilt binaries for the compiler, but at this point I'm wondering if this just isn't supported by my environment? I do understand that this is all experimental.
I've attached a sample of errors below, but I'm not sure whats relevant.
Question: Does anyone else have this setup / environment working please? can I expect to get it working?
macos 10.12.4, kotlin 1.3.11, xcode 8.2.1
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cmath:551:28: error: expected a qualified name after 'typename'
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cstddef:44:15: fatal error: 'stddef.h' file not found
#include_next <stddef.h>
A problem occurred evaluating root project 'kotlin-native-master'.
expected Xcode version 10.1, got 8.2.1, consider updating Xcode or use "ignoreXcodeVersionCheck" variable in konan.properties
kotlin-native-master/runtime/src/main/cpp/ObjCExportErrors.mm:73:23: error: no type or protocol named 'NSErrorUserInfoKey'
NSMutableDictionary<NSErrorUserInfoKey, id>* userInfo = [[NSMutableDictionary new] autorelease];
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
I did manage to get a "hello world" working under the above environment, but I have given up with the OpenGL stuff. I cant update my environment currently, and I guess this issue doesn't affect many people. So I'm going to close it with this 'answer'.

Installing HDF5 library on Cygwin: "make check" stuck at testswmr.sh, no error message

I am currently installing the HDF5 library, more precisely the hdf5-1.10.0-patch1, on Cygwin, as I want to use it with Fortran. Following the instructions from the hdfgroup website
(here is the link), I did the following:
./configure --enable-fortran
make > "out1_check.txt" 2> "warn1_check.txt" &
make check > "out2_check.txt" 2> "warn2_check.txt" &
The execution of the last command (make check) proceeds as it should, until it gets stuck. The process does not stop and something is happening (8-12% CPU are in use by sh.exe, already 39 hours of CPU time) but "out2_check.txt" looks like
Making check in src
...
[many successful checks]
...
============================
No need to test testlinks_env.sh again.
============================
============================
Testing testswmr.sh
Unfortunately, I do not have the output file from the first run of make check, but it did not contain more information on Testing testswmr.sh. There was never any error message.
So, what is this testswmr.sh, why does it get stuck and how can I finalize the installation process? Maybe I can skip the remaining checks and just proceed to make install?
Important note: an older version of HDF5 is already installed from the Cygwin repo. It does not seem to support Fortran however, so I decided to install the current version myself.
Available (and used) compilers are gcc and gfortran.
As far as I can tell, only Intel Fortran is supported on Windows. There is no Cygwin download here https://support.hdfgroup.org/HDF5/release/obtain518.html and I have never come across a report of experience for Cygwin/Fortran/HDF5.
Your options:
Use Intel Fortran
Use Linux or Mac
Sorry

Installing glLoadGen 2.0.2

I need an opengl loader, extension or core. I know I am suppose to use gl code inside after gl context has been called. My problem is actually setting up this opengl development environment.
I tried glew, and failed horribly.
Next one on my list is gl load generator. It generates specific opengl core, so all i have to do is include them to use those core functions.
However, I can not get this to install and feel like giving up and moving onto gl3w soon...
This is the error I am recieving when I try to make a simple file:
C:\MinGW64\glLoadGen_2_0_2>lua LoadGen.lua -style=pointer_c -spec=gl -version=3.
3 -profile=core core_3_3
lua: ./modules/Styles.lua:37: attempt to index local 'lfs' (a boolean value)
stack traceback:
./modules/Styles.lua:37: in main chunk
[C]: in function 'require'
./modules/GetOptions.lua:28: in main chunk
[C]: in function 'require'
LoadGen.lua:17: in main chunk
[C]: ?
C:\MinGW64\glLoadGen_2_0_2>cd C:\MinGW64\glLoadGen_2_0_2
Environment:
Windows 7 64 bit, running cmd as adminstrator, luafilesystem 1.5.0-1
There's a little syntax mistake. However, if you did some researches on this you would have found this Ticket
You have to replace
local lfs = pcall(require, "lfs")
if(lfs and lfs.attributes("modules/UserStyles.lua", "mode") == "file") then
with
local status, lfs = pcall(require, "lfs")
if(status and lfs.attributes("modules/UserStyles.lua", "mode") == "file") then
This fixes the errors.
Cheers
I get the exact same error message on Ubuntu 14.04 with default lua with glLoadGen_2_0_2. The only way I have been able to use glLoadGen is to download the glLoadGen_1_9 distribution and run the exact same lua command. It generates the gl .h and .c files fine. I'm assuming something is badly broken in the glLoadGen_2_0_2 distribution to get identical errors in such very different environments.
Seems it is trying to use mingw compiler suite to do the build. You either need to install mingw, or you need to tell luarocks (or whatever command you're using for the installation) how to find it, or you need to tell that command to use MSVC (or whatever build tool chain you want to use).