git clone https://github.com/fnoop/aruco
git checkout 3.1.0
cd aruco
cmake . && make && sudo make install
cd aruco should be before the checkout, and there's no 3.1.0 branch.
Current master is 3.0.11 which compiles fine on opencv 3.2, but probably not on 4.x
3.0.13 is the last opensource version, but doesn't compile on opencv 3.2 (does compile on 4.x).