abunchofhacks / Epicinium

A strategy game with simultaneous turns where nature is a finite resource
GNU Affero General Public License v3.0
47 stars 5 forks source link

Unbreak build with BSD iconv #4

Closed jbeich closed 3 years ago

jbeich commented 3 years ago

DragonFly, FreeBSD, NetBSD (but not OpenBSD) have iconv* support from Citrus Project. What causes ambiguity is system iconv_t defined as a struct pointer instead a void pointer.

Clang error ```c++ $ c++ --version FreeBSD clang version 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-0-g176249bd673) Target: x86_64-unknown-freebsd13.0 Thread model: posix InstalledDir: /usr/bin $ CPATH=/usr/local/include gmake .obj/libs/tinygettext/iconv.o c++ -std=c++17 -MT .obj/libs/tinygettext/iconv.o -MMD -MP -MF .dep/libs/tinygettext/iconv.Td -O3 -s -I ./ -I libs -I libs/SDL2 -o .obj/libs/tinygettext/iconv.o -c libs/tinygettext/iconv.cpp libs/tinygettext/iconv.cpp:50:5: error: call to 'iconv_close' is ambiguous iconv_close(cd); ^~~~~~~~~~~ /usr/include/iconv.h:61:5: note: candidate function int iconv_close(iconv_t); ^ libs/tinygettext/iconv.hpp:69:12: note: candidate function inline int iconv_close(iconv_t cd) ^ libs/tinygettext/iconv.cpp:57:5: error: call to 'iconv_close' is ambiguous iconv_close(cd); ^~~~~~~~~~~ /usr/include/iconv.h:61:5: note: candidate function int iconv_close(iconv_t); ^ libs/tinygettext/iconv.hpp:69:12: note: candidate function inline int iconv_close(iconv_t cd) ^ libs/tinygettext/iconv.cpp:119:9: error: call to 'iconv' is ambiguous iconv(cd, nullptr, nullptr, nullptr, nullptr); // reset state ^~~~~ /usr/include/iconv.h:58:8: note: candidate function size_t iconv(iconv_t, char ** __restrict, ^ libs/tinygettext/iconv.hpp:58:15: note: candidate function inline size_t iconv(iconv_t cd, ^ ```
GCC error ```c++ $ g++11 --version g++11 (FreeBSD Ports Collection) 11.0.0 20201108 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ CXX=g++11 gmake .obj/libs/tinygettext/iconv.o 3& iconv γ /tmp/epicinium g++11 -std=c++17 -MT .obj/libs/tinygettext/iconv.o -MMD -MP -MF .dep/libs/tinygettext/iconv.Td -O3 -s -I ./ -I libs -I libs/SDL2 -o .obj/libs/tinygettext/iconv.o -c libs/tinygettext/iconv.cpp libs/tinygettext/iconv.cpp: In destructor 'tinygettext::IConv::~IConv()': libs/tinygettext/iconv.cpp:50:19: error: call of overloaded 'iconv_close(__tag_iconv_t*&)' is ambiguous 50 | iconv_close(cd); | ^ In file included from libs/tinygettext/iconv.cpp:28: libs/tinygettext/iconv.hpp:69:12: note: candidate: 'int tinygettext::iconv_close(tinygettext::iconv_t)' 69 | inline int iconv_close(iconv_t cd) | ^~~~~~~~~~~ In file included from libs/tinygettext/iconv.hpp:28, from libs/tinygettext/iconv.cpp:28: /usr/include/iconv.h:61:9: note: candidate: 'int iconv_close(iconv_t)' 61 | int iconv_close(iconv_t); | ^~~~~~~~~~~ libs/tinygettext/iconv.cpp: In member function 'void tinygettext::IConv::set_charsets(const string&, const string&)': libs/tinygettext/iconv.cpp:57:19: error: call of overloaded 'iconv_close(__tag_iconv_t*&)' is ambiguous 57 | iconv_close(cd); | ^ In file included from libs/tinygettext/iconv.cpp:28: libs/tinygettext/iconv.hpp:69:12: note: candidate: 'int tinygettext::iconv_close(tinygettext::iconv_t)' 69 | inline int iconv_close(iconv_t cd) | ^~~~~~~~~~~ In file included from libs/tinygettext/iconv.hpp:28, from libs/tinygettext/iconv.cpp:28: /usr/include/iconv.h:61:9: note: candidate: 'int iconv_close(iconv_t)' 61 | int iconv_close(iconv_t); | ^~~~~~~~~~~ libs/tinygettext/iconv.cpp: In member function 'std::string tinygettext::IConv::convert(const string&)': libs/tinygettext/iconv.cpp:119:53: error: call of overloaded 'iconv(__tag_iconv_t*&, std::nullptr_t, std::nullptr_t, std::nullptr_t, std::nullptr_t)' is ambiguous 119 | iconv(cd, nullptr, nullptr, nullptr, nullptr); // reset state | ^ In file included from libs/tinygettext/iconv.cpp:28: libs/tinygettext/iconv.hpp:58:15: note: candidate: 'size_t tinygettext::iconv(tinygettext::iconv_t, const char**, size_t*, char**, size_t*)' 58 | inline size_t iconv(iconv_t cd, | ^~~~~ In file included from libs/tinygettext/iconv.hpp:28, from libs/tinygettext/iconv.cpp:28: /usr/include/iconv.h:58:9: note: candidate: 'size_t iconv(iconv_t, char**, size_t*, char**, size_t*)' 58 | size_t iconv(iconv_t, char ** __restrict, | ^~~~~ ```
SLiV9 commented 3 years ago

Thanks! I've also made a pull request for the original repo (https://github.com/tinygettext/tinygettext/pull/32) based on your changes.