c++ubuntulibconfig

Stuck in installing libconfig


I downloaded the release of libconfig from github, and tried to compile it. I ran following commands in the directory of decompressed package:

mkdir build
cd build
cmake ..
make

Then the terminal output

/usr/include/c++/5/cstdlib:118:11: error: ‘::div_t’ has not been declared
   using ::div_t;
           ^
/usr/include/c++/5/cstdlib:119:11: error: ‘::ldiv_t’ has not been declared
   using ::ldiv_t;
           ^
/usr/include/c++/5/cstdlib:121:11: error: ‘::abort’ has not been declared
   using ::abort;
           ^
/usr/include/c++/5/cstdlib:122:11: error: ‘::abs’ has not been declared
   using ::abs;
           ^
/usr/include/c++/5/cstdlib:123:11: error: ‘::atexit’ has not been declared
   using ::atexit;
           ^
/usr/include/c++/5/cstdlib:129:11: error: ‘::atof’ has not been declared
   using ::atof;
           ^
/usr/include/c++/5/cstdlib:130:11: error: ‘::atoi’ has not been declared
   using ::atoi;
           ^
/usr/include/c++/5/cstdlib:131:11: error: ‘::atol’ has not been declared
   using ::atol;
           ^
/usr/include/c++/5/cstdlib:132:11: error: ‘::bsearch’ has not been declared
   using ::bsearch;
           ^
/usr/include/c++/5/cstdlib:133:11: error: ‘::calloc’ has not been declared
   using ::calloc;
           ^
/usr/include/c++/5/cstdlib:134:11: error: ‘::div’ has not been declared
   using ::div;
           ^
/usr/include/c++/5/cstdlib:135:11: error: ‘::exit’ has not been declared
   using ::exit;
           ^
/usr/include/c++/5/cstdlib:136:11: error: ‘::free’ has not been declared
   using ::free;
           ^
/usr/include/c++/5/cstdlib:137:11: error: ‘::getenv’ has not been declared
   using ::getenv;
           ^
/usr/include/c++/5/cstdlib:138:11: error: ‘::labs’ has not been declared
   using ::labs;
           ^
/usr/include/c++/5/cstdlib:139:11: error: ‘::ldiv’ has not been declared
   using ::ldiv;
           ^
/usr/include/c++/5/cstdlib:140:11: error: ‘::malloc’ has not been declared
   using ::malloc;
           ^
/usr/include/c++/5/cstdlib:142:11: error: ‘::mblen’ has not been declared
   using ::mblen;
           ^
/usr/include/c++/5/cstdlib:143:11: error: ‘::mbstowcs’ has not been declared
   using ::mbstowcs;
           ^
/usr/include/c++/5/cstdlib:144:11: error: ‘::mbtowc’ has not been declared
   using ::mbtowc;
           ^
/usr/include/c++/5/cstdlib:146:11: error: ‘::qsort’ has not been declared
   using ::qsort;
           ^
/usr/include/c++/5/cstdlib:152:11: error: ‘::rand’ has not been declared
   using ::rand;
           ^
/usr/include/c++/5/cstdlib:153:11: error: ‘::realloc’ has not been declared
   using ::realloc;
           ^
/usr/include/c++/5/cstdlib:154:11: error: ‘::srand’ has not been declared
   using ::srand;
           ^
/usr/include/c++/5/cstdlib:155:11: error: ‘::strtod’ has not been declared
   using ::strtod;
           ^
/usr/include/c++/5/cstdlib:156:11: error: ‘::strtol’ has not been declared
   using ::strtol;
           ^
/usr/include/c++/5/cstdlib:157:11: error: ‘::strtoul’ has not been declared
   using ::strtoul;
           ^
/usr/include/c++/5/cstdlib:158:11: error: ‘::system’ has not been declared
   using ::system;
           ^
/usr/include/c++/5/cstdlib:160:11: error: ‘::wcstombs’ has not been declared
   using ::wcstombs;
           ^
/usr/include/c++/5/cstdlib:161:11: error: ‘::wctomb’ has not been declared
   using ::wctomb;
           ^
/usr/include/c++/5/cstdlib:168:10: error: ‘ldiv_t’ does not name a type
   inline ldiv_t
          ^
