Invalid mex file: undefined symbol: cholmod_camd - linux

How to solve this issue? I saw no cholmod_camd related header file in the c++ file I was trying to mex.
Invalid MEX-file '/home/mpelang/Desktop/APAPstitch/Image Stitching with
Bundled Moving
DLT/ceresRigidError.mexa64': /usr/local/lib/libceres.so: undefined
symbol:
cholmod_camd

Ceres solver needs Cholesky methods for solving the linear systems. Either link the c++ file against a library containing cholmod_camd (with -lcholmod -lmwlapack) or explicitly tell ceres you have no cholmod (when building ceres using cmake). Take a look at http://ceres-solver.org/installation.html for how to install Ceres-solver.

Related

Why torch::jit::load() can only load files produced by torch::jit::save()

I'd like to load a pytorch model weight & bias **.pt in android ndk project. I used pytorch mobile anddorid library to parse the model. When I used torch::load api, it cause linked error:
headers/torch/csrc/api/include/torch/serialize.h:130: undefined reference to `torch::serialize::InputArchive::InputArchive()
headers/torch/csrc/api/include/torch/serialize.h:131: undefined reference to `torch::serialize::InputArchive::load_from()
headers/torch/csrc/api/include/torch/serialize.h:139: undefined reference to torch::serialize::InputArchive::try_read()
.Then I used torch::jit::load to parsed, but got execution error:
terminating with uncaught exception of type c10::Error: torch::jit::load() received a file from torch.save(), but torch::jit::load() can only load files produced by torch.jit.save()
Maybe the reason is this. C++ frontend api currently only supports loading jit saved tensor file. So the only solution is torch.load then torch.jit.save in python

OpenModelica Fortran based External Function read\write error

I am trying to add an external FORTRAN Code to OpenModelica 1.13.0. My function and model definitions are correct and the FORTRAN code normally works. But whenever I add a write(*,*) or read(*,*) method to the code I get the following error as OpenModelica Simulation output:
undefined reference to _gfortran_transfer_real_write##GFORTRAN_1.4
I wonder how can I solve this issue.
Thank you.
This (probably) happens because you are not linking gfortran with the simulation. If the library is shared (so, DLL, dylib), the dependency is usually handled automatically, so you are probably trying to link a static library (.a) or object file (.o, .obj).
In your external function, add an annotation Library="gfortran" or since you probably already have your library in there, Library={"mylib", "gfortran"}.
Also note that OpenModelica 1.13 is getting old and should be upgraded.
For OMShell one can call the setCFlags("-lgfortran") or inside OMEdit add -lgfortran at Simulation Setup > General > C/C++ Compiler Flags. It will solve the issue.

Linker error lnk2001 even though the unresolved symbol is defined

I have researched more into the problem and posted a more detailed question with my findings here: Rust, how to use global variable from DLL? C++ equivalent requires __declspec(dllimport)
Original question:
Summary:
When linking my project with MSVC 2019's link.exe, I am getting errors such as unresolved external symbol jl_module_type. These symbols are defined in a file julia.lib, which I have verified using dumpbin /exports julia.lib. This file is passed as an argument to link.exe, and yet, it still complains about unresolved symbols. It looks like all the symbols that failed to be linked are variables rather than functions.
More information:
julia.lib has been renamed from libjulia.dll.a, and it corresponds to another file libjulia.dll. They were built with Cygwin/MinGW, but AFAIK this should not affect things. The actual project this is being used in is written in Rust, so link.exe is being invoked automatically by Rust's cargo tool. It is configured to build my project as a DLL.

Android: Cannot load library

I am facing a situation of which I have no idea. I am tried to test one method that I have implemented in C++ and I used swig to generate the wrapper. After compilation, when I tried to run the application, I got an error java.lang.UnsatisfiedLinkError.
It further states that
cannot load library:reloc_library[1311]:33
cannot locate '_Z13recognizeFacePKcS0_'
...
and suddenly throw exception.
I tried using adb shell to debug and found library in the right location (data/data/com/mesh/faceAuth/lib/libfaceAuth.so) but it gives the same error. I also read from this site, that it has to do with wrong STL implementation which I don't have any clue of. I will highly appreciate your candid suggestion.
Regards,
Mohammed.
Best guess with what information you have provided, The library you are trying to load needs some dependencies to be loaded before it.
For example:
System.loadLibrary("bullet");
System.loadLibrary("irrlicht");
System.loadLibrary("gamescript");
gamescript library needs other 2 library to be loaded before it. Otherwise, it gives me the same error you have mentioned. I can dig further on this issue if you can post some part of your .mk file for building the library here.
Your error has nothing to do with STL.
You probably reference a global function ::recognizeFace(char const*, char const*) in your code. Maybe, you have another function defined, for example recognizeFace(char*, char*).

Compiling a program without the the Multi Threaded DLL (Visual C++ 2010)

By default, Visual Studio compiles a project to use the Multi Threaded DLL, found in the Visual Studio runtime. I want to compile my program using only /MT instead of /MD. Granted, that most systems already have this installed, and it's also available as a re-distributable.
When I change /MD to /MT, I get an error:
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
And four or five similar errors.
To try and fix this I removed LIBCMT.LIB from the default libraries.
I then get the error:
libcpmt.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_crt referenced in function __Getctype
Removing MSVCRTD.lib from the default list leads to similar errors?
It should be noted that:
-This is an OpenGL project, using the glfw library.
-I am using the SOIL image library by lonesock for texture loading.
Without any further precise information, I would say your first problem is that you're somehow mixing release and debug versions of libraries. MSVCRTD.lib is the debug version of MSVCRT.lib.
Either you have some debug settings hanging around in your own projects, or you're linking against debug versions of libraries you're using.
Never ever mix debug and release versions. If you're lucky you get an error like this. In some rare situations all magically seems to work until it doesn't.

Resources