Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to built with default setting on ubuntu 14.04 #11

Closed
cornelinux opened this issue Apr 30, 2016 · 3 comments
Closed

Fails to built with default setting on ubuntu 14.04 #11

cornelinux opened this issue Apr 30, 2016 · 3 comments

Comments

@cornelinux
Copy link
Contributor

cornelinux commented Apr 30, 2016

I can not compile the library with a normal "make" run.

cornelius@puckel ~/src/libnitrokey-fork (git)-[toplevel] % make
clang++-3.6 -c command_id.cc -o build/command_id.o -Iinclude/ -std=c++14 -fPIC 
clang++-3.6 -c device.cc -o build/device.o -Iinclude/ -std=c++14 -fPIC 
In file included from device.cc:2:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:55:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/tuple:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/array:38:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/stdexcept:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:52:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/basic_string.h:2815:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/string_conversions.h:43:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
  using ::gets;
        ~~^
In file included from device.cc:6:
include/device.h:43:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
include/device.h:45:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
2 warnings and 1 error generated.
make: *** [build/device.o] Fehler 1

I need to specify additional parameters to get the library built:

cornelius@puckel ~/src/libnitrokey-fork (git)-[toplevel] % make CXXFLAGS="-std=c++14 -fPIC -stdlib=libc++" all 
clang++-3.6 -c device.cc -o build/device.o -Iinclude/ -std=c++14 -fPIC -stdlib=libc++
In file included from device.cc:6:
include/device.h:43:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
include/device.h:45:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
2 warnings generated.
clang++-3.6 -c log.cc -o build/log.o -Iinclude/ -std=c++14 -fPIC -stdlib=libc++
clang++-3.6 -c misc.cc -o build/misc.o -Iinclude/ -std=c++14 -fPIC -stdlib=libc++
misc.cc:15:40: warning: format specifies type 'unsigned int' but the argument has type 'long' [-Wformat]
    snprintf(formatbuf, 128, "%04x\t", p - pstart);
                              ~~~~     ^~~~~~~~~~
                              %04lx
1 warning generated.
clang++-3.6 -c toplevel.cc -o build/toplevel.o -Iinclude/ -std=c++14 -fPIC -stdlib=libc++
In file included from toplevel.cc:3:
In file included from include/device_proto.h:12:
include/device.h:43:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
include/device.h:45:3: warning: declaration does not declare anything [-Wmissing-declarations]
  const;
  ^~~~~
In file included from toplevel.cc:3:
include/device_proto.h:48:3: warning: field '' with variable sized type 'union (anonymous union at include/device_proto.h:48:3)' not at the end
      of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
  union {
  ^
/usr/include/c++/v1/type_traits:2867:38: note: in instantiation of template class
      'nitrokey::proto::HIDReport' requested here
    : public integral_constant {};
                                     ^
include/device_proto.h:145:22: note: in instantiation of template class
      'std::__1::is_pod >' requested here
  static_assert(std::is_pod::value,

....
@szszszsz
Copy link
Member

Hi Cornelius!

It looks like you have used too old GCC. This library makes heavy use of some c++14 features (e.g. variable templates) which are fully supported since 5.0 version.
https://gcc.gnu.org/projects/cxx-status.html#cxx14
Could you paste your GCC version here and/or check on newer version to confirm?

@cornelinux
Copy link
Contributor Author

indeed it is the default in 14.04:

gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)

@szszszsz
Copy link
Member

szszszsz commented Apr 30, 2016

This is probably the cause. Clang tries to compile library using available GCC headers in old version which in turn cause the error. I have installed GCC 5.3 and haven't seen this on my Ubuntu 15.04. Please reopen if GCC upgrade would not help you. Thanks for report!

sgued pushed a commit to sgued/libnitrokey that referenced this issue Feb 14, 2022
Calculate SHA256 or SHA512 on Solo
sgued pushed a commit to sgued/libnitrokey that referenced this issue Feb 14, 2022
Use Nitrokey name for the device

Fixes Nitrokey#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants