Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
131 stars 147 forks source link

Can't build against Casablanca in "atypical" location #375

Closed gri6507 closed 3 years ago

gri6507 commented 3 years ago

I have Casablanca (cpprest SDK) built locally and installed in /usr/lib/x86_64-linux-gnu/libcpprest.so. When I run

git clone https://github.com/Azure/azure-storage-cpp.git
cd azure-storage-cpp
git checkout v7.5.0
git submodule update --init
cd Microsoft.WindowsAzure.Storage
mkdir build.release
cd build.release
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF

this correctly finds Casablanca in the path shown above. However, when I then run cmake --build . I get the following error:

[ 98%] Building CXX object src/CMakeFiles/azurestorage.dir/crc64.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libcpprest.so', needed by 'Binaries/libazurestorage.so.7.5'.  Stop.
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/azurestorage.dir/all' failed
make[1]: *** [src/CMakeFiles/azurestorage.dir/all] Error 2

Why did CMake create a target for /usr/lib/x86_64-linux-gnu/libcpprest.so? What is the right way to build? Even though https://github.com/Azure/azure-storage-cpp#getting-started-on-linux has some instructions for specifying CASABLANCA_DIR to point to a custom directory, that still assumes a structure within that directory which I do not have.

For sake of completeness, this is on Ubuntu 18.04 system and I actually have /usr/lib/x86_64-linux-gnu/cmake/cpprestsdk/ with *.cmake files from my cpprest build.

gri6507 commented 3 years ago

This looks to be due to an error on my part because /usr/lib/x86_64-linux-gnu/libcpprest.so was a symlink to a non-existent file. Once I properly updated the symlink, CMake works fine.

I wish CMake was clearer about errors like this :-(