libjson для Си переименовали

Теперь это libjson-c вместо libjson (и довольно давно).

Недавно попытался скомпилировать свой guerillamail-cli и столкнулся с фатальной ошибкой линкера:

/usr/bin/ld: cannot find -ljson
collect2: error: ld returned 1 exit status
src/CMakeFiles/guerillamail.dir/build.make:147: recipe for target 'src/bin/guerillamail' failed
make[2]: *** [src/bin/guerillamail] Error 1
CMakeFiles/Makefile2:190: recipe for target 'src/CMakeFiles/guerillamail.dir/all' failed
make[1]: *** [src/CMakeFiles/guerillamail.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Случилась эта ошибка из-за отсутствия в свежих релизах ubuntu пакета libjson0, который я ранее использовал для приложения. По словам разработчиков, они переименовали json в json-c во избежание конфликтов с прочими json библиотеками, пруф:

Oh, that’s the same «problem», just on the link side.  We changed the name of the library from «json» to «json-c» to help avoid conflicts with other json libraries.  Unsurprisingly, many of them use «libjson.so», which can cause various hard to puzzle out errors.
You should just change whereever in the stackoverflow-cli makesfiles it says «-ljson» and use «-ljson-c».

https://groups.google.com/d/msg/json-c/e_uHbS6ANtE/dWed8yCNBAAJ

Поэтому заменяем в подключении заголовочных файлов json/json.h на json-c/json.h и соответственно меняем -ljson на -ljson-c в Makefile.

Комментарии

comments powered by Disqus
Яндекс.Метрика