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

Building VLFeat on Mac M1 for ARM Architecture #231

Open
josefgrunig opened this issue Jul 12, 2023 · 2 comments
Open

Building VLFeat on Mac M1 for ARM Architecture #231

josefgrunig opened this issue Jul 12, 2023 · 2 comments

Comments

@josefgrunig
Copy link

Hi, I am trying to build VLFeat on a Mac M1 machine with make but it seems that the Architecture is not supported.
Any hint how I can get it working, by editing the makefile?

** Unknown host architecture 'Darwin arm64'. This identifier
** was obtained by running 'uname -sm'. Edit the Makefile 
** to add the appropriate configuration.
@usptact
Copy link

usptact commented Nov 3, 2023

I was able to build VLFeat manually.

First you need to build the libvl.dylib dynamic library (note we are disabling AVX, SSE2 since it is not on Apple Silicon):

$ cd {project_root}/vl
$ gcc -dynamiclib -fPIC -DVL_DISABLE_AVX -DVL_DISABLE_SSE2 -o libvl.dylib *.c

Then you can build C/C++ programs using the library. For example, the tools in the {project_root}/src.

$ cd {project_root}/src
$ gcc -I{project_root} -L{project_root}/vl -lvl aib.c -o aib
$ ./aib
./aib                                                                                                                                                                                ─╯
Pic = [0.681300 0.302800 0.821600 ; ...
0.379500 0.541700 0.644900 ; ...
0.831800 0.150900 0.818000 ; ...
0.502800 0.697900 0.660200 ; ...
0.709500 0.378400 0.342000 ; ...
0.428900 0.860000 0.289700 ; ...
0.304600 0.853700 0.341200 ; ...
0.189700 0.593600 0.534100 ; ...
0.193400 0.496600 0.727100 ; ...
0.682200 0.899800 0.309300 ; ...
];
AIB starting
0 => 13
1 => 10
2 => 13
3 => 10
4 => 16
5 => 11
6 => 11
7 => 12
8 => 12
9 => 14
10 => 15
11 => 14
12 => 15
13 => 16
14 => 17
15 => 17
16 => 18
17 => 18
18 => 0
IB done

Make sure libvl.dylib is in the same directory or is in the DYLD_LIBRARY_PATH environment variable.

The compiler I used:

gcc --version                                                                                                                                                                        ─╯
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Pretty sure the project can be converted to a nice and simple CMake project. Maybe I will do it one day.

@usptact
Copy link

usptact commented Nov 3, 2023

There's something wrong with basic vl_* data types when on Apple Silicon.

Running sift utility on a sample PGM file, I am getting obviously wrong image size information:

./sift -v hi.pgm                                                                                                                                                                     ─╯
sift: <== 'hi.pgm'
sift: image is 9751594488 by 9751594912 pixels
sift: err: Could not allocate enough memory. (2)

My hi.pgm image file size is 30 x 15 pixels.

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