pcl install

classic Classic list List threaded Threaded
8 messages Options
ed
Reply | Threaded
Open this post in threaded view
|

pcl install

ed
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

Stephen McDowell
Welcome to PCL :)

It sounds like you may be new to CMake.  Good news is, once you get the hang of it you won’t have these kinds of issues anymore!

Before including more information, can you clarify “I have installed PCL”?  Specifically, what exactly are you trying to accomplish (1 or 2 below):

(1) You are trying to compile PCL from source, and are having trouble building it.
(2) Now that you have installed PCL from the precompiled binaries, you are trying to compile a program or library that uses your shiny new PCL installation.

It sounds like (2) but I just want to confirm so that I can give you the right information :)

-Stephen


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
ed
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

ed
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

Stephen McDowell
What about tears of joy when you get it working?  Hehehe.

Ok so here’s the deal.  NEVER edit the CMake cache directly.  That will only cause you grief, and CMake will likely just overwrite it making your changes pointless.  The CMake cache is for CMake to use, not us humans.

With that out of the way, the basic idea behind CMake is that it is a build system generator.  So on Unix systems, running CMake will by default give you a Makefile.  On Windows, you will want to get a Visual Studio solution out (.sln file).

Before continuing, did you know that Visual Studio 2017 (FINALLY) can open a CMakeLists.txt for you?  Excellent resource on that here: https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/

But imma show you the traditional workflow, since myself I like to do anything i can in my terminal (even on Windows).

So.  How do we get a Visual Studio solution file?  First, lets assume that you are working with this simple tutorial: http://pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd

So the directory structure might look like (just create / copy paste the files from the tutorial)

someFolder/
    pcd_read.cpp
    CMakeLists.txt

For CMake, you’ll want to remember to always do something called “building out of source”.  Real reasons aside, it makes it easier for you to start over.

$ cd path\to\someFolder
$ mkdir build
$ cd build

Now we are in this nice and self contained build directory, which if we ever mess things up, we can just delete the whole thing and start again.  An unfortunate blunder (by Microsoft, not CMake) is how to generate this .sln file.  Run this

$ cmake -G

That will list all of the available generators, for which a few different versions of Visual Studio should show up.  If you wanted to generate for Visual Studio 15, it might look like this

$ cmake -G "Visual Studio 14 2015 Win64” ..

Note 1: “Visual Studio 14 2015”: their version numbers are annoying, but that will never change.
Note 2: Win64: unless you need a 32 bit build, make sure you generate a 64bit solution.  Default is 32 bit.
Note 3: The ‘..’ is the actual argument to CMake, it should point to wherever the root CMakeLists.txt is.  In this case, since we went into the `build` directory, .. points to the parent where someFolder/CMakeLists.txt lives.

This is how you should always CMake: make a build directory, enter it and `cmake ..` to get your project.

Assuming there were no errors during generation, you should now have a .sln file which you can double-click and it’ll open in Visual Studio.  Alternatively, noting that the CMakeCache is generated in this build/ folder, we can run

$ cmake --build . --config Release

Note: the `.` rather than `..`.  cmake `--build` is looking for the cache, not CMakeLists.txt.

That’ll just run msbuild from the command line.  In truth, I think thats less common, I do it that way because I hail from Unix, where building and running from the command line is more natural than running from a GUI ;)

I don’t think I skipped any steps there, but getting started with this stuff can be very frustrating as you have expressed.  Please ask questions if you are getting stuck still :)

-Stephen

P.S. A note about the build/ directory and the cmake cache.  When you do more complicated things, such as finding other libraries and adding dependencies etc, this is where making this self-contained build directory becomes paramount.  I can’t tell you the number of times that I’ve edited my CMakeLists.txt, re-ran `cmake ..` and had build failures….only to completely delete the build directory and start over fresh and have it work.  It depends a lot on what you changed (it’s not always necessary), but a “stale cache” is a common grievance in CMake, which is why we always build out of source.


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
ed
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

ed
CONTENTS DELETED
The author has deleted this message.
ed
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

ed
In reply to this post by Stephen McDowell
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

Stephen McDowell
So I think the answer is neither needs to be solved, rather you should undo some stuff.  To be clear, I don’t have access to Windows (I selfishly tried to take my boot cycle back to defaulting to Linux…and now Windows boot loader is gone *sigh*).  But in my experience I have never had to set CXX for CMake.  So

1) You shouldn’t need to set CXX manually, go undo that if you did it in a startup script of some kind.
    If so, you still don’t set CXX (because as I understand vcvarsall.bat sets everything for you)

However, I have never needed to set CXX for Windows.  Lets try this:

What is the output of `cmake -G` for you?

If Visual Studio is showing up, then CMake already knows how to setup CC and CXX and all of the other stuff for you.  It sounds like you setting CXX is what has confused CMake.



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: pcl install

Stephen McDowell
Sorry for double-tap, I meant to send this link too: https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx

vcvarasall.bat takes arguments.  You’ll probably want to try either `amd64` or `x86` for 32 bit build (reason: Compiler column has ’native').

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users