BenningtonCS / Telescope-2014

4 stars 0 forks source link

build srtn on mac os #13

Open edaniszewski opened 10 years ago

edaniszewski commented 10 years ago

@hcrowl suggested adding support for mac os, and earlier we found that it appears Fink has the needed package dependencies (or, ports of those packages) that will allow srtn to run.

Should get Fink, install the relevant packages, and attempt to compile srtn.

edaniszewski commented 10 years ago

I managed to get libusb installed on mac with Fink and gtk+ installed via the gtk+ website. I tried compiling with the hope that maybe it would magically just work -- it didn't, as expected. I'm added the error messages below. It appears to be unable to find the libraries, so the next step is likely to figure out how to reference the libraries correctly.


srtnmake: line 29: pkg-config: command not found
main.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
vspectra_four.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from disp.c:14:
./d1proto.h:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
plot.c:10:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from cat.c:13:
./d1proto.h:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from geom.c:12:
./d1proto.h:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from time.c:15:
./d1glob.h:2:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from outfile.c:13:
./d1proto.h:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
sport.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
map.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
In file included from cmdfl.c:13:
./d1proto.h:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
cal.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
srthelp.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
velspec.c:9:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^
1 error generated.
librtlsdr.c:15:10: fatal error: 'libusb-1.0/libusb.h' file not found
#include <libusb-1.0/libusb.h>
         ^
1 error generated.
tuner_r820t.c:781:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 5);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:804:32: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 5);
        ~~~~~~~~~~~~~          ^
tuner_r820t.c:826:36: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 5);
            ~~~~~~~~~~~~~          ^
tuner_r820t.c:848:40: warning: too many arguments in call to 'R828_Delay_MS'
                R828_Delay_MS(pTuner, 5);
                ~~~~~~~~~~~~~          ^
tuner_r820t.c:871:45: warning: too many arguments in call to 'R828_Delay_MS'
                    R828_Delay_MS(pTuner, 20);
                    ~~~~~~~~~~~~~           ^
tuner_r820t.c:1406:17: warning: explicitly assigning a variable of type 'UINT32'
      (aka 'unsigned int') to itself [-Wself-assign]
        VCO_Fra = VCO_Fra;
        ~~~~~~~ ^ ~~~~~~~
tuner_r820t.c:1465:37: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 20);
            ~~~~~~~~~~~~~           ^
tuner_r820t.c:1467:37: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 10);
            ~~~~~~~~~~~~~           ^
tuner_r820t.c:1469:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10);
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:1605:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10); //
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:1932:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 5);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:2138:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10);
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:2403:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 1);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:2608:38: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 250);
            ~~~~~~~~~~~~~            ^
14 warnings generated.
cp: a.out: No such file or directory
rm: a.out: No such file or directory
acencini commented 10 years ago

i have had nothing bad bad juju with macos and gtk+

a solution that could possibly lead to better results would be to tease the GUI component out of the main logic so different skins could be thrown on top via a simple API.

if the computation is best done in C, it is still possible to have a viewer written in a higher-level language interact with this module. to a certain degree this principle already applies with the FFT stuff where the author has a modular(ish) fft strategy. i think we could do the same on the front end, and make it easier to build and deploy

edaniszewski commented 10 years ago

Related to what you said about separating the UI: #16

Berrescuda commented 10 years ago

Moving this to Dream Land.

edaniszewski commented 10 years ago

using

fink install gtk+2-dev
fink install libusb1

on my mac, it managed to throw errors that weren't related to gtk or libusb (so it seems like those commands will get the libraries we need). The errors we are left with are:

vpn-cust-10-119-24-3:srtnver3 erickdaniszewski$ ./srtnmake
main.c:12:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^
1 error generated.
vspectra_four.c:12:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^
1 error generated.
sport.c:10:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^
1 error generated.
cal.c:10:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^
1 error generated.
tuner_r820t.c:781:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 5);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:804:32: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 5);
        ~~~~~~~~~~~~~          ^
tuner_r820t.c:826:36: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 5);
            ~~~~~~~~~~~~~          ^
tuner_r820t.c:848:40: warning: too many arguments in call to 'R828_Delay_MS'
                R828_Delay_MS(pTuner, 5);
                ~~~~~~~~~~~~~          ^
tuner_r820t.c:871:45: warning: too many arguments in call to 'R828_Delay_MS'
                    R828_Delay_MS(pTuner, 20);
                    ~~~~~~~~~~~~~           ^
tuner_r820t.c:1406:17: warning: explicitly assigning a variable of type 'UINT32'
      (aka 'unsigned int') to itself [-Wself-assign]
        VCO_Fra = VCO_Fra;
        ~~~~~~~ ^ ~~~~~~~
tuner_r820t.c:1465:37: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 20);
            ~~~~~~~~~~~~~           ^
tuner_r820t.c:1467:37: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 10);
            ~~~~~~~~~~~~~           ^
tuner_r820t.c:1469:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10);
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:1605:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10); //
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:1932:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 5);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:2138:33: warning: too many arguments in call to 'R828_Delay_MS'
        R828_Delay_MS(pTuner, 10);
        ~~~~~~~~~~~~~           ^
tuner_r820t.c:2403:28: warning: too many arguments in call to 'R828_Delay_MS'
    R828_Delay_MS(pTuner, 1);
    ~~~~~~~~~~~~~          ^
tuner_r820t.c:2608:38: warning: too many arguments in call to 'R828_Delay_MS'
            R828_Delay_MS(pTuner, 250);
            ~~~~~~~~~~~~~            ^
14 warnings generated.
cp: a.out: No such file or directory
rm: a.out: No such file or directory
edaniszewski commented 10 years ago

The too many args warning is peculiar, but it seems like the sys/io.h error is just a matter of finding where (if?) that is on the mac

ghost commented 9 years ago

How did you end up solving these warnings?

edaniszewski commented 9 years ago

@14libb I never ended up coming to a solution on these warnings, since there were Linux machines available which it worked on, so getting it to work on a mac was put on the back burner. I spent a few hours today revisiting this, and unfortunately ran into a few problems.

It's been a while since I've tried running this on Mac -- when I first posted the results I was running Snow Leopard, now I am running Mavericks (plus probably a bunch of other environment changes), so trying to resolve this again, I got stuck at getting GTK to work on a Mac again.

I've tried installing it with:

$ fink install gtk+2-dev and $ brew install gtk+

which both installed fine, but perhaps there are some funky things going on with my environment variables ( or symlinks? not too sure how fink and brew work, unfortunately). It looks like getting libusb from either fink or brew works fine though

$ fink install libusb1 $ brew install libusb

If you can get it to the point where you are getting errors similar to my prior post:

...

main.c:12:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^

...

this may be worth trying: http://stackoverflow.com/questions/2762010/osx-sys-io-h-not-found I have no idea if this is the solution, or even relevant, but as I am unable to test it, I can't give a great answer..

Let me know if you figure anything out!

ghost commented 9 years ago

I did get it to work! http://stackoverflow.com/questions/2762010/osx-sys-io-h-not-found Definitely worked to get rid of the sys/io.h not found error and then Using the code from this link: https://github.com/merbanan/rtl-astrometa/blob/master/src/tuner_r820t.c

You should replace the tuner_r820t.c that's in the srtverx folder with that link. If you notice the errors, they say that there are the wrong number of arguments, and in the link, they fix this. I looked at the tunerr820t.c file and the R828_Delay_MS is never given the specific inputs, whereas the link does.

The next step would be to open X11 (or any other application of the like), and then run: ./srtn

I am running this with Mavericks and Homebrew

screen shot 2014-12-06 at 3 15 32 pm

acencini commented 9 years ago

@14libb - thanks for your update on this. out of curiosity, are you working to build a SRT? we'd be interested to hear what you're up to - feel free to contact me via email (acencini@bennington.edu) if you don't want to provide details here :)