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

Compilation on OSX fails (undeclared identifier 'POSIX_FADV_DONTNEED') #1

Open
karel-brinda opened this issue Oct 18, 2021 · 2 comments
Assignees

Comments

@karel-brinda
Copy link

karel-brinda commented Oct 18, 2021

Hello, I've tried to compile LZ77-to-SLP on Mac (Big Sur), but I'm getting the following errors:

When using the default clang compiler:

$ make
...

./src/../include/lazy_avl_grammar/lz_to_lazy_avl_grammar.hpp:90:31: note: in instantiation of member function 'lazy_avl_grammar<unsigned char, uint40>::lazy_avl_grammar' requested here
  grammar_type *grammar = new grammar_type(use_kr_hashing, kr_hashing_prob);
                              ^
./src/main.cpp:294:7: note: in instantiation of function template specialization 'lz_to_lazy_avl_grammar<unsigned char, uint40>' requested here
      lz_to_lazy_avl_grammar<char_type, text_offset_type>(
      ^
./src/main.cpp:398:3: note: in instantiation of function template specialization 'test_conversion<unsigned char, uint40>' requested here
  test_conversion<char_type, text_offset_type>(
  ^
In file included from ./src/main.cpp:48:
./src/../include/lazy_avl_grammar/lazy_avl_grammar.hpp:1680:11: error: no viable overloaded '='
      x_p = x_left_p;
      ~~~ ^ ~~~~~~~~

...


./src/../include/types/uint40.hpp:40:7: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const nonterminal<unsigned char, uint40>::ptr_type' (aka 'const uint40'), but method is not marked const
class uint40 {
      ^
In file included from ./src/main.cpp:48:
./src/../include/lazy_avl_grammar/lazy_avl_grammar.hpp:780:13: warning: format specifies type 'unsigned long' but the argument has type 'std::uint64_t' (aka 'unsigned long long') [-Wformat]
            cache_misses, (100.L * cache_misses) / query_counter);
            ^~~~~~~~~~~~
./src/main.cpp:344:12: note: in instantiation of member function 'lazy_avl_grammar<unsigned char, uint40>::print_stats' requested here
  grammar->print_stats();
           ^
./src/main.cpp:398:3: note: in instantiation of function template specialization 'test_conversion<unsigned char, uint40>' requested here
  test_conversion<char_type, text_offset_type>(
  ^
12 warnings and 2 errors generated.
./src/utils.cpp:231:32: error: use of undeclared identifier 'POSIX_FADV_DONTNEED'
  posix_fadvise(fd, 0, length, POSIX_FADV_DONTNEED);

When using GCC11 (make CC=gcc-11 CXX=g++-11):

./src/utils.cpp: In function 'void utils::empty_page_cache(std::string)':
./src/utils.cpp:231:32: error: 'POSIX_FADV_DONTNEED' was not declared in this scope
  231 |   posix_fadvise(fd, 0, length, POSIX_FADV_DONTNEED);
      |                                ^~~~~~~~~~~~~~~~~~~
./src/utils.cpp:231:3: error: 'posix_fadvise' was not declared in this scope
  231 |   posix_fadvise(fd, 0, length, POSIX_FADV_DONTNEED);
      |   ^~~~~~~~~~~~~
make: *** [lz_to_grammar] Error 1

@karel-brinda karel-brinda changed the title Compilation on OSX fails Compilation on OSX fails (undeclared identifier 'POSIX_FADV_DONTNEED') Oct 18, 2021
@dominikkempa
Copy link
Owner

Thanks for reporting the issue, Karel! I tried to fix it, though I don't have access to OSX right now, so cannot really test if my fix helped.

@dominikkempa dominikkempa self-assigned this Oct 19, 2021
@karel-brinda
Copy link
Author

Thanks for the help. I tried it again and I think it's still the same error:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:2051:18: note: in implicit copy assignment operator for 'uint40' first required here
        *__first = __value_;
                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:2060:18: note: in instantiation of function template specialization 'std::__fill_n<uint40 *, long, uint40>' requested here
   return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:2079:12: note: in instantiation of function template specialization 'std::fill_n<uint40 *, long, uint40>' requested here
    _VSTD::fill_n(__first, __last - __first, __value_);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:2087:12: note: in instantiation of function template specialization 'std::__fill<uint40 *, uint40>' requested here
    _VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category());
           ^
./src/../include/utils/hash_table.hpp:96:12: note: in instantiation of function template specialization 'std::fill<uint40 *, uint40>' requested here
      std::fill(m_buckets, m_buckets + m_bucket_count,
           ^
./src/../include/lazy_avl_grammar/lazy_avl_grammar.hpp:193:5: note: in instantiation of member function 'hash_table<unsigned long long, uint40, uint40>::hash_table' requested here
    lazy_avl_grammar(
    ^
./src/../include/lazy_avl_grammar/lz_to_lazy_avl_grammar.hpp:90:31: note: in instantiation of member function 'lazy_avl_grammar<unsigned char, uint40>::lazy_avl_grammar' requested here
  grammar_type *grammar = new grammar_type(use_kr_hashing, kr_hashing_prob);
                              ^
./src/main.cpp:294:7: note: in instantiation of function template specialization 'lz_to_lazy_avl_grammar<unsigned char, uint40>' requested here
      lz_to_lazy_avl_grammar<char_type, text_offset_type>(
      ^
./src/main.cpp:398:3: note: in instantiation of function template specialization 'test_conversion<unsigned char, uint40>' requested here
  test_conversion<char_type, text_offset_type>(
  ^
In file included from ./src/main.cpp:48:
./src/../include/lazy_avl_grammar/lazy_avl_grammar.hpp:780:13: warning: format specifies type 'unsigned long' but the argument has type 'std::uint64_t' (aka 'unsigned long long') [-Wformat]
            cache_misses, (100.L * cache_misses) / query_counter);
            ^~~~~~~~~~~~
./src/main.cpp:344:12: note: in instantiation of member function 'lazy_avl_grammar<unsigned char, uint40>::print_stats' requested here
  grammar->print_stats();
           ^
./src/main.cpp:398:3: note: in instantiation of function template specialization 'test_conversion<unsigned char, uint40>' requested here
  test_conversion<char_type, text_offset_type>(
  ^
10 warnings and 1 error generated.
./src/utils.cpp:232:32: error: use of undeclared identifier 'POSIX_FADV_DONTNEED'
  posix_fadvise(fd, 0, length, POSIX_FADV_DONTNEED);
                               ^
1 error generated.
make: *** [lz_to_grammar] Error 1

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