Benjamin-Dobell / Heimdall

Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices.
MIT License
2.62k stars 587 forks source link

Heimdall Fails to Compile Mac OS High Sierra 10.13.3 #466

Open elitebyte opened 6 years ago

elitebyte commented 6 years ago

So I am trying to compile the latest version of Heimdall 1.4.2 but I seem to be getting stuck on the make command. I don't really know C++ so I'm not able to understand the errors that I am getting back.

The output of cmake

Marios-MacBook-Pro:build elitebyte$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -    DQt5Widgets_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Widgets ..
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found libusb: /usr/local/lib/libusb-1.0.a  
-- Checking if large (64-bit) file support is available...
-- Checking if large (64-bit) file support is available - yes
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

Qt5Widgets_DIR

-- Build files have been written to: /Users/elitebyte/Heimdall/build

This runs relatively fine, but then this is where it hits the fan:

 Marios-MacBook-Pro:build elitebyte$ make
 Scanning dependencies of target pit 
 [  6%] Building CXX object libpit/CMakeFiles/pit.dir/source/libpit.cpp.o
 In file included from /Users/elitebyte/Heimdall/libpit/source/libpit.cpp:22:
 In file included from /Users/elitebyte/Heimdall/libpit/source/libpit.h:38:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:169:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:643:
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2051:9: error: cannot initialize
       a member subobject of type 'libpit::PitEntry **' with an rvalue of type 'int'
       : __value_(_VSTD::forward<_Up>(__u)){};
         ^        ~~~~~~~~~~~~~~~~~~~~~~~~
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2141:9: note: in instantiation
       of function template specialization 'std::__1::__compressed_pair_elem<libpit::PitEntry
       **, 0, false>::__compressed_pair_elem<int, void>' requested here
       : _Base1(std::forward<_Tp>(__t)), _Base2() {}
         ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:423:7: note: in instantiation of
       function template specialization 'std::__1::__compressed_pair<libpit::PitEntry **,
       std::__1::allocator<libpit::PitEntry *> >::__compressed_pair<int, true>' requested here
       __end_cap_(nullptr)
       ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:473:5: note: in instantiation of
       member function 'std::__1::__vector_base<libpit::PitEntry *,
       std::__1::allocator<libpit::PitEntry *> >::__vector_base' requested here
     vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
     ^
  /Users/elitebyte/Heimdall/libpit/source/libpit.cpp:65:10: note: in instantiation of member
       function 'std::__1::vector<libpit::PitEntry *, std::__1::allocator<libpit::PitEntry *>
       >::vector' requested here
 PitData::PitData()
          ^
 In file included from /Users/elitebyte/Heimdall/libpit/source/libpit.cpp:22:
 In file included from /Users/elitebyte/Heimdall/libpit/source/libpit.h:38:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:169:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
 In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:643:
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2151:9: error: no matching
       constructor for initialization of '__compressed_pair_elem<libpit::PitEntry **, 0>'
       : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
         ^      ~~~~~~~~~~~~~~~~~~~~~~~
 /Library/Developer/CommandLineTools/usr/include/c++/v1/__split_buffer:309:7: note: in
       instantiation of function template specialization
       'std::__1::__compressed_pair<libpit::PitEntry **, std::__1::allocator<libpit::PitEntry
       *> &>::__compressed_pair<int, std::__1::allocator<libpit::PitEntry *> &>' requested here
     : __end_cap_(nullptr, __a)
       ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:1036:53: note: in instantiation
       of member function 'std::__1::__split_buffer<libpit::PitEntry *,
       std::__1::allocator<libpit::PitEntry *> &>::__split_buffer' requested here
         __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), siz...
                                                     ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:1997:15: note: in instantiation
       of member function 'std::__1::vector<libpit::PitEntry *,
       std::__1::allocator<libpit::PitEntry *> >::__append' requested here
         this->__append(__sz - __cs);
               ^
 /Users/elitebyte/Heimdall/libpit/source/libpit.cpp:99:10: note: in instantiation of member
       function 'std::__1::vector<libpit::PitEntry *, std::__1::allocator<libpit::PitEntry *>
       >::resize' requested here
         entries.resize(entryCount);
                 ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2037:8: note: candidate 
       constructor (the implicit copy constructor) not viable: no known conversion from 'int'
       to 'const std::__1::__compressed_pair_elem<libpit::PitEntry **, 0, false>' for 1st
       argument
 struct __compressed_pair_elem {
        ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2037:8: note: candidate
       constructor (the implicit move constructor) not viable: no known conversion from 'int'
       to 'std::__1::__compressed_pair_elem<libpit::PitEntry **, 0, false>' for 1st argument 
 struct __compressed_pair_elem {
        ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2050:3: note: candidate template
       ignored: substitution failure [with _Up = int, $1 = void]
   __compressed_pair_elem(_Up&& __u)
   ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2055:3: note: candidate
       constructor template not viable: requires 3 arguments, but 1 was provided
   __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
   ^
 /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2043:39: note: candidate
       constructor not viable: requires 0 arguments, but 1 was provided
   _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {}
                                       ^ 
 2 errors generated.
 make[2]: *** [libpit/CMakeFiles/pit.dir/source/libpit.cpp.o] Error 1 
 make[1]: *** [libpit/CMakeFiles/pit.dir/all] Error 2
 make: *** [all] Error 2

Any ideas? I am running the latest versions of libusb, qt, and cmake via homebrew download. Not sure where to go from here. Also trying to use Heimdall v1.4.1 also fails to get PIT file. But assuming that 1.4.2 is a fix, I am trying to get the latest one to work.

Usaamah99 commented 6 years ago

I have found the fix. Try this. The issue is with compiling libpit. The compiler is using old C++ flags therefore we are getting these errors. Go into the file located at Heimdall/libpit/CMakeLists.txt and remove this '-std=gnu++11' and replace with '-Dnullptr=NULL'. (without quotes). It will now build.