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

Compiling on OSX #20

Open
JasonSanDiego opened this issue Aug 22, 2015 · 13 comments
Open

Compiling on OSX #20

JasonSanDiego opened this issue Aug 22, 2015 · 13 comments

Comments

@JasonSanDiego
Copy link

Any suggestions on whether it would be possible to compile this for Mac? I get this error while doing make.

SerialPort.cpp:176:34: error: use of undeclared identifier 'basename'
std::string driver = basename(link.c_str());

@mru00
Copy link
Owner

mru00 commented Aug 23, 2015

Hello,

It shold be possible to port the program to MacOSX. As I don't have a mac I can't really support you.

Just getting it to compile will not be enough. The serial port code also needs to be adapted.

@mru00
Copy link
Owner

mru00 commented Aug 23, 2015

I just did some searches; it might just work, if you add

 #include <libgen.h>

to the top of SerialPort.cpp. However, I am pretty certain that the "port autodetection" won't work. So you certainly will need to specify the --device option manually, see http://stackoverflow.com/questions/12254378/how-to-find-the-serial-port-number-on-mac-os-x

Please try the "libgen.h" and tell if its working.

@mru00
Copy link
Owner

mru00 commented Aug 23, 2015

I just pushed some changes, please pull the latest source and try again.

@JasonSanDiego
Copy link
Author

Thanks for following up. Even after adding libgen.h, it's not compiling:

SerialPort.cpp:22:2: error: Unsupported Platform. Please file a bug report with details about your compiler and platform
#error Unsupported Platform. Please file a bug report with details about your compiler and platform
^
SerialPort.cpp:26:34: error: allocation of incomplete type 'SerialPort::SerialPortD'
SerialPort::SerialPort() : d(new SerialPortD()) {
^~~~~~~~~~~
./SerialPort.hpp:24:11: note: forward declaration of 'SerialPort::SerialPortD'
class SerialPortD;
^

Also, I think unrelatedly, I get a number of warnings similar to this:
./Callback.hpp:12:1: warning: class 'WatchInfo' was previously declared as a struct [-Wmismatched-tags]
class WatchInfo;
^
./DataTypes.hpp:157:8: note: previous use is here
struct WatchInfo {
^
./Callback.hpp:12:1: note: did you mean struct here?
class WatchInfo;

@mru00
Copy link
Owner

mru00 commented Aug 23, 2015

Oh I see. I made a typo in the ifdef, please try again with the version I just pushed.
About the warnings you get: I will have a look. But please post me details about your compiler.

@JasonSanDiego
Copy link
Author

Here's what my compiler reports:
─$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Sorry for the delay. Let me know what else I can do to help.

@mru00
Copy link
Owner

mru00 commented Sep 20, 2015

Did you try a recent version of my code? I made some "wishful thinking" fixes.

@mru00
Copy link
Owner

mru00 commented Sep 23, 2015

If you can spare some time, there would be a topic where you could support me:

Travis CI, the continuous testing I use here, allows to compile and test for macos. http://docs.travis-ci.com/user/osx-ci-environment/

Can you investigate how to build and test linux+macos?

@JasonSanDiego
Copy link
Author

I will take a look and at Travis and see what I can find. Btw, I tried compiling your latest commit. Here's a snippet of what I get:

./SerialPortMacOSX.inc:54:3: warning: serial port enumeration not yet implemented for Mac OS X [-W#warnings]
#warning serial port enumeration not yet implemented for Mac OS X
^
1 warning generated.
mv -f .deps/crane_gps_watch_client-SerialPort.Tpo .deps/crane_gps_watch_client-SerialPort.Po
g++ -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -g -O2 -std=gnu++11 -MT crane_gps_watch_client-TcxWriter.o -MD -MP -MF .deps/crane_gps_watch_client-TcxWriter.Tpo -c -o crane_gps_watch_client-TcxWriter.o test -f 'TcxWriter.cpp' || echo './'TcxWriter.cpp
mv -f .deps/crane_gps_watch_client-TcxWriter.Tpo .deps/crane_gps_watch_client-TcxWriter.Po
g++ -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -g -O2 -std=gnu++11 -MT crane_gps_watch_client-Watch.o -MD -MP -MF .deps/crane_gps_watch_client-Watch.Tpo -c -o crane_gps_watch_client-Watch.o test -f 'Watch.cpp' || echo './'Watch.cpp
Watch.cpp:349:35: error: use of undeclared identifier 'ceil'
const unsigned comp = ceil(-this_milli/100.0);

@mru00
Copy link
Owner

mru00 commented Sep 23, 2015

Please try

 #include <math.h>

@JasonSanDiego
Copy link
Author

It compiles!

I don't have my watch sync cable on me, so will need to test later. Right now I'm getting a serial port autodetection error (no surprise), but at least it now compiles and runs.

@mru00
Copy link
Owner

mru00 commented Sep 23, 2015

Perfect. I will add the #include to the mainline source tomorrow. Thank you for keeping me posted

@JasonSanDiego
Copy link
Author

No luck...
$sudo ./crane_gps_watch_client --device=/dev/tty.SLAB_USBtoUART --split --verbose --verbose
Opening serial port '/dev/tty.SLAB_USBtoUART'
error: failed to open serial port '/dev/tty.SLAB_USBtoUART': Device not configured
Terminating

The error message comes after hanging for maybe 2-3 minutes. Seems like a timeout message.

FWIW, I have a New Balance NX 990. GPSMaster has been compatible with it, including the Mac version I stumbled upon. However, none of the GPSMaster versions seem to export heart rate when there's little/no GPS data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants