byronknoll / cmix

cmix is a lossless data compression program aimed at optimizing compression ratio at the cost of high CPU/memory usage.
http://www.byronknoll.com/cmix.html
GNU General Public License v3.0
613 stars 45 forks source link

failed to build cmix 21 #65

Open chenrui333 opened 2 weeks ago

chenrui333 commented 2 weeks ago

👋 trying to build the latest release, but run into some build issue. The error log is as below:

error build log ``` ==> make CC=clang clang -std=c++14 -Wall -Ofast -march=native src/coder/decoder.cpp src/coder/encoder.cpp src/context-manager.cpp src/contexts/bit-context.cpp src/contexts/bracket-context.cpp src/contexts/combined-context.cpp src/contexts/context-hash.cpp src/contexts/indirect-hash.cpp src/contexts/interval-hash.cpp src/contexts/interval.cpp src/contexts/sparse.cpp src/mixer/byte-mixer.cpp src/mixer/lstm-layer.cpp src/mixer/lstm.cpp src/mixer/mixer-input.cpp src/mixer/mixer.cpp src/mixer/sigmoid.cpp src/mixer/sse.cpp src/models/bracket.cpp src/models/byte-model.cpp src/models/direct-hash.cpp src/models/direct.cpp src/models/indirect.cpp src/models/fxcmv1.cpp src/models/match.cpp src/models/paq8.cpp src/models/ppmd.cpp src/predictor.cpp src/preprocess/dictionary.cpp src/preprocess/preprocessor.cpp src/runner.cpp src/states/nonstationary.cpp src/states/run-map.cpp -o cmix clang -std=c++14 -Wall -Ofast -march=native src/enwik9-preproc/main.cpp -o enwik9-preproc clang src/enwik9-preproc/article_remap.cpp -o remap src/enwik9-preproc/article_remap.cpp:25:28: error: non-aggregate type 'std::vector' (aka 'vector >') cannot be initialized with an initializer list 25 | std::vector prefix = { | ^ ~ 26 | " #REDIRECT", In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/immintrin.h:21: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture" 14 | #error "This header is only meant to be used on x86 and x64 architecture" | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:37:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'? 37 | __builtin_ia32_emms(); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__math/traits.h:145:10: note: '__builtin_isless' declared here 145 | return __builtin_isless((type)__x, (type)__y); | ^ In file included from src/models/fxcmv1.cpp:35: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/immintrin.h:21: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:37:25: error: too few arguments to function call, expected 2, have 0 37 | __builtin_ia32_emms(); | ~~~~~~~~~~~~~~~~~~~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:54:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si' 54 | return (__m64)__builtin_ia32_vec_init_v2si(__i, 0); | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:71:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si' 71 | return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0); | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:133:19: error: use of undeclared identifier '__builtin_ia32_packsswb' 133 | return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2); | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:163:19: error: use of undeclared identifier '__builtin_ia32_packssdw' 163 | return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2); | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:193:19: error: use of undeclared identifier '__builtin_ia32_packuswb' 193 | return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2); | ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/mmintrin.h:220:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw' 220 | return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2); | ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [cmix] Error 1 ```

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/10909905879/job/30279374334?pr=190973 relates to Homebrew/homebrew-core#190973

byronknoll commented 2 weeks ago

I think this is due to using an older version of clang. Can you try updating to a new version?

chenrui333 commented 2 weeks ago

it failed to build with clang 16 on macos sequoia as well though.

chenrui333 commented 2 weeks ago

still failed to build with llvm 18

is the project only meant to be built on x86 platform?

/opt/homebrew/Cellar/llvm/18.1.8/lib/clang/18/include/immintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
   14 | #error "This header is only meant to be used on x86 and x64 architecture"
      |  ^
byronknoll commented 2 weeks ago

Can you share the new build log? The error from the original build log I see is " src/enwik9-preproc/article_remap.cpp:25:28: error: non-aggregate type 'std::vector' (aka 'vector<basic_string >') cannot be initialized with an initializer list"

chenrui333 commented 1 week ago

yeah, absolutely, the ci build log is in here, https://github.com/Homebrew/homebrew-core/actions/runs/10948334652/job/30399339133?pr=190973

  Undefined symbols for architecture arm64:
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
        bool std::__1::operator==[abi:ne180100]<char, std::__1::char_traits<char>, std::__1::allocator<char>>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, char const*) in article_remap-aea583.o
    "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
        std::__1::ctype<char> const& std::__1::use_facet[abi:ne180100]<std::__1::ctype<char>>(std::__1::locale const&) in article_remap-aea583.o
    "std::__1::ios_base::getloc() const", referenced from:
        std::__1::basic_ios<char, std::__1::char_traits<char>>::widen[abi:ne180100](char) const in article_remap-aea583.o
    "std::logic_error::logic_error(char const*)", referenced from:
        std::length_error::length_error[abi:ne180100](char const*) in article_remap-aea583.o
    "std::length_error::~length_error()", referenced from:
        std::__1::__throw_length_error[abi:ne180100](char const*) in article_remap-aea583.o
    "std::bad_array_new_length::bad_array_new_length()", referenced from:
        std::__throw_bad_array_new_length[abi:ne180100]() in article_remap-aea583.o
    "std::bad_array_new_length::~bad_array_new_length()", referenced from:
        std::__throw_bad_array_new_length[abi:ne180100]() in article_remap-aea583.o
    "std::__1::__next_prime(unsigned long)", referenced from:
        void std::__1::__hash_table<std::__1::__hash_value_type<int, int>, std::__1::__unordered_map_hasher<int, std::__1::__hash_value_type<int, int>, std::__1::hash<int>, std::__1::equal_to<int>, true>, std::__1::__unordered_map_equal<int, std::__1::__hash_value_type<int, int>, std::__1::equal_to<int>, std::__1::hash<int>, true>, std::__1::allocator<std::__1::__hash_value_type<int, int>>>::__rehash<true>(unsigned long) in article_remap-aea583.o
        void std::__1::__hash_table<std::__1::__hash_value_type<int, int>, std::__1::__unordered_map_hasher<int, std::__1::__hash_value_type<int, int>, std::__1::hash<int>, std::__1::equal_to<int>, true>, std::__1::__unordered_map_equal<int, std::__1::__hash_value_type<int, int>, std::__1::equal_to<int>, std::__1::hash<int>, true>, std::__1::allocator<std::__1::__hash_value_type<int, int>>>::__rehash<true>(unsigned long) in article_remap-aea583.o
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init(char const*, unsigned long)", referenced from:
        std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string[abi:ne180100]<0>(char const*) in article_remap-aea583.o
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::push_back(char)", referenced from:
        std::__1::basic_istream<char, std::__1::char_traits<char>>& std::__1::getline[abi:ne180100]<char, std::__1::char_traits<char>, std::__1::allocator<char>>(std::__1::basic_istream<char, std::__1::char_traits<char>>&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&, char) in article_remap-aea583.o
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)", referenced from:
        _main in article_remap-aea583.o
        void std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>::construct[abi:ne180100]<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in article_remap-aea583.o
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::~basic_string()", referenced from:
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
        _main in article_remap-aea583.o
byronknoll commented 1 week ago

I just submitted a change which might help with this issue. Can you try rebuilding?