RJVB / afsctool

This is a version of "brkirch"'s afsctool utility that allows end-users to leverage HFS+ compression.
https://brkirch.wordpress.com/afsctool
GNU General Public License v3.0
187 stars 18 forks source link

Building on Apple M1 #40

Closed malthe closed 3 years ago

malthe commented 3 years ago

The CritSectEx library doesn't compile on ARM architecture.

RJVB commented 3 years ago

That doesn't really surprise me. Does the x86_64 build run on that architecture as Apple claim it should? If so please use that for the time being.

Or adapt the code yourself. The code already uses a stripped-down version of CritSectEx.{h,cpp} so the build probably fails on code that isn't used at all. I do have a standalone version of the CritSectEx library which I'd like to keep in sync (as easily as possible). So rather than stripping out offending (and unused code) I'd appreciate if you could exclude it from building by putting #ifdef/#endifs around it. Don't worry about the token (could be the M1 equivalent of x86_64 of course); this is mostly to be certain I don't miss anything. I'll come in afterwards and use a proper filter to exclude x86 code on other platforms.

RJVB commented 3 years ago

Can you pull and try again please. Hopefully the fix was easier than I thought.

malthe commented 3 years ago

I get the following compiler output:

~/co/afsctool/build$ make
Scanning dependencies of target PP
[  9%] Building CXX object CMakeFiles/PP.dir/src/utils.cpp.o
[ 18%] Building CXX object CMakeFiles/PP.dir/src/ParallelProcess.cpp.o
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
In file included from /Users/mborch/co/afsctool/src/Thread/Thread.hpp:14:
In file included from /Users/mborch/co/afsctool/src/CritSectEx/CritSectEx.h:43:
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:697:8: error: use of undeclared identifier '_InterlockedIncrement'
                if( !_InterlockedIncrement(atomic) ){
                     ^
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:698:4: error: use of undeclared identifier 'YieldProcessor'; did you mean
      'FileProcessor'?
                        YieldProcessor();
                        ^
/Users/mborch/co/afsctool/src/fsctool.h:98:7: note: 'FileProcessor' declared here
class FileProcessor;
      ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
In file included from /Users/mborch/co/afsctool/src/Thread/Thread.hpp:14:
In file included from /Users/mborch/co/afsctool/src/CritSectEx/CritSectEx.h:43:
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:711:8: error: use of undeclared identifier '_InterlockedDecrement'; did you
      mean '_InterlockedSetTrue'?
                        if( _InterlockedDecrement(atomic) ){
                            ^~~~~~~~~~~~~~~~~~~~~
                            _InterlockedSetTrue
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:694:20: note: '_InterlockedSetTrue' declared here
static inline void _InterlockedSetTrue( volatile long *atomic )
                   ^
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:711:8: error: value of type 'void' is not contextually convertible to 'bool'
                        if( _InterlockedDecrement(atomic) ){
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:712:5: error: use of undeclared identifier 'YieldProcessor'; did you mean
      'FileProcessor'?
                                YieldProcessor();
                                ^
/Users/mborch/co/afsctool/src/fsctool.h:98:7: note: 'FileProcessor' declared here
class FileProcessor;
      ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
In file included from /Users/mborch/co/afsctool/src/Thread/Thread.hpp:14:
In file included from /Users/mborch/co/afsctool/src/CritSectEx/CritSectEx.h:43:
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:716:8: error: use of undeclared identifier '_InterlockedIncrement'
                        if( _InterlockedIncrement(atomic) ){
                            ^
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:717:5: error: use of undeclared identifier 'YieldProcessor'; did you mean
      'FileProcessor'?
                                YieldProcessor();
                                ^
/Users/mborch/co/afsctool/src/fsctool.h:98:7: note: 'FileProcessor' declared here
class FileProcessor;
      ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:384:6: error: no matching function for call to '_InterlockedSetTrue'
                                        _InterlockedSetTrue(isNotified);
                                        ^~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:694:20: note: candidate function not viable: no known conversion from 'long'
      to 'volatile long *' for 1st argument; take the address of the argument with &
static inline void _InterlockedSetTrue( volatile long *atomic )
                   ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:395:7: error: no matching function for call to '_InterlockedSetTrue'
                                                _InterlockedSetTrue(isLocked);
                                                ^~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:694:20: note: candidate function not viable: no known conversion from 'long'
      to 'volatile long *' for 1st argument; take the address of the argument with &
static inline void _InterlockedSetTrue( volatile long *atomic )
                   ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:401:9: error: no matching function for call to '_InterlockedSetTrue'
                                                                _InterlockedSetTrue(isLocked);
                                                                ^~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:694:20: note: candidate function not viable: no known conversion from 'long'
      to 'volatile long *' for 1st argument; take the address of the argument with &
static inline void _InterlockedSetTrue( volatile long *atomic )
                   ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:402:9: error: use of undeclared identifier 'YieldProcessor'; did you mean
      'FileProcessor'?
                                                                YieldProcessor();
                                                                ^
/Users/mborch/co/afsctool/src/fsctool.h:98:7: note: 'FileProcessor' declared here
class FileProcessor;
      ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:412:7: error: no matching function for call to '_InterlockedSetFalse'
                                                _InterlockedSetFalse(isLocked);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:707:20: note: candidate function not viable: no known conversion from 'long'
      to 'volatile long *' for 1st argument; take the address of the argument with &
static inline void _InterlockedSetFalse( volatile long *atomic )
                   ^
In file included from /Users/mborch/co/afsctool/src/ParallelProcess.cpp:20:
In file included from /Users/mborch/co/afsctool/src/ParallelProcess_p.hpp:19:
/Users/mborch/co/afsctool/src/Thread/Thread.hpp:414:7: error: no matching function for call to '_InterlockedSetFalse'
                                                _InterlockedSetFalse(isNotified);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:707:20: note: candidate function not viable: no known conversion from 'long'
      to 'volatile long *' for 1st argument; take the address of the argument with &
static inline void _InterlockedSetFalse( volatile long *atomic )
                   ^
/Users/mborch/co/afsctool/src/ParallelProcess.cpp:395:4: error: use of undeclared identifier '_InterlockedIncrement'
                        _InterlockedIncrement(&PP->nProcessing);
                        ^
/Users/mborch/co/afsctool/src/ParallelProcess.cpp:397:4: error: use of undeclared identifier '_InterlockedDecrement'; did you
      mean '_InterlockedSetTrue'?
                        _InterlockedDecrement(&PP->nProcessing);
                        ^~~~~~~~~~~~~~~~~~~~~
                        _InterlockedSetTrue
/Users/mborch/co/afsctool/src/CritSectEx/msemul.h:694:20: note: '_InterlockedSetTrue' declared here
static inline void _InterlockedSetTrue( volatile long *atomic )
                   ^
/Users/mborch/co/afsctool/src/ParallelProcess.cpp:398:4: error: use of undeclared identifier '_InterlockedIncrement'
                        _InterlockedIncrement(&PP->nProcessed);
                        ^
16 errors generated.
make[2]: *** [CMakeFiles/PP.dir/src/ParallelProcess.cpp.o] Error 1
make[1]: *** [CMakeFiles/PP.dir/all] Error 2
make: *** [all] Err
RJVB commented 3 years ago

Bummer, my bad.

Pull and try again, please? (There may be a link error on a _yield() function which is supposed to be a compiler intrinsic from what I understood).

malthe commented 3 years ago

Works – amazing work.