ppwwyyxx / OpenPano

Automatic Panorama Stitching From Scratch
MIT License
1.89k stars 555 forks source link

HOW TO RUN IN MAC (2022) -compiler issues #118

Closed lucychen0103 closed 2 years ago

lucychen0103 commented 2 years ago

This took too long for me to figure out, so I'm going to show the rest of you how to do it.

To compile:

  1. In terminal, cd to the OpenPano folder
  2. Install brew (http://brew.sh/)
  3. Terminal: brew install gcc
  4. Terminal: brew ls gcc
  5. Copy the path that looks like "/opt/homebrew/Cellar/gcc/11.2.0_3/bin/g++-11"
  6. Terminal (paste path into this command): export CXX=/opt/homebrew/Cellar/gcc/11.2.0_3/bin/g++-11" (use the path from the output of brew gcc install. at the time of writing the above is correct, but may change. Do this or otherwise osx still uses clang to compile)
  7. Terminal: brew install eigen
  8. Terminal: brew install jpeg
  9. Terminal: mkdir build && cd build && cmake .. && make (if you use make -C src it has a lot of issues)

To run:

  1. Go into OpenPano/src file and copy config.cfg file
  2. cd into OpenPano/build/src (this folder should have image-stitching exe file) and paste config.cfg file
  3. run ./image-stitching from this folder

Have fun!

midstreeeam commented 2 years ago

Thank you for your sharing! But here I met a problem that the computer can not find the libjpeg.

-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
JPEG_LIBRARY (ADVANCED)
    linked by target "openpano" in directory /Users/jeremy.lou/Desktop/git/OpenPano-master/src

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Although I installed it through brew, it is still not working. Then I tried gcc -ljpeg, and get

ld: library not found for -ljpeg

I also tried gcc -ljpeg -L /opt/homebrew/Cellar/jpeg/9e/lib/ then I got

Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64

I am not sure how to fix it.

midstreeeam commented 2 years ago

Thank you for your sharing! But here I met a problem that the computer can not find the libjpeg.

-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
JPEG_LIBRARY (ADVANCED)
    linked by target "openpano" in directory /Users/jeremy.lou/Desktop/git/OpenPano-master/src

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Although I installed it through brew, it is still not working. Then I tried gcc -ljpeg, and get

ld: library not found for -ljpeg

I also tried gcc -ljpeg -L /opt/homebrew/Cellar/jpeg/9e/lib/ then I got

Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64

I am not sure how to fix it.

Fixed by specifying the path to jpeg lib cmake -DJPEG_LIBRARY:PATH=/opt/homebrew/Cellar/jpeg/9e/lib/libjpeg.a -DJPEG_INCLUDE_DIR:PATH=/opt/homebrew/Cellar/jpeg/9e/include ..

But I still don't know why cmake can't find it by default