openambitproject / openambit

openambit
280 stars 82 forks source link

Building on macOS #220

Closed pcl closed 4 years ago

pcl commented 5 years ago

Hi,

Given the Movescount EOL announcement, I'm interested in getting openambit compiling and running on my Mac. I've taken a quick look at building from source, and ran into the problems outlined in #111. I then moved on to trying to get the Docker-based build instructions working.

I've gotten further, but haven't been successful yet. I've edited the Dockerfile to run apt-get install qttools5-dev-tools, and enabled C11 compatibility for CMake. But now I'm running into issues compiling pmem20.c.

Has anyone had any luck with Docker-based or non-Docker compilation and running on macOS as yet? If not: any tips about how to deal with these pmem20.c issues?

[ 18%] Building C object src/libambit/CMakeFiles/ambit.dir/pmem20.c.o
/code/src/libambit/pmem20.c:59:62: warning: 'struct timeval' declared inside parameter list
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval);
                                                              ^
/code/src/libambit/pmem20.c:59:62: warning: its scope is only this definition or declaration, which is probably not what you want
/code/src/libambit/pmem20.c: In function 'libambit_pmem20_gps_orbit_write':
/code/src/libambit/pmem20.c:531:5: warning: implicit declaration of function 'htole32' [-Wimplicit-function-declaration]
     *_sizeptr = htole32(datalen);
     ^
/code/src/libambit/pmem20.c: In function 'parse_sample':
/code/src/libambit/pmem20.c:647:13: warning: implicit declaration of function 'le16toh' [-Wimplicit-function-declaration]
             spec_type = le16toh(spec_entry->type);
             ^
/code/src/libambit/pmem20.c: In function 'add_time':
/code/src/libambit/pmem20.c:1138:20: error: storage size of 'timeval' isn't known
     struct timeval timeval;
                    ^
/code/src/libambit/pmem20.c:1138:20: warning: unused variable 'timeval' [-Wunused-variable]
/code/src/libambit/pmem20.c: At top level:
/code/src/libambit/pmem20.c:1174:62: warning: 'struct timeval' declared inside parameter list
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval) {
                                                              ^
/code/src/libambit/pmem20.c:1174:13: error: conflicting types for 'to_timeval'
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval) {
             ^
/code/src/libambit/pmem20.c:59:13: note: previous declaration of 'to_timeval' was here
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval);
             ^
/code/src/libambit/pmem20.c: In function 'to_timeval':
/code/src/libambit/pmem20.c:1179:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec = 0;
            ^
/code/src/libambit/pmem20.c:1180:12: error: dereferencing pointer to incomplete type
     timeval->tv_usec = 0;
            ^
/code/src/libambit/pmem20.c:1184:16: error: dereferencing pointer to incomplete type
         timeval->tv_sec += is_leap(i) ? 366 : 365;
                ^
/code/src/libambit/pmem20.c:1188:16: error: dereferencing pointer to incomplete type
         timeval->tv_sec += ndays[is_leap(ambit_time->year)][i];
                ^
/code/src/libambit/pmem20.c:1190:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec += ambit_time->day - 1;
            ^
/code/src/libambit/pmem20.c:1191:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec *= 24;
            ^
/code/src/libambit/pmem20.c:1192:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec += ambit_time->hour;
            ^
/code/src/libambit/pmem20.c:1193:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec *= 60;
            ^
/code/src/libambit/pmem20.c:1194:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec += ambit_time->minute;
            ^
/code/src/libambit/pmem20.c:1195:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec *= 60;
            ^
/code/src/libambit/pmem20.c:1196:12: error: dereferencing pointer to incomplete type
     timeval->tv_sec += ambit_time->msec / 1000;
            ^
/code/src/libambit/pmem20.c:1197:12: error: dereferencing pointer to incomplete type
     timeval->tv_usec = (ambit_time->msec % 1000)*1000;
            ^
/code/src/libambit/pmem20.c: At top level:
/code/src/libambit/pmem20.c:59:13: warning: 'to_timeval' used but never defined
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval);
             ^
/code/src/libambit/pmem20.c:1174:13: warning: 'to_timeval' defined but not used [-Wunused-function]
 static void to_timeval(ambit_date_time_t *ambit_time, struct timeval *timeval) {
             ^
make[2]: *** [src/libambit/CMakeFiles/ambit.dir/pmem20.c.o] Error 1
src/libambit/CMakeFiles/ambit.dir/build.make:284: recipe for target 'src/libambit/CMakeFiles/ambit.dir/pmem20.c.o' failed
CMakeFiles/Makefile2:75: recipe for target 'src/libambit/CMakeFiles/ambit.dir/all' failed
make[1]: *** [src/libambit/CMakeFiles/ambit.dir/all] Error 2
make: *** [all] Error 2
Makefile:117: recipe for target 'all' failed
paddy-hack commented 5 years ago

Once #221 gets merged, the Docker builds should succeed without trouble (as long as you don't try to build the wireshark dissector).

centic9 commented 4 years ago

Now that #221 is applied, building via Docker should work for you as well, please give it a try and let us know if you encounter any remaining problem.

csytsma commented 4 years ago

Has anyone tried this on Mac OSX now? I was able to run the dockerfile with default command, without any errors, but not really sure what to do after that. I'm not able to run the /run.sh script, as the -build directories don't exist.