ivanmejiarocha / micro-service

sample micro-service in C++
MIT License
263 stars 129 forks source link

had to adjust build_dependencies.sh to get everything to work #2

Closed kevinaud closed 6 years ago

kevinaud commented 6 years ago

Hey, let me start out by saying thanks for the time you spent creating this repo! It is the only example of the cpprestsdk I've found that shows how it could be used in a real project.

While I was going through the build process I did run into an issue though. On lines 19-21 of build_dependencies.sh there are these three lines:

if [[ "$OSTYPE" == "linux-gnu" ]]; then
    export CXX=g++-4.9
fi

I was running this on a Linux system, Ubuntu 16.04, and I had to comment out these lines in order to build the project. Before I commented them out I would get the following output from running build_dependencies.sh:

Cloning into './cpprestsdk'...                                                                
remote: Counting objects: 27188, done.                                                         
remote: Compressing objects: 100% (14/14), done.                                               
remote: Total 27188 (delta 7), reused 15 (delta 6), pack-reused 27168                          
Receiving objects: 100% (27188/27188), 9.28 MiB | 9.08 MiB/s, done.                            
Resolving deltas: 100% (20045/20045), done.                                                    
Checking connectivity... done.                                                                 
Checking out files: 100% (840/840), done.                                                      
Switched to a new branch 'v2.9.1'                                                              
CMake Error at /usr/share/cmake-3.5/Modules/CMakeDetermineCXXCompiler.cmake:56 (message):        
  Could not find compiler set in environment variable CXX:                                        

  g++-4.9.                                                                                       

Call Stack (most recent call first):                                                             
  CMakeLists.txt:3 (project)                                                                       

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage                                  
make: *** No targets specified and no makefile found.  Stop.     
ivanmejiarocha commented 6 years ago

Hi Kevin, I am sorry you got into trouble compiling the project, I use a Mac and for Linux I use Docker with Ubuntu Xenial (basically Ubuntu 16.04) it shouldn't be necessary to remove the lines 19-21 but what you can do is to:

$ export CXX=g++-4.9 

then run the 'build_dependencies.sh' shell script. Additionally please review which version of g++ is installed on your Linux box with the following command:

$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In my case as you can see is g++ 5.4 which to my knowledge is the default version installed in Ubuntu 16.04, so may be you can try with this command before executing the shell script:

$ export CXX=/usr/bin/g++
$ micro-service/libs/build_dependencies.sh

Take care, Ivan.

ivanmejiarocha commented 6 years ago

I guess I can close this issue now.