swiftmongodbubuntu-16.04perfect

Perfect + Mongo project build errors on ubuntu


I'm getting these errors when trying to build swift app that uses Perfect-HTTPServer and Perfect-MongoDB package dependensies

Compile Swift Module 'MongoDB' (7 sources)
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "/usr/local/include/libmongoc-1.0/mongoc.h"
         ^
/usr/local/include/libmongoc-1.0/mongoc.h:22:10: error: 'bson.h' file not found
#include <bson.h>
         ^
/root/mobile-backend/Packages/MongoDB-2.0.8/Sources/MongoDB/MongoGridFS.swift:20:8: error: could not build Objective-C module 'libmongoc'
import libmongoc
       ^
<unknown>:0: error: build had 1 command failures

Both libbson and libmongoc are installed:

~# apt-get install libmongoc-dev libbson-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libbson-dev is already the newest version (1.3.1-1).
libmongoc-dev is already the newest version (1.3.1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I ensured they are symlinked to the location as instructed on Perfect-MongoDB:

~# ls -l /usr/local/include
total 0
lrwxrwxrwx 1 root root 24 Mar 20 17:05 libbson-1.0 -> /usr/include/libbson-1.0
lrwxrwxrwx 1 root root 26 Mar 20 17:00 libmongoc-1.0 -> /usr/include/libmongoc-1.0

Solution

  • Ok, here I've found this magical list of dependencies for perfect that fixed error for me. I'm not sure what missing package out of those was causing the issue, but it works now.

    # apt-get install clang pkg-config libicu-dev libpython2.7 libxml2-dev wget git libssl-dev uuid-dev libsqlite3-dev libpq-dev libmysqlclient-dev libbson-dev libmongoc-dev libcurl4-openssl-dev
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    git is already the newest version (1:2.7.4-0ubuntu1).
    libbson-dev is already the newest version (1.3.1-1).
    libmongoc-dev is already the newest version (1.3.1-1).
    libicu-dev is already the newest version (55.1-7ubuntu0.1).
    libpython2.7 is already the newest version (2.7.12-1ubuntu0~16.04.1).
    libssl-dev is already the newest version (1.0.2g-1ubuntu4.6).
    uuid-dev is already the newest version (2.27.1-6ubuntu3.2).
    wget is already the newest version (1.17.1-1ubuntu1.1).
    clang is already the newest version (1:3.8-33ubuntu3.1).
    The following additional packages will be installed:
      build-essential comerr-dev cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5 krb5-multidev libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libcc1-0
      libdpkg-perl libfakeroot libfile-fcntllock-perl libgssrpc4 libisl15 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libmpc3 libmysqlclient20 libpq5 make mysql-common
    Suggested packages:
      doc-base cpp-doc gcc-5-locales debian-keyring g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg gcc-multilib autoconf automake libtool flex bison gdb gcc-doc
      gcc-5-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg libquadmath0-dbg
      krb5-doc libcurl4-doc libcurl3-dbg libidn11-dev libkrb5-dev libldap2-dev librtmp-dev krb5-user postgresql-doc-9.5 sqlite3-doc make-doc
    The following NEW packages will be installed:
      build-essential comerr-dev cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5 krb5-multidev libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libcc1-0
      libcurl4-openssl-dev libdpkg-perl libfakeroot libfile-fcntllock-perl libgssrpc4 libisl15 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libmpc3 libmysqlclient-dev
      libmysqlclient20 libpq-dev libpq5 libsqlite3-dev libxml2-dev make mysql-common pkg-config
    0 upgraded, 34 newly installed, 0 to remove and 0 not upgraded.
    Need to get 30.4 MB of archives.
    After this operation, 97.4 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y