balena / elixir-sippet

An Elixir library designed to be used as SIP protocol middleware.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: ‘numeric_limits’ is not a member of ‘std’

blackham opened this issue · comments

Problem:

/home/your_mom/dev/my_bed/deps/sippet/c_src/utils.cc: In static member function ‘static bool {anonymous}::IteratorRangeToNumber<IteratorRangeToNumberTraits>::Invoke(const_iterator, const_iterator, value_type*)’:
/home/your_mom/dev/my_bed/deps/sippet/c_src/utils.cc:99:17: error: ‘numeric_limits’ is not a member of ‘std’
99 |       if (!std::numeric_limits<value_type>::is_signed) {

Hack:
Edit the ./deps/sippet/c_src/utils.cc and add #include < limits >

#include <string>
#include <iostream>
#include <limits>

Fix:
Eh... I'm happy with the hack.

System:
Arch Linux

brett@beefstick: /tmp $ uname -a
Linux beefstick 6.1.15-1-lts #1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 12:22:08 +0000 x86_64 GNU/Linux
brett@beefstick: /tmp $ gcc --version
gcc (GCC) 12.2.1 20230201
Copyright (C) 2022 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.

I'm happy too. Just to be on the safe side, would worth checking if the same compiles on other sane OSes. Do you have any other box to test?

Glad to..

System:
Ubuntu 22.04.1 LTS
apt-get elixir build-essential


elixir --version
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

Elixir 1.13.4 (compiled with Erlang/OTP 25)

root@swiper:~# gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 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.

root@swiper:~# uname -a
Linux swiper 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux


Pre-hack mix compile result:
==> sippet

g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/utils.o /tmp/quagmire/deps/sippet/c_src/utils.cc
/tmp/quagmire/deps/sippet/c_src/utils.cc: In static member function ‘static bool {anonymous}::IteratorRangeToNumber<IteratorRangeToNumberTraits>::Invoke({anonymous}::IteratorRangeToNumber<IteratorRangeToNumberTraits>::const_iterator, {anonymous}::IteratorRangeToNumber<IteratorRangeToNumberTraits>::const_iterator, {anonymous}::IteratorRangeToNumber<IteratorRangeToNumberTraits>::value_type*)’:
/tmp/quagmire/deps/sippet/c_src/utils.cc:99:17: error: ‘numeric_limits’ is not a member of ‘std’
99 |       if (!std::numeric_limits<value_type>::is_signed) {
|                 ^~~~~~~~~~~~~~
/tmp/quagmire/deps/sippet/c_src/utils.cc:99:42: error: expected primary-expression before ‘>’ token
99 |       if (!std::numeric_limits<value_type>::is_signed) {

Post-hack mix compile result:

core@swiper:/tmp/quagmire$ mix compile
==> sippet
g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/utils.o /tmp/quagmire/deps/sippet/c_src/utils.cc
g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/string_piece.o /tmp/quagmire/deps/sippet/c_src/string_piece.cc
g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/tokenizer.o /tmp/quagmire/deps/sippet/c_src/tokenizer.cc
g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/parser.o /tmp/quagmire/deps/sippet/c_src/parser.cc
g++ -O3 -std=c++11 -finline-functions -fstack-protector -Wall -fPIC -I /usr/lib/erlang/erts-13.0.4/include -I /usr/lib/erlang/usr/include  -c -o /tmp/quagmire/deps/sippet/c_src/prtime.o /tmp/quagmire/deps/sippet/c_src/prtime.cc
cc /tmp/quagmire/deps/sippet/c_src/utils.o /tmp/quagmire/deps/sippet/c_src/string_piece.o /tmp/quagmire/deps/sippet/c_src/tokenizer.o /tmp/quagmire/deps/sippet/c_src/parser.o /tmp/quagmire/deps/sippet/c_src/prtime.o -shared -lstdc++ -L /usr/lib/erlang/usr/lib -lei -o /tmp/quagmire/deps/sippet/priv/sippet_nif.so
Compiling 19 files (.ex)
Generated sippet app

Awesome! If you're still available, would you post a PR with the change? I make the merge and push to Hex later.

I'll give it a try. Last patch I submitted was pre-git.

/tmp/elixir-sippet $ git diff
diff --git a/c_src/utils.cc b/c_src/utils.cc
index 51e1547..4b15b8a 100644
--- a/c_src/utils.cc
+++ b/c_src/utils.cc
@@ -11,6 +11,7 @@

#include <string>
#include <iostream>
+#include <limits>

namespace {

Sorry for the multiple commits. First time editing directly in github.

Solved in release 1.0.11