Issue when building with cmake


I am finding some errors when building MapD with cmake:

According to your instructions:

  1. mkdir build
  2. cd build
  3. cmake -DCMAKE_BUILD_TYPE=debug …
  4. make -j 4

Things seem to go fine till step 3, with the following output:
– Configuring done
– Generating done
– Build files have been written to: /home/karol/mapd-core

If I inspect the new build directory, I find the following:

total 36
drwxrwxr-x 4 karol karol 4096 dic 14 22:20 CMakeFiles
-rw-rw-r-- 1 karol karol 20555 dic 14 22:20 CMakeCache.txt
-rw-rw-r-- 1 karol karol 0 dic 14 22:38 cd
drwxrwxr-x 2 karol karol 4096 dic 15 02:43 data
drwxrwxr-x 13 karol karol 4096 dic 15 03:06 thrift

So, there is no Makefile there (CMakeFiles is a directory).

Thus, when executing step 4. make -j 4, I receive the following error:

make: *** No targets specified and no makefile found. Stop.

From here, onwards:

karol@karol-G551JW:~/mapd-core$ ./bin/initdb --data ~/mapd-data
bash: ./bin/initdb: No such file or directory

Analyzing further, if I inspect the mapd-core/bin directory, I can find only this executable:

While in the parent directory, mapd-core, I can find:
MapDServer.h and MapDServer.cpp (but not compiled)
Also, initdb.cpp is there, but not compiled.

I have noticed that initdb.cpp is incluided in root (mapd-core), inside CMakeLists.txt (lines 340-341)

set(initdb_source_files initdb.cpp)
add_executable(initdb ${initdb_source_files})

The same happens with MapDServer.cpp (line 377-379)

343 set(mapd_server_source_files MapDServer.cpp {CMAKE_BINARY_DIR}/MapDRelease.h) 344 345 add_executable(mapd_server {mapd_server_source_files})

NOTE: I realize that I am also checking 2 different versions of the same CMakeLists.txt, and there are changes on the line numbers (please, check the line numbers). (This will require from my side a further analysis on eventual new version of this file).

Line 343 shows the MapDServer.cpp file while line 345 shows mapd_server, already compiled.

My first conclusion: that CMakeLists.txt is the required file for CMake, to build the executables but, for some reason, it is not using it.

However, in the same CMakeList.txt file (line 437 ) I can find MapDWebServer.go Golang source file and its correponding executable: /bin/mapd_web_server (located in bin, which is actually the only one compiled).

437 COMMAND GOPATH={CMAKE_BINARY_DIR}/go {GO_EXECUTABLE} build -ldflags "-X main.version={CPACK_PACKAGE_VER SION}" -o {CMAKE_BINARY_DIR}/bin/mapd_web_server ${CMAKE_SOURCE_DIR}/MapDWebServer.go

Thus, my second conclusion is that CMake and CMakeLists.txt are working together but, for some reason, they are not building up the cpp files.

Logically, if I go to root (mapd-core) and execute ./startmapd, I receive:

Backend TCP: localhost:9091
Backend HTTP: localhost:9090
Frontend Web: localhost:9092
./startmapd: line 81: ./bin/initdb: No such file or directory

I am stuck at this point, trying different workarounds but without success.

Could you advise, please?

Thanks in advance!


got a similar problem last time i refresh mapdcore and deleted the old vuild directory

from mapd-core directory use this command

cmake -H. -Bbuild
then go in build dir and use the make command; it would work


Is it possible that you once accidentally ran cmake in the top-level of the repository, in addition to running it in the build directory? CMake tries to be a little too smart, so if it sees some of its generated files (CMakeFiles, CMakeCache.txt) in what should be the source directory, it will assume that it’s actually the build dir and will place the files there instead. In other words, see if there’s a Makefile in /home/karol/mapd-core - the line Build files have been written to: /home/karol/mapd-core makes me suspect that they’re there instead of the expected /home/karol/mapd-core/build.

Easiest solution would be to start with a completely fresh clone of the repository.

mv mapd-core mapd-core.orig
git clone
cd mapd-core
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=debug ..
make -j 4


First of all, thanks very much @aznable and @andrew, for your help.
I found the issue this morning: since I had previously “collected”, as my own documentation, all the steps I had followed to build up MapD in my environment (let’s say: I made my own tutorial… :smiley: ), I just decided to review that tutorial step by step.
And I found that, accidentally, I had missed one step while installing dependencies (I had started the MapD installation from 02:00 AM in the morning…!).
On the other side, I had also installed Timeshift in my Ubuntu 16.04, and setup it to take full snapshots of my machine every hour (just in case I forgot taken it manually). Of course, this is a very costly procedure, since the drive space point of view, but very useful when you need to rollback some installation -like MapD-, which requires several dependencies. You just need to take a new snapshot when a successful stage is achieved. Instead, is something goes wrong, you have now the ability to rollback to the previous successful stage. And this was what I did: I confer my “own tutorial” against the snapshots I had taken and just rollbacked (properly, I restored the machine to the previous “correct status”) and restarted the building process from that point onwards. This process is similar to Andrew’s suggestion, but -maybe- quite more “sophisticated”, but -I repeat- very useful when you do this with a new tool. Finally, after successful built and installation, you just need to drop away all those no-more-useful snapshots!
Well, thanks again for your help and advices! I have now my MapD healthy running in my system!
Regards! KB.