/usr/include/c++/5/cstdlib:214:11: error: ‘::lldiv_t’ has not been declared
   using ::lldiv_t;
           ^
/usr/include/c++/5/cstdlib:220:11: error: ‘::_Exit’ has not been declared
   using ::_Exit;
           ^
/usr/include/c++/5/cstdlib:224:11: error: ‘::llabs’ has not been declared
   using ::llabs;
           ^
/usr/include/c++/5/cstdlib:226:10: error: ‘lldiv_t’ does not name a type
   inline lldiv_t
          ^
/usr/include/c++/5/cstdlib:230:11: error: ‘::lldiv’ has not been declared
   using ::lldiv;
           ^
/usr/include/c++/5/cstdlib:241:11: error: ‘::atoll’ has not been declared
   using ::atoll;
           ^
/usr/include/c++/5/cstdlib:242:11: error: ‘::strtoll’ has not been declared
   using ::strtoll;
           ^
/usr/include/c++/5/cstdlib:243:11: error: ‘::strtoull’ has not been declared
   using ::strtoull;
           ^
/usr/include/c++/5/cstdlib:245:11: error: ‘::strtof’ has not been declared
   using ::strtof;
           ^
/usr/include/c++/5/cstdlib:246:11: error: ‘::strtold’ has not been declared
   using ::strtold;
           ^
/usr/include/c++/5/cstdlib:254:22: error: ‘__gnu_cxx::lldiv_t’ has not been declared
   using ::__gnu_cxx::lldiv_t;
                      ^
/usr/include/c++/5/cstdlib:256:22: error: ‘__gnu_cxx::_Exit’ has not been declared
   using ::__gnu_cxx::_Exit;
                      ^
/usr/include/c++/5/cstdlib:258:22: error: ‘__gnu_cxx::llabs’ has not been declared
   using ::__gnu_cxx::llabs;
                      ^
/usr/include/c++/5/cstdlib:259:22: error: ‘__gnu_cxx::div’ has not been declared
   using ::__gnu_cxx::div;
                      ^
/usr/include/c++/5/cstdlib:260:22: error: ‘__gnu_cxx::lldiv’ has not been declared
   using ::__gnu_cxx::lldiv;
                      ^
/usr/include/c++/5/cstdlib:262:22: error: ‘__gnu_cxx::atoll’ has not been declared
   using ::__gnu_cxx::atoll;
                      ^
/usr/include/c++/5/cstdlib:263:22: error: ‘__gnu_cxx::strtof’ has not been declared
   using ::__gnu_cxx::strtof;
                      ^
/usr/include/c++/5/cstdlib:264:22: error: ‘__gnu_cxx::strtoll’ has not been declared
   using ::__gnu_cxx::strtoll;
                      ^
/usr/include/c++/5/cstdlib:265:22: error: ‘__gnu_cxx::strtoull’ has not been declared
   using ::__gnu_cxx::strtoull;
                      ^
/usr/include/c++/5/cstdlib:266:22: error: ‘__gnu_cxx::strtold’ has not been declared
   using ::__gnu_cxx::strtold;
                      ^
In file included from /home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.cc:23:0:
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++: In destructor ‘virtual libconfig::ParseException::~ParseException()’:
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++:70:3: error: ‘::free’ has not been declared
   ::free((void *)_file);
   ^
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++: In member function ‘libconfig::SettingException& libconfig::SettingException::operator=(const libconfig::SettingException&)’:
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++:206:3: error: ‘::free’ has not been declared
   ::free(_path);
   ^
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++: In destructor ‘virtual libconfig::SettingException::~SettingException()’:
/home/panfeng/downloads/libconfig-1.7.1/lib/libconfigcpp.c++:223:3: error: ‘::free’ has not been declared
   ::free(_path);
   ^
lib/CMakeFiles/libconfig++.dir/build.make:230: recipe for target 'lib/CMakeFiles/libconfig++.dir/libconfigcpp.cc.o' failed

After reading the installation instructions. I tried to run ./configure in the same directory, but the terminal warned bash: ./configure: no such files or directories exist. Who can help?


Solution

  • The github releases are not suitable for end-users. Download a release tarball from here:

    https://hyperrealm.github.io/libconfig/

    and then build using the configure script:

    cd libconfig-1.7.1
    ./configure
    make