mattn / mattn/libcallex-vim

Fails to link against system picojson

Open
#4 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Hi, I wanted to package this plugin for debian.
Linking against the system version of picojson fails though:

g++ -static-libgcc -fPIC -static-libstdc++ -shared -o libcallex.so libcallex.cxx -lffi
libcallex.cxx: In function ‘const char* libcallex_call(const char*)’:
libcallex.cxx:146:40: error: no match for ‘operator=’ (operand types are ‘std::map<std::__cxx11::basic_string<char>, picojson::value>::mapped_type’ {aka ‘picojson::value’} and ‘std::__cxx11::basic_stringstream<char>::__string_type’ {aka ‘std::__cxx11::basic_string<char>’})
  146 |                 obj["return"] = ss.str();
      |                                        ^
In file included from libcallex.cxx:9:
/usr/include/picojson.h:329:15: note: candidate: ‘picojson::value& picojson::value::operator=(const picojson::value&)’
  329 | inline value &value::operator=(const value &x) {
      |               ^~~~~
/usr/include/picojson.h:329:45: note:   no known conversion for argument 1 from ‘std::__cxx11::basic_stringstream<char>::__string_type’ {aka ‘std::__cxx11::basic_string<char>’} to ‘const picojson::value&’
  329 | inline value &value::operator=(const value &x) {
      |                                ~~~~~~~~~~~~~^
/usr/include/picojson.h:341:15: note: candidate: ‘picojson::value& picojson::value::operator=(picojson::value&&)’
  341 | inline value &value::operator=(value &&x) PICOJSON_NOEXCEPT {
      |               ^~~~~
/usr/include/picojson.h:341:40: note:   no known conversion for argument 1 from ‘std::__cxx11::basic_stringstream<char>::__string_type’ {aka ‘std::__cxx11::basic_string<char>’} to ‘picojson::value&&’
  341 | inline value &value::operator=(value &&x) PICOJSON_NOEXCEPT {
      |                                ~~~~~~~~^
libcallex.cxx:147:21: error: no match for ‘operator=’ (operand types are ‘picojson::value’ and ‘picojson::object’ {aka ‘std::map<std::__cxx11::basic_string<char>, picojson::value>’})
  147 |                 v = obj;
      |                     ^~~
/usr/include/picojson.h:329:15: note: candidate: ‘picojson::value& picojson::value::operator=(const picojson::value&)’
  329 | inline value &value::operator=(const value &x) {
      |               ^~~~~
/usr/include/picojson.h:329:45: note:   no known conversion for argument 1 from ‘picojson::object’ {aka ‘std::map<std::__cxx11::basic_string<char>, picojson::value>’} to ‘const picojson::value&’
  329 | inline value &value::operator=(const value &x) {
      |                                ~~~~~~~~~~~~~^
/usr/include/picojson.h:341:15: note: candidate: ‘picojson::value& picojson::value::operator=(picojson::value&&)’
  341 | inline value &value::operator=(value &&x) PICOJSON_NOEXCEPT {
      |               ^~~~~
/usr/include/picojson.h:341:40: note:   no known conversion for argument 1 from ‘picojson::object’ {aka ‘std::map<std::__cxx11::basic_string<char>, picojson::value>’} to ‘picojson::value&&’
  341 | inline value &value::operator=(value &&x) PICOJSON_NOEXCEPT {
      |                                ~~~~~~~~^
libcallex.cxx:165:40: error: ‘picojson::value::value(const T*) [with T = char]’ is private within this context
  165 |                 obj["error"] = dlerror();
      |                                        ^
/usr/include/picojson.h:202:25: note: declared private here
  202 |   template <typename T> value(const T *); // intentionally defined to block implicit conversion of pointer to bool
      |                         ^~~~~
make[2]: *** [Makefile:5: libcallex.so] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>/autoload'
make[1]: *** [debian/rules:11: execute_after_dh_autoreconf] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:7: binary] Error 2

The version of picojson included in the repo is really old; so I would appreciate support for linking against the system picojson.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libcallex.cxx at the reported assignments around lines 146-165 and compare them with the system picojson API shown in the compiler errors. Check the Makefile build target and reproduce the Debian build using the system header; done means libcallex.so builds successfully without the bundled old picojson.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.