I've been trying to install the nana library for c++. I've used these guides:
https://github.com/qPCR4vir/nana-docs/wiki/Installation
https://github.com/qPCR4vir/nana-docs/wiki/Install-and-use-nana-with-mingw---step-by-step
I got stuck on the part that says "Create a static linkage library solution within a IDE/build system you use, and add all the files which are placed in NanaPath/source and in all its sub directories to the project. Then compile the solution and you will get a static linkage file NanaStatic in a path similar to NanaPath/build/bin/IDEName."
I downloaded MinGW, git, and cmake like it said. I opened up the bat file, ran the "git clone" with the link, ran
cmake -G "MinGW Makefiles"
It did it's thing and finished successfully. Then I tried running "make" and it got to 6% when this showed up:
In file included from C:/Users/.../nana/verbose_prepocessor.hpp:99:0,
from C:\Users\...\nana\source\deploy.cpp:242:C/Users/.../nana/include/filesystem/filesystem.hpp:71:39: fatal error: experimental/filesystem: No such file or directory
# include<experimental/filesystem>
^
compilation terminated.
make[2]: *** [CMakeFiles\nana.dir\build.make:163: CMakeFiles/nana.dir/source/deploy.cpp.obj] Error 1
make[1]: *** [CMakeFiles\Makefile2:67: CMakeFiles/nana.dir/all] Error 2
make: *** [Makefile:129: all] Error 2
I tried using a different source of the code (git and sourceforge) and that didn't make a difference. I tried using the GUI cmake, but I had other errors with that not recognizing MinGW. I looked around for answers online, but they mostly led back to the guides I was using. I checked my GCC and G++ version with gcc/g++ --version, and they're both 6.3.0.
I'll take any suggestions/advice, thanks!
I have not used Eclipse, so I cant help with that. But I will try to help with nana:
Originaly there was no std::filesystem and nana offered one JinHao invented. With the apparition of std::experimental::filsystem candidate, an experimental filesystem in the sdt:: c++ library of some versions of some compilers we adapted the nana filesystem to be a partial implementation of that. Then nana try to configure itself to use the provided std:: (or Boost) implementation or if it is not there then nana::filesystem. It seems like MinGW have problems with filesystem, I'm not sure about that but here you can read: https://github.com/Alexpux/MINGW-packages/issues/2292
Please try to undertstand what is going on in your case an let us know about. We will then try to fix the configuration of nana to work even in that situation.
You can always simply choise to (force) use the nana implementation. Just please compile both the nana library and your project with all the same options, including what filesytem you use. For example adding -DNANA_CMAKE_NANA_FILESYSTEM_FORCE=True to your cmake or define NANA_FILESYSTEM_FORCE in your built system (or IDE).
Related
EDIT: If you want to look at the code, here it is:
https://github.com/WalterCapa/PercolationCpp/tree/master
I'm making a program that uses allegro5 library to generate an animation.
Because i want to avoid the installation of the library on every computer that uses the program, i tried to paste the headers and the .so files in my project dir. So the tree is like this:
root
include
allegro5 <- (Dir where the headers of allegro are)
Percolation.h
QuickUnion.h
lib
allegro5 <-(Dir where the .so files are)
Percolation.cpp
QuickUnion.cpp
PercolationVisualizer <- (Dir that has the main)
The problem is this. I installed allegro5 in my pc with LinuxMint 13. Everything is fine if I compile from Code::Blocks or if I do it from the terminal using -I to call the hedaers and -L to tell where the .so files are, and even using cmake works fine, but when i try to do it in another computer, even if it's windows like my laptop or a virtual machine with linuxmint, it generates this error:
make[2]: *** No rule to make target '/./lib/allegro5/liballegro.so/', needed by'
../bin/PercolationVisualizer'. Stop.
make[1]: *** [CMakeFiles/PercolationVisualizer.dir/all] Error 2
make: *** [all] Error 2
This is my CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.7)
project(PercolationCpp)
set(PercolationCpp_VERSION_MAJOR 0)
set(PercolationCpp_VERSION_MINOR 1)
set(EXECUTABLE_OUTPUT_PATH ../bin/)
set(percolation_SRCS PercolationVisualizer/PercolationVisualizer.cpp lib/Percolation.cpp lib/QuickUnion.cpp)
#Executable
add_executable(PercolationVisualizer ${percolation_SRCS})
#include Allegro
include_directories(./include)
link_directories(./lib/allegro5)
#connect all the libraries
set(allegro5_LIBS /./lib/allegro5/liballegro.so /./lib/allegro5/liballegro_primitives.so)
target_link_libraries(PercolationVisualizer ${allegro5_LIBS})
Btw, when trying it on windows with MinGW i used cmake -G "MinGW Makefiles" .. and mingw32-make.
It found the compiler and and cmake worked, but when i tried de second one it gave me the same error. In my desktop i'm compiling using g++.
I think that your actual problem is the leading / in this line:
set(allegro5_LIBS /./lib/allegro5/liballegro.so /./lib/allegro5/liballegro_primitives.so)
A leading slash will tell cmake to look for an absolute path (like /usr/lib...) and not prefix it with a CMAKE_*_DIR. Try this
set(allegro5_LIBS ${CMAKE_SOURCE_DIR}/lib/allegro5/liballegro.so ${CMAKE_SOURCE_DIR}/lib/allegro5/liballegro_primitives.so)
However I strong discourage you to include pre-built libraries in your project. If you can, integrate a tar-ball or a git-submodule. If the project you include is a cmake project itself, a simple call to add_subdirectory will make the targets (libraries usually) available to your project and create a dependency. If the project is based on configure you can use the ExternalProject-extension.
I am trying to compile a project using boost.python as documented on this page. My platform is MacOS X, i386 architecture. I am using the current version of boost, v1.55. The example provided in ${BOOST}/libs/python/example/tutorial/ compiles and works properly. However, when setting up my own project in a different directory outside of the boost root directory, I run into the following problem: when I type ${BOOST}/bjam toolset=darwin architecture=x86 address-model=32 I get the following error message:
Unable to load Boost.Build: could not find "boost-build.jam"
---------------------------------------------------------------
Attempted search from ${CURRENT_PATH} up to the root at ${SOME_OTHER_PATH} and in these directories from BOOST_BUILD_PATH and BOOST_ROOT: /usr/share/boost-build.
Please consult the documentation at 'http://www.boost.org'.
make: *** [all] Error 1
The documentation of the bjam tool is not referenced, bjam --help only returns an error message and Googling only finds this page (which doesn't talk about the problem at all) and this page (which seems to be outdated as indicated by the link at the top of the page).
Question: How do I specify the path of the boost-build.jam file? Or, alternatively, is there any other way to use boost.python with standard tools?
Update 3: The option -d4 lets bjam print verbose debugging output. If the name of the compiler is known, the output can be grepped for the compiler invocation. This can then be used to construct a "regular" Makefile. See e.g. this post for an example of how to do so (albeit it assumes that the compile and linker commands are known).
I'm trying (for a few days now) to build a DLL generated from C++ code with boost/python to be used by python. I am a Student from Germany and had mostly to do with Java until now (I wrote some basic OpenGL and gimp filter stuff before in C++). So pardon me in advance for bad english or C++ beginner mistakes. I mean, programming with Java really is a lot more comfortable in comparison to C++. But enough of the skirmish.
The error:
LINK : fatal error LNK1104: File "boost_python-vc110-mt-gd-1_53.lib" could not be openend
My presets:
-using MS Visual Studio 2012 (11.0)
-using boost_1_53_0
-using python2.7 (I heard 3.3 may cause some Problems)
What I did:
Installed python and added it to PATH. Then created a new empty project in VS and a class file "Test.cpp" with following content as described on the boost tutorial page:
char const* greet()
{
return "hello world";
}
#include <boost/python.hpp>
BOOST_PYTHON_MODULE(Test)
{
using namespace boost::python
def("greet", greet);
}
Then came the new part for me, in VS Project Properties:
Configuration Properties > General > Configurationtype > Dynamic Library (.dll)
C/C++ > General > Addition Includedirectories > C:[..]\boost_1_53_0
Linker > General > Additional Library Directories > C:[..]boost_1_53_0\stage\lib
From the error I am assuming i did something wrong with Linker or Include. I also changed the Linker > General > Additional Library Directories to boost_1_53_0\libs because i wasn't sure, but the same error occured. And yes, I correctly included python. I am also not sure if i have to put something else beside python into Linker > Input for boost.
Then I build boost with bjam with no options except msvc-11.0 to be sure to have everything i need (though I read that boost/python doesn't need an extra build) and still got the same error. Can someone help me? I would love to have a step by step description of what to do. I am really despairing of this.
Btw.: I had the same error as this guy a few days before Linker error LNK1104 with 'libboost_filesystem-vc100-mt-s-1_49.lib' then stopped working on it and as I started again I got my brand new error (I can't tell you how this happened).
Since it is looking for a static library, add BOOST_PYTHON_STATIC_LIB flag, go to VS properties -> Preprocessor -> Processor definition, add BOOST_PYTHON_STATIC_LIB flag.
You need to create a "user-config.jam" file that indicates where the python headers and libs can be found by Boost.Build. You can create it in your boost_1_53_0/ directory with the following contents:
# Configure specific Python version.
using python : 2.7
: C:/Python27/python.exe
: C:/Python27/include #directory that contains pyconfig.h
: C:/Python27/libs #directory that contains python27.lib
: <toolset>msvc ;
Then from that boost_1_53_0/ directory you need to invoke b2 like this in order to build the missing library:
b2 toolset=msvc-11.0 --with-python variant=debug runtime-debugging=on link=shared --user-config=user-config.jam stage
(although I would recommend b2 toolset=msvc-11.0 --with-python --user-config=user-config.jam --build-type=complete stage so you can get in one step all the configurations that you might need in the future)
Once you have the libraries you need to add the directories to Visual Studio ( both to boost and to python).
Once you have successfully built the module you need to rename it to Test.pyd (exact name you used in BOOST_PYTHON_MODULE. If you have the python and Boost.Python libraries in your PATH or in your current directory you will be able to use the script in the tutorial:
import Test
print Test.greet()
and get the familiar "hello world".
Note that I'm very thankful for your tries but none of your answers helped. A fellow student then gave the hint for the right answer to me and some steps are really easy, others I don't understand, but it works now.
First Problem was: The new boost 1.53.0 does not work with Python27 or older. I then linked it with Python33 and had the build error removed.
But of course the build version didn't work without an error. As I tried to start my helloboost.py which imports from the .pyd built by VisualStudio and invokes the greet method, the following error occured:
ImportError: DLL load failed: The specified module could not be found.
As i checked the hello_ext.pyd with the dependency walker and wildly copy pasted around, I found out it needs the boost_python-vc110-mt-gd-1_53.dll (probably depending on what you need and built with bjam before) in the same folder. It worked then. Maybe someone can explain why nowhere was explained that I need this dll in the same folder as the pyd (or did I miss something? Is it just because I made a mistake before?)
Anyhow, I'm very glad it works now and hope it helps other people.
You probably will have worked this out by now - however:
When a .exe looks for a .dll to load no path is specified. Therefore a .dll must be in the search path for the file.
Also: I was trying to build 1.49 libs for Visual Studio 2013 - and kept getting the LNK error from my project. I don't know who suggested it on stackoverflow but someone\something gave me the idea to copy build system from a more recent boost which knows how to make .libs for more recent environments. (thank you)
I had to copy the boost build system from a 1.58 after running bootstrap in 1.58, copy b2, bjam and boost-build.jam to the earlier boost folder root to replace the same named files there. Also you will need to copy the later tools\build folder to support the build system.
Noting here in the hope it might help someone else in a similar cituation I found myself in.
See: Search Path Used by Windows to Locate a DLL
I want to use FADE on my computer. So, I have to use the libaws++, which is a C++ library that allows to communicate with Amazon Web Services.
OK, Here is my problem:
The website of libaws++ is unavailable. I used Google to search "libaws++" and only found libaws. I didn't know whether libaws is libaws++. They both used to communicate with Amazon Web Services. So I download libaws from sourceforge.
Here is the process I install libaws:
tar libaws-0.9.2.tar.gz
cd libaws-0.9.2
cp ~/libaws_patch_for_fade.patch libaws_patch_for_fade.patch (cp the patch to libaws-0.9.2)
patch -p2 -i libaws_patch_for_fade.patch
mkdir libawsbuild
cd libawsbuild
cmake ..
make
And error occors:
[ 28%] Building CXX object src/CMakeFiles/aws.dir/api/connectionpool.cpp.o
In file included from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/aws.h: 26:0,
from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/connec tionpool.h:22,
from /home/lx/Nutstore/cloud/libaws-0.9.2/src/api/connectionpoo l.cpp:16:
/home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/sqsresponse.h:124:9: error: a€?uint64_ta€? does not name a type
In file included from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/aws.h: 29:0,
from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/connec tionpool.h:22,
from /home/lx/Nutstore/cloud/libaws-0.9.2/src/api/connectionpoo
/home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/sqsresponse.h:124:9: error: a€?uint64_ta€? does not name a type
In file included from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/aws.h: 29:0,
from /home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/connec tionpool.h:22,
from /home/lx/Nutstore/cloud/libaws-0.9.2/src/api/connectionpoo l.cpp:16:
/home/lx/Nutstore/cloud/libaws-0.9.2/include/libaws/sdbresponse.h:105:20: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
.....
make[2]: *** [src/CMakeFiles/aws.dir/api/connectionpool.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/aws.dir/all] Error 2
make: *** [all] Error 2
I searched on Google and stackoverflow and didn't get any useful information.
Add #include <stdint.h> to the top of those header files.
uint64_t is a standard type and should work just fine.
(Unless of course you are on some weird platform that doesn't support 64-bit integers...)
Just got this compiled with the gnu compiler 4.9.x. With newer versions of the compiler, there are more steps needed to compile libaws.
Here's what I had to do:
1) Add the following line to the header files in libaws-0.9.2/include/libaws/*.h, after all of the other include statements:
#include <stdint.h>
2) Add the following line to libaws-0.9.2/include/libaws/aws.h, after all of the other include statements:
#include <getopt.h>
3) If you're using a recent version of the Gnu C++ compiler, you'll need to modify the CMAKE files to add some flags to the compiler, so that the older C++ syntax used in libaws doesn't throw compiler errors.
Add this line to CMakeCompiler.txt, after all of the other CMAKE_CXX_FLAGS commands, around line 82 (which should be a blank line):
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -Wignored-qualifiers")
FYI: If you're using the Gnu C compiler, you may need a similar line for the C sections, at the end of the other CMAKE commands. Something like this at the end of the file might work, but I haven't tried it:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpermissive -Wignored-qualifiers")
Once those are done, here are the steps to compile:
cd libaws-0.9.2
mkdir libawsbuild
cd libawsbuild
cmake ..
make
When this is successful, you also may need to copy config.h from libawsbuild/include to libaws-0.9.2/include/libaws in order for the compiler to find config.h in the place it expects, when you compile whatever code you're writing to actually use libaws. (Although that may just have been the way my personal makefile was configured. Don't quote me on that.)
I am trying to compile the Hello example in directory lib/Transforms/Hello, which is basically a Hello World of LLVM pass, but I get the following error when I try to compile it using make.
../../../Makefile.common:61: ../../../Makefile.config: No such file or directory
../../../Makefile.common:69: /Makefile.rules: No such file or directory
make: *** No rule to make target `/Makefile.rules'. Stop.
Any idea what is the problem and how to fix it?
If you built LLVM + Clang according to instructions, the Hello sample should have already been built. Go to lib/Transforms/Hello in the build directory (where you ran configure and then make). There should be a Debug+Asserts (or whatever configuration you compiled) there. And you can also run make from there again.
In general, you always make from the build directory, not the source directory. The build directory has all the Makefiles properly set up.