pololu / pololu-tic-software

Software and drivers for the Pololu Tic Stepper Motor Controller.
Other
25 stars 12 forks source link

has this been tested on a macOS M1 ? #8

Open stephanschulz opened 1 year ago

stephanschulz commented 1 year ago

I am following the sets here https://github.com/pololu/pololu-tic-software/blob/master/BUILDING.md to build on a Mac book pro with M1 chipset. On an M1 brew installs most things in /opt/homebrew/Cellar/ but I think the Pololu make script is looking for things in usr/local

Is there a work around I can do?

I get this error message after running all the commands listed:

stephanschulz@Stephans-Komputer ~ % pkg-config libusbp-1 --cflags
Package libusbp-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusbp-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusbp-1' found

ibusbp-1 or ibusbp can not be found

stephanschulz@Stephans-Komputer ~ % brew list libusbp-1
Error: No available formula with the name "libusbp-1". Did you mean libusb?

brew install pkg-config cmake qt5 prints out

==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################### 100.0%
Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
Warning: cmake 3.26.4 is already installed and up-to-date.
To reinstall 3.26.4, run:
  brew reinstall cmake
Warning: qt@5 5.15.8_3 is already installed and up-to-date.
To reinstall 5.15.8_3, run:
  brew reinstall qt@5
stephanschulz@Stephans-Komputer ~ % brew list qt@5
/opt/homebrew/Cellar/qt@5/5.15.8_3/bin/balsam
/opt/homebrew/Cellar/qt@5/5.15.8_3/bin/canbusutil
/opt/homebrew/Cellar/qt@5/5.15.8_3/bin/fixqt4headers.pl
/opt/homebrew/Cellar/qt@5/5.15.8_3/bin/lconvert
AND MANY MORE

Thanks

stephanschulz commented 1 year ago

The current steps install the lib in /usr/local/lib/libusbp-1.dylib along with other suff and also pkgconfig

I confirmed it's existence with ls /usr/local/lib/pkgconfig I then added this to the PKG_CONFIG_PATH search path with export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"

This seemed to have resolved all the issues. I was able to install the rest and successfully call ticgui

stephanschulz commented 1 year ago

I now followed these steps to do the linking correct

In Xcode, select your project in the Project Navigator, then your target under "TARGETS".
 Go to the "Build Settings" tab.
 Search for "Header Search Paths" and add /usr/local/include/libusbp-1.
 Search for "Library Search Paths" and add /usr/local/lib.
 "Other Linker Flags" field. Here, you'll need to add -lusbp-1

But I get a bunch of error which might be very www.openframeworks.cc specific but maybe worth mentioning here.

Screen Shot 2023-05-29 at 8 15 55 PM

DavidEGrayson commented 1 year ago

The /usr/local directory is not specified in our CMakeLists.txt file; it is just the default location where CMake wants to install software on your system. It is unfortunate that location is not on your pkg-config search path by default. If you've installed both CMake and pkg-config from Homebrew and they disagree like this, maybe the Homebrew people could be convinced to patch one of them to make them agree.

stephanschulz commented 1 year ago

I think I figured it out. the above error in the screenshot happens because when I added the /usr/local/lib/libusbp-1.dylib and /usr/local/lib/libpololu-tic-1.1.8.2.dylib to the Other Linker Flags section I must have removed the items related to openframeworks that were already there. No the app complies. Fingers crossed that it also runs :)

I had to modify the cmake commands a bit to force to build for macOS 12.3 because my version of openframeworks complained that the library was build for 12.6 while the app is trying to build for 12.3

for libusbp cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=12.3 ..

for tic cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) -DCMAKE_OSX_DEPLOYMENT_TARGET=12.3

Here some screenshot showing my settings just in case my future self needs a reminder. Screen Shot 2023-05-30 at 7 52 31 AM Screen Shot 2023-05-30 at 7 52 21 AM Screen Shot 2023-05-30 at 7 52 06 AM

DavidEGrayson commented 1 year ago

I'm glad you were able to get things working. I'll leave this issue open as a reminder that we might need to add extra steps to our macOS instructions to get pkg-config to work.