Unable to build GLFW with CMake errors - c

I downloaded the latest GLFW source (3.1.1) from its site, uncompressed it to the desktop, and tried to build it with cmake. Some dependency errors popped up, but was quickly fixed. Until I got stuck on this one:
alex#alex-AMD:~/Desktop/glfw-3.1.1$ cmake .
-- The C compiler identification is Clang 3.6.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/libGL.so
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.6")
-- Using X11 for window creation
-- Using GLX for context creation
-- Looking for glXGetProcAddress
-- Looking for glXGetProcAddress - found
-- Looking for glXGetProcAddressARB
-- Looking for glXGetProcAddressARB - found
-- Looking for glXGetProcAddressEXT
-- Looking for glXGetProcAddressEXT - not found
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_glu_LIBRARY (ADVANCED)
linked by target "boing" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "gears" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "heightmap" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "particles" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "simple" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "splitview" in directory /home/alex/Desktop/glfw-3.1.1/examples
linked by target "wave" in directory /home/alex/Desktop/glfw-3.1.1/examples
-- Configuring incomplete, errors occurred!
I'm totally lost as to what this means, and how to proceed
I'm on Ubuntu 14.04 64 bit, with proprietary AMD Radeon 7950 drivers

One of the error outputs was Looking for glXGetProcAddressEXT - not found, and the log files indicated that there was a linking error with libGL.
I then tried running apt-get install glfw to print out the list of dependencies. Even though it was an older version in apt-get, it still listed some dependencies that had to be installed.
GLFW compiled after installing libglu1-mesa-dev and libgl1-mesa-dev
The last error message CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_glu_LIBRARY (ADVANCED) was the one that threw me off. I thought it was a problem with paths and environment variables

Related

Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) with MS-MPI on CLion

