Something like
use super::gmp::mpz::Mpz;
...
pub type MyMPZ = Mpz;
...
fn a() -> Option<MyMPZ>;
It (along with many other Rust files, libs and other dependencies) compiles and runs OK on Ubuntu and even Windows, but on macOS Mojave
I get
expected struct `gmp::mpz::Mpz`, found enum `std::option::Option`
note: expected type `&gmp::mpz::Mpz`
found type `&std::option::Option`
I installed GMP with Brew, but I tried with GMP 6.1.2 built by myself with the same results.
Update 1:
Seems MCVE doesn't make much sense since I have two exact copies of project in same root like root\example1 and root\example2. One copy builds ok, another gives the error message. Tried cargo clean etc numerous times to same effect.
Update 2:
Seems it's definitely some sort of caching issue. Because when I build dependencies, they take custom built 32bit version of gmp.lib from C:\Users\<userName>\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib. So if I checkout dependency and build it separately - tests run there. If I build the whole project, and using my own build dependency crates as .lib I at some point was getting
expected struct `gmp::mpz::Mpz`, found another struct `gmp::mpz::Mpz`
that seems like mixing of GMP 32/64 bit libraries to me.
Ok so it was cargo dependency hell:) - after multiple unsuccessful reinstalls, cleaning etc I finally was able to rebuild by manually downloading and rebuilding and re-referencing local paths of dependencies that were referenced with git. From then on - all was building fine no matter if I referenced locally or via git or crates.
Related
I use version 4.1.1 of GTSAM. I have version 3.3.4 of Eigen installed.
The error is:
/usr/local/include/gtsam/base/OptionalJacobian.h:22:10: fatal error: Eigen/Dense: No such file or directory
#include <Eigen/Dense>
I tried building GTSAM with the flag -DGTSAM_USE_SYSTEM_EIGEN set to both on and off.
The same error message appears in both cases.
For reference this is a ROS project built with catkin.
Have you seen this PR: https://github.com/borglab/gtsam/pull/1304
If you can upgrade GTSAM to 4.2a8, it uses Eigen's find script's rather than custom ones and should properly find Eigen3, if you have it installed if you require to build from source.
Since you are using ROS, why not go the standard route... Have you declared a dependency on it in your package.xml and installed it with rosdep?
https://github.com/ros/rosdistro/pull/23198/files
Add to your package.xml:
<depend>gtsam</depend>
And, your CMakeLists, you just call
find_package(gtsam REQUIRED)
It is unclear to me, if gtsam is available through binaries, why you would be building it from source.
I was able to get it working by cloning version 4.0.3 of GTSAM into the src folder of my workspace, then building it with the following arguments:
-DGTSAM_USE_SYSTEM_EIGEN=ON -DGTSAM_POSE3_EXPMAP=ON -DGTSAM_ROT3_EXPMAP=ON
I'm trying to use rustlearn crate in my project. Added the dependency in Cargo.toml.
Since rustlearn requires gcc, I downloaded and installed MinGW64.
I tried the following gcc builds:
x86_64-8.1.0-posix-seh-rt_v6-rev0
x86_64-8.1.0-posix-sjlj-rt_v6-rev0
i686-8.1.0-posix-sjlj-rt_v6-rev0
each time setting a PATH environment variable to the appropriate g++.exe and restarting VSCode.
But everytime I tried to build my Rust package I got a such error:
= note: C:\Rust\PF\machinelearning\target\debug\deps\librustlearn-4ae611e3fd449ac0.rlib(svm.o): In function `ZN6KernelC2EiPKP8svm_nodeRK13svm_parameter':
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:256: undefined reference to `__gxx_personality_sj0'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:256: undefined reference to `_Unwind_SjLj_Register'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:258: undefined reference to `_Unwind_SjLj_Resume'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:289: undefined reference to `_Unwind_SjLj_Unregister'
repeated many times.
I realize that the problem is somehow related to exception handling (seh/sjlj).
My system is Windows 7 x86-64, rust toolchain is stable-i686-pc-windows-gnu.
What am I doing wrong?
I found that the right build of MinGW is i686-7.1.0-posix-dwarf-rt_v5-rev2.
I did not run into these errors when I created a MWE.
To me, this looks like you are trying to use gcc to link a *.o that was compiled with g++.
I was unable to replicate your problem. Here's what I did--which resulted in a successfully built project:
I created a new project with cargo new and added the following to Cargo.toml:
rustlearn = "0.5.0"
I ran cargo check to download all the required dependencies.
I edited src/main.rs to include the logistic regression example from here, modified so that it was called in a main() function.
I ran cargo build, which successfully compiled crossbeam, libc, serde, rand, rustlearn, and rustlearn-test--the name of my test package. Several linting warnings were outputted; they were ignored.
I ran cargo run, which successfully ran the program.
FWIW, I'm using the WSL on Windows 10.
I've been trying to install hmatrix on my (64-bit) Windows 10 computer; after searching through and trying many possible solutions (including the instructions under "Windows" and "Alternative Windows Build" given here), I decided to pursue the course of action given on this Reddit thread.
However, when I type in the command
cabal install hmatrix -fopenblas --extra-lib-dir=${c:\msys64\mingw64\bin} --extra-include-dir=${c:\msys64\mingw64\include}
into the MSYS2 shell, the following log is given:
Resolving dependencies...
Configuring hmatrix-0.17.0.2...
Failed to install hmatrix-0.17.0.2
Build log ( C:\Users\Christian\AppData\Roaming\cabal\logs\hmatrix-0.17.0.2.log ):
Configuring hmatrix-0.17.0.2...
cabal.exe: Missing dependency on a foreign library:
* Missing C library: libopenblas
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Leaving directory 'C:\msys64\tmp\cabal-tmp-4244\hmatrix-0.17.0.2'
cabal.exe: Error: some packages failed to install:
hmatrix-0.17.0.2 failed during the configure step. The exception was:
ExitFailure 1
However, when I check the directory c:\msys64\mingw64\bin, I see that libopenblas.dll is right there; I don't know why cabal can't seem to find it.
Any insight into why this is not working or what to do?
UPDATE:
The files libopenblas.dll.a and libopenblas.a are in the directory c:\msys64\mingw64\lib. Is it possible I need to somehow include this directory as well? (If I do, how would I do that?)
I also downloaded the files in Alex Vorobiev's comment below and put them in c:\msys64\mingw64\bin if they are .dlls or c:\msys64\mingw64\lib if they are .libs. The header files were already contained in c:\msys64\include\openblas.
I tried several variations on the command in the original post after making these changes, including switching \bin with \lib and switching \include with \include\openblas, but all of them still give the same error.
I'm a bit suspicious about the
if os(windows)
if flag(openblas)
extra-libraries: libopenblas
in the cabal file, could you unpack it and remove the "lib" part? If that doesn't work please post a log with -v3 output. I've seen quite a few people with troubles installing this package. So could you also open a ticket on the GHC bug tracker if this doesn't work (and CC me "Phyx-")?
Secondly, you never said which version of GHC you're using. 8.0.1 should have far less trouble (and won't need the hack to get it working in GHCi) since the runtime linker has been overhauled and should be much better on Windows. 8.0.2 will likely include the new import libraries support as well.
I'm trying to compile a GO application, which uses the gokiri library.
I installed docker and compiled locally the xgo cross compiler for go.
When trying to execute the following command:
./xgo mydomain.com/test/test-app
I get the following error:
In file included from /usr/include/libxml2/libxml/parser.h:810:0,
from /usr/include/libxml2/libxml/globals.h:18,
from /usr/include/libxml2/libxml/threads.h:35,
from /usr/include/libxml2/libxml/xmlmemory.h:218,
from /usr/include/libxml2/libxml/tree.h:1307,
from ../../github.com/moovweb/gokogiri/help/help.go:6:
/usr/include/libxml2/libxml/encoding.h:28:19: fatal error: iconv.h: No such file or directory
I've installed xcode-tools which helped me compile it for my machine (mac ox El Capitan). BUT, I cannot get it compiled to other environment.
Any help will be appreciated. Thanks.
Update 1:
I've tried to add the dependency, but got the same result:
./xgo --deps /usr/local/Cellar/libiconv/1.14/ mydomain.com/test/test-app
It was even mentioned in the logs of the xgo that this library was already cached:
Dependency already cached: /Users/macuser/.xgo-cache/1.14.
from the documentation:
It is assumed that the dependent C/C++ library is configure/make
based, was properly prepared for cross compilation and is available as
a tarball download (.tar, .tar.gz or .tar.bz2). Further plans include
extending this to cmake based projects, if need arises (please open an
issue if it's important to you).
Such dependencies can be added via the --deps argument. They will be
retrieved prior to starting the cross compilation and the packages
cached to save bandwidth on subsequent calls.
So in this example, it would be:
./xgo --deps https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz mydomain.com/test/test-app
So I am trying for whole day to integrate Boost with Visual Studio (2008) on Windows 7.
I firstly I went twice trough this How to use Boost in Visual Studio 2010.
I searched over all (there are at least 3 of them) simiral topics and none of them worked.
Some people proposed using this one : www.boostpro.com/download/ but link is not active.
Someone proposed to change runtime library to Multi-threaded DLL but is also didnt work.
I just try to include #include <boost/thread.hpp> and got this error
fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-s-1_53.lib'.
Before installing Boost the error was that it cannot find the thread.hpp so it seems like the Boost is installed somewhat correctly.
The problem is that the libraries were not build while I was using the tutorial. How can I build them manually?
There's no such thing like one-click boost install, you still need to do something manually. In your case it seems you need to compile Boost.Thread library and then add directory where resulting .lib file is to your library path. The link you provided looks pretty good. If you followed it probably you already built Boost.Thread. Make sure you did #6 from the second part.
There are prebuild binaries - installation packages:
http://sourceforge.net/projects/boost/files/boost-binaries/1.53.0/
Use this command:
bjam --build-dir=build-directory toolset=toolset-name --build-type=complete stage
this build the libraries manually. Then add the new directory to additional libraries path
as it is indicated in this link:
http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source
I found this article quite helpful:
http://www.codeproject.com/Articles/11597/Building-Boost-libraries-for-Visual-Studio
The article explains how to build the build tool BJam (mainly by locating the boostrapper.bat)
How to build the libraries, e.g. bjam toolset=msvc-11.0 variant=debug threading=multi link=static (in this case the VS2012 multi-threaded, statically linked debug version).
It also features build batches, but I haven't tried them.
It has some additional information on how to specifiy the used C-Runtime