I've started a fresh C project with CLion and wanted to use MPI. Since I am on Windows, I installed MS-MPI (the MSMPI and the SDK), and have my CMakeLists.txt as follows:
cmake_minimum_required(VERSION 3.10)
project(ppc)
set(CMAKE_C_STANDARD 11)
find_package(MPI REQUIRED)
add_executable(ppc main.c)
target_link_libraries(main PRIVATE MPI::MPI_C)
The problem is that whenever I try to import/reload the project, I get the following error:
C:\Users\frani\AppData\Local\JetBrains\CLion2020.2\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/make.exe -DCMAKE_CXX_COMPILER=/usr/bin/g++.exe -G "CodeBlocks - Unix Makefiles" /cygdrive/d/Dev/CLionProjects/ppc
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
CMake Error at /cygdrive/c/Users/frani/AppData/Local/JetBrains/CLion2020.2/cygwin_cmake/share/cmake-3.17.3/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Reason given by package: MPI component 'Fortran' was requested, but language Fortran is not enabled.
Call Stack (most recent call first):
/cygdrive/c/Users/frani/AppData/Local/JetBrains/CLion2020.2/cygwin_cmake/share/cmake-3.17.3/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/cygdrive/c/Users/frani/AppData/Local/JetBrains/CLion2020.2/cygwin_cmake/share/cmake-3.17.3/Modules/FindMPI.cmake:1717 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/d/Dev/CLionProjects/ppc/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/d/Dev/CLionProjects/ppc/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
What is wrong with my file?
Try to add this after your project declaration:
enable_language(Fortran)
(https://cmake.org/cmake/help/latest/command/enable_language.html)

Does check_include_files() work if compiler check (-DCMAKE_C_COMPILER_WORKS=1) is skipped?

I am having an issue that I am using a compiler to generate binaries that are only meant to run on a simulator. For this reason cmake configuration errors out saying that my c compiler does not work. As a work around, I have used this command to configure my cmake project:
cmake -DCMAKE_C_COMPILER_WORKS=1 ../
Which skips the compiler check and proceeds to the next checks.
Now cmake is trying to check other header files:
include_directories (/my-libc/include)
include(CheckIncludeFiles)
check_include_files(memory.h HAVE_MEMORY_HEADERS)
check_include_files(stdint.h HAVE_STDINT_HEADERS)
...
where "cmake -DCMAKE_C_COMPILER_WORKS=1 ../" yields configuration errors like:
-- Looking for include file memory.h
-- Looking for include file memory.h - not found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - not found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - not found
-- Looking for include file strings.h
-- Looking for include file strings.h - not found
-- Looking for include file string.h
-- Looking for include file string.h - not found
I am having trouble isolating the source of this error. Are all these checks tied to my compiler check skip?

ORB SLAM2 build error with eigen3

I am trying to build ORBSLAM2 but i always get some errors. I don't know the reason. I am pasting command line output. How can I solve the errors? has someone done this before?
orbslam#essafius-Latitude-E6430:~$ cd ORB_SLAM2
orbslam#essafius-Latitude-E6430:~/ORB_SLAM2$ chmod +x build.sh
orbslam#essafius-Latitude-E6430:~/ORB_SLAM2$ ./build.sh
Configuring and building Thirdparty/DBoW2 ...
mkdir: cannot create directory ‘build’: File exists
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orbslam/ORB_SLAM2/Thirdparty/DBoW2/build
[100%] Built target DBoW2
Configuring and building Thirdparty/g2o ...
mkdir: cannot create directory ‘build’: File exists
-- BUILD TYPE:Release
-- Compiling on Unix
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orbslam/ORB_SLAM2/Thirdparty/g2o/build
[100%] Built target g2o
Uncompress vocabulary ...
Configuring and building ORB_SLAM2 ...
mkdir: cannot create directory ‘build’: File exists
Build type: Release
-- Using flag -std=c++11.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orbslam/ORB_SLAM2/build
[ 3%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o
[ 6%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o
[ 9%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o
[ 12%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/System.cc.o
[ 15%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o
In file included from /home/orbslam/ORB_SLAM2/Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h:34:0,
from /home/orbslam/ORB_SLAM2/include/LoopClosing.h:34,
from /home/orbslam/ORB_SLAM2/include/LocalMapping.h:26,
from /home/orbslam/ORB_SLAM2/include/Tracking.h:31,
from /home/orbslam/ORB_SLAM2/include/FrameDrawer.h:24,
from /home/orbslam/ORB_SLAM2/include/Viewer.h:25,
from /home/orbslam/ORB_SLAM2/src/Viewer.cc:21:
/home/orbslam/ORB_SLAM2/Thirdparty/g2o/g2o/types/../core/base_vertex.h:62:74: warning: ‘Eigen::AlignedBit’ is deprecated [-Wdeprecated-declarations]
typedef Eigen::Map<Matrix<double, D, D>, Matrix<double,D,D>::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockType;
https://github.com/raulmur/ORB_SLAM2/issues/317
^Their github log is good for solving common issues, It seems you are having an issue with your Eigen version, get an older one and recompile everything.

C cross compile for raspberry pi with cmake fails to find header file

I'm trying to port a program that runs fine in x86 architecture (Linux Mint 17.1) to a Raspberry Pi (Raspbian Jessie Lite). I'm using CMake, so I just followed the nice guide in Crafty Bytes.
My toolchain-raspberrypi.cmake looks like this:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
# Specify the cross compiler
SET(CMAKE_C_COMPILER $ENV{HOME}/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc)
#SET(CMAKE_C_FLAGS "-L$ENV{HOME}/rpi/rootfs/usr/lib/arm-linux-gnueabihf -I$ENV{HOME}$ENV{HOME}/rpi/rootfs/usr/include")
# Where is the target environment
SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/rpi/rootfs)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
# Search for programs only in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers only in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
CMake generates the Makefiles and seems to find all the required libraries:
$ cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_TOOLCHAIN_FILE=/home/unknown/rpi/toolchain-raspberrypi.cmake ..
-- The C compiler identification is GNU 4.8.3
-- Check for working C compiler: /home/unknown/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /home/unknown/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of intmax_t
-- Check size of intmax_t - done
-- Check size of uintmax_t
-- Check size of uintmax_t - done
-- Check size of pid_t
-- Check size of pid_t - done
-- Found Lua51: /home/unknown/rpi/rootfs/usr/lib/arm-linux-gnueabihf/liblua5.1.so;/home/unknown/rpi/rootfs/usr/lib/arm-linux-gnueabihf/libm.so (found version "5.1.5")
-- Luaudio_INCLUDE_DIRS: /home/unknown/rpi/rootfs/usr/include/lua5.1
-- LUA_LIBRARIES: /home/unknown/rpi/rootfs/usr/lib/arm-linux-gnueabihf/liblua5.1.so;/home/unknown/rpi/rootfs/usr/lib/arm-linux-gnueabihf/libm.so
-- Found libusb-1.0:
-- - Includes: /home/unknown/rpi/rootfs/usr/include/libusb-1.0
-- - Libraries: /home/unknown/rpi/rootfs/usr/lib/libusb-1.0.a
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for one of the modules 'check'
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found libusb-1.0:
-- - Includes: /home/unknown/rpi/rootfs/usr/include/libusb-1.0
-- - Libraries: /home/unknown/rpi/rootfs/usr/lib/libusb-1.0.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/unknown/projects/ha/workspace/ha/build-rpi
But when I run make I get an error trying to locate a library header:
$ make
Scanning dependencies of target ha
[ 2%] Building C object src/CMakeFiles/ha.dir/log.c.o
[ 5%] Building C object src/CMakeFiles/ha.dir/cm.c.o
/home/unknown/projects/ha/workspace/ha/src/cm.c:13:31: fatal error: libusb-1.0/libusb.h: No such file or directory
#include <libusb-1.0/libusb.h>
^
compilation terminated.
make[2]: *** [src/CMakeFiles/ha.dir/cm.c.o] Error 1
make[1]: *** [src/CMakeFiles/ha.dir/all] Error 2
make: *** [all] Error 2
I'm totally stuck here. The files are there:
$ ls ~/rpi/rootfs/usr/include/libusb-1.0/ -l
total 72
-rw-r--r-- 1 unknown unknown 70156 jun 22 2014 libusb.h
$ ls ~/rpi/rootfs/usr/lib/libusb-1.0.a -l
-rw-r--r-- 1 unknown unknown 109920 jun 22 2014 /home/unknown/rpi/rootfs/usr/lib/libusb-1.0.a
And when running CMake with the --trace flag, it seems to find libusb related files:
/home/unknown/projectes/ha/workspace/ha/src/CMakeLists.txt(8): find_package(libusb-1.0 REQUIRED )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(46): if(LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(49): else(LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(50): find_path(LIBUSB_1_INCLUDE_DIR NAMES libusb.h PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES libusb-1.0 )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(62): find_library(LIBUSB_1_LIBRARY NAMES usb-1.0 usb PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(72): set(LIBUSB_1_INCLUDE_DIRS ${LIBUSB_1_INCLUDE_DIR} )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(75): set(LIBUSB_1_LIBRARIES ${LIBUSB_1_LIBRARY} )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(79): if(LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(80): set(LIBUSB_1_FOUND TRUE )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(83): if(LIBUSB_1_FOUND )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(84): if(NOT libusb_1_FIND_QUIETLY )
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(85): message(STATUS Found libusb-1.0: )
-- Found libusb-1.0:
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(86): message(STATUS - Includes: ${LIBUSB_1_INCLUDE_DIRS} )
-- - Includes: /home/unknown/rpi/rootfs/usr/include/libusb-1.0
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(87): message(STATUS - Libraries: ${LIBUSB_1_LIBRARIES} )
-- - Libraries: /home/unknown/rpi/rootfs/usr/lib/libusb-1.0.a
/usr/share/cmake-2.8/Modules/Findlibusb-1.0.cmake(96): mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES )
/home/unknown/projectes/ha/workspace/ha/src/CMakeLists.txt(10): INCLUDE_DIRECTORIES(${LIBUSB_1_INCLUDE_DIRS} )
I'm a newcomer to CMake and so far I've not been able to find any helpful entry in this site nor anywhere else regarding this same problem.
Any clue?
Problem
From the cmake --trace output one can see, that Findlibusb-1.0.cmake script, which search libusb-1.0 library, detects include directory for the library's headers via
find_path(LIBUSB_1_INCLUDE_DIR NAMES libusb.h ...)
This means, that the script expects libusb.h header to be included as
#include <libusb.h>
(The same conclusion can be deduced from the output of cmake call: line
- Includes: /home/unknown/rpi/rootfs/usr/include/libusb-1.0
already includes libusb-1.0 suffix for the include path.)
But error message shows, that cm.c file actually includes the header as
#include <libusb-1.0/libusb.h>
This means, that Findlibusb-1.0.cmake script you use (which is shipped with CMake itself) is not compatible with actual usage of the library in you project.
Ideal solution
You need to ship your project with compatible Findlibusb-1.0.cmake script, which uses
find_path(LIBUSB_1_INCLUDE_DIR NAMES libusb-1.0/libusb.h ...)
for detect include path. E.g., the one from PCL library. (At the beginning of your project's CMakeLists.txt you need to adjust CMAKE_MODULE_PATH variable for find the script.)
As fast workaround
You may replace path /home/unknown/rpi/rootfs/usr/include/libusb-1.0 with /home/unknown/rpi/rootfs/usr/include in the CMake cache. (After modification of the cache you need to rerun cmake).
Because cached value is likely used in include_directories() call from your project, proper directory will be used instead.
I'm wondering why find_package works differently when cross compiling.
More likely that find_package works identical on PC and when cross-compiling, but on PC you get path /usr/include being included by other means (e.g., it is included by default).

Linking to Armadillo libraries with CMake

I am trying to install MLPack on windows 8.
I configure the CMakeLists.txt file with:
set(ARMADILLO_LIBRARY "C:\\Program Files (x86)\\armadillo\\lib")
set(ARMADILLO_INCLUDE_DIR "C:\\Program Files (x86)\\armadillo\\include")
Then when I ran CMake I had a whole series of warning like these ones:
WARNING: Target "mlpack" requests linking to directory "C:\Program Files (x86)\armadillo\lib". Targets may link only to libraries. CMake is dropping the item.
In \mlpack-1.0.4\src\mlpack directory I found another CMakeLists file with:
target_link_libraries(mlpack
${ARMADILLO_LIBRARIES}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
)
that I changed to (not sure if that was a good idea):
target_link_libraries(mlpack
${Boost_LIBRARIES}
)
link_directories(mlpack
${ARMADILLO_LIBRARIES}
${LIBXML2_LIBRARIES}
)
then CMake seems to be running smoothly:
-- Found Armadillo: C:\Program Files (x86)\armadillo\lib (found suitable version "3.800.2", minimum required is "2.4.2")
-- Found LibXml2: C:\cpp\libraries\libxml2-2.7.8.win32\lib (found suitable version "2.7.8", minimum required is "2.6.0")
-- Boost version: 1.53.0
-- Found the following Boost libraries:
-- program_options
-- unit_test_framework
-- Boost version: 1.53.0
-- Found the following Boost libraries:
-- random
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cpp/libraries/mlpack-1.0.4
but now when running make I have tons of such errors :
Linking CXX executable ..\..\..\..\gmm.exe
CMakeFiles\gmm.dir/objects.a(gmm_main.cpp.obj):gmm_main.cpp:(.text+0xb9): undefined reference to `wrapper_dgemv_'
CMakeFiles\gmm.dir/objects.a(gmm_main.cpp.obj):gmm_main.cpp:(.text$_ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb[__ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb]+0x115): undefined reference to `wrapper_dgetrf_'
which after investigation seems to be related to Armadillo.
Any idea what is happening ? I guess I should use target_link_libraries for Armadillo but I am not sure how.
The issue is hopefully pretty easy to resolve. When you do this...
set(ARMADILLO_LIBRARY "C:\\Program Files (x86)\\armadillo\\lib")
set(ARMADILLO_INCLUDE_DIR "C:\\Program Files (x86)\\armadillo\\include")
you're effectively short-circuiting the find_package(Armadillo 2.4.2 REQUIRED) call, since it expects to have to do the work to find these paths. However, when find_package does the work, the variable ARMADILLO_LIBRARY gets set to the path to the library itself - not the path to the lib's directory.
So the problem boils down to setting ARMADILLO_LIBRARY to the path to the lib's directory rather than the lib itself. This ultimately yields a linker error since the target gmm (added in src\mlpack\methods\gmm\CMakeLists.txt) links to mlpack, and mlpack has been set to link to ${ARMADILLO_LIBRARIES}, which isn't set correctly.
It turns out that find_package(Armadillo ...) already checks in "$ENV{ProgramFiles}/Armadillo/lib" and "$ENV{ProgramFiles}/Armadillo/include", and I expect these resolve to "C:\\Program Files (x86)\\armadillo\\lib" and "C:\\Program Files (x86)\\armadillo\\include" on your machine.
So to fix this, you should delete the lines setting ARMADILLO_LIBRARY and ARMADILLO_INCLUDE_DIR, and revert your change in src\mlpack\CMakeLists.txt (using link_directories is generally a bad idea anyway).
After making these changes, you should delete at least your CMakeCache.txt (in the root of your build tree), or even your entire build tree before re-running CMake to avoid the possibility of using bad cached values from previous failed attempts.
I realize this is a late answer, and I hope you have it figured out by now. Even so, I believe your issue is that the ARMADILLO_LIBRARY variable should hold the exact location of the library, instead of the directory the library is in. So, maybe this would work:
set(ARMADILLO_LIBRARY "C:\\Program Files (x86)\\armadillo\\lib\\armadillo.lib")
set(ARMADILLO_INCLUDE_DIR "C:\\Program Files (x86)\\armadillo\\include")
The variable LIBXML2_LIBRARIES should also contain the actual path of libxml2.lib (or whatever the actual library is called).
Have you seen this page of instructions I wrote a while back for compiling mlpack on Windows?
http://www.mlpack.org/trac/wiki/MLPACKOnWindows
Feel free to file a bug report on Trac if you have further problems in the future. I only stumbled upon this by chance, so I don't monitor Stack Overflow for issues.
I ran into the same problem. There are two bullets aramadillo library faq which ask you to uncomment the lines
#define ARMA_USE_LAPACK
#define ARMA_USE_WRAPPER
in the file
include/armadillo_bits/config.hpp
which is in the armadillo source tree.
When you recompile after uncommenting the lines, you can see the symbols in the armadillo shared library/dll. Hope this helps!

Resources