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

possible to compile this for windows? #58

Closed
veso266 opened this issue Mar 12, 2018 · 26 comments
Closed

possible to compile this for windows? #58

veso266 opened this issue Mar 12, 2018 · 26 comments

Comments

@veso266
Copy link

veso266 commented Mar 12, 2018

Hi I wonder if its posible to cross-compile this for windows and also wonder if rdssea can read raw MPX stream from 192khz soundcard like RDS Spy can

Thanks for Anwsering and Best Regards

@windytan
Copy link
Owner

Unfortunately I don't have any Windows machines available and I can't answer this straight away.

Redsea can read a raw MPX stream from a 192kHz soundcard. There is an example for how to do it on Linux in the wiki.

@veso266
Copy link
Author

veso266 commented Mar 12, 2018

Hi some progress

after installing msys2 and mingw toolchain and development tools (base-devel msys2-devel) I was able to run autogen.sh script now I already builded liquid-dsp per this tut: https://github.com/cjcliffe/CubicSDR/blob/master/external/liquid-dsp/How_to_build_liquid_dsp_for_Windows.txt

now I just need to somehow reference it when executing configure so I am asking how can I specify path to my build dll and a from configure

but when I try with configure --without-liquid I get configure: error: Could not find libsndfile See `config.log' for more details

here is my autogen.sh and configure output if needed

autogen.sh

configure.ac:29: installing './compile'
configure.ac:56: installing './config.guess'
configure.ac:56: installing './config.sub'
configure.ac:4: installing './install-sh'
configure.ac:4: installing './missing'
src/Makefile.am: installing './depcomp'

configure --without-liquid

$ ./configure --without-liquid
configure: loading site script /mingw64/etc/config.site
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for /opt/local/lib... no
checking for /opt/local/lib... (cached) no
checking for main in -lsndfile... no
configure: error: in `/tobuild/rdssea/redsea':
configure: error: Could not find libsndfile
See `config.log' for more details

Thanks for Anwsering and Best Regards

@windytan
Copy link
Owner

windytan commented Mar 13, 2018

The error message can be seen on the next to last line; it means that libsndfile was not found.

You may build redsea without libsndfile by downloading a release version. For example, 0.15 can be built without libsndfile using --without-sndfile. But then redsea will not be able to read audio files, only raw PCM.

The --without-liquid option builds redsea without DSP support. I'm not sure this is what you want. This makes redsea unable to demodulate the RDS subcarrier and only builds hex decoding support. I should perhaps rename it --disable-dsp.

@veso266
Copy link
Author

veso266 commented Mar 13, 2018

Thanks will try installing libsndfile (there must be one for MSYS2/MinGW) but I still don't know how to specify path to liquid-dsp when running configure (because I already builded that and now have my dll and .lib file to link agains)

UPDATE: I am getting somewhere (still using --without-liquid because I first want to build to see if it builds) I've installed mingw-w64-x86_64-pkg-config-0.29.2-1 (probably not needing it here but its useful to have) and mingw-w64-x86_64-libsndfile

now running ./configure --without-liquid it makes makefile but when I execute make it all goes well but then stops at jsoncpp

here is the last part of makeprocess when it fails

mv -f .deps/redsea-jsoncpp.Tpo .deps/redsea-jsoncpp.Po
g++  -g -O2   -o redsea.exe redsea-redsea.o redsea-input.o redsea-subcarrier.o redsea-block_sync.o redsea-groups.o redsea-tables.o redsea-rdsstring.o tmc/redsea-tmc.o tmc/redsea-locationdb.o redsea-util.o redsea-channel.o redsea-options.o redsea-liquid_wrappers.o redsea-jsoncpp.o  -lc   -lsndfile
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lc
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:376: redsea.exe] Error 1
make[2]: Leaving directory '/tobuild/rdssea/redsea/src'
make[1]: *** [Makefile:419: all-recursive] Error 1
make[1]: Leaving directory '/tobuild/rdssea/redsea'
make: *** [Makefile:339: all] Error 2

what library would c be?

@windytan
Copy link
Owner

It seems to be libc or glibc: https://unix.stackexchange.com/questions/228886/gcc-ld-cannot-find-lc

@veso266
Copy link
Author

veso266 commented Mar 14, 2018

well now I have a problem because glibc and libc are not uvailable on MinGW. There is msvrc but I don't know what needs to be changed for rdsea to use and build agains: https://stackoverflow.com/questions/6394512/standard-c-library-in-mingw

@ghost
Copy link

ghost commented Mar 28, 2018

I build it using msys2 32 bits with gcc 7.3.0
Try this:
Add #define M_PI 3.14159265359 in config.h
Add the files:
redsea\src\liquid\liquid.h
redsea\src\liquid\liquid.internal.h
the make fails in the next line:
g++ -g -O2 -o redsea.exe redsea-redsea.o ............ -lc -lliquid -lsndfile
copy this line, remove -lc , add -liconv and then it links successfully.

@windytan
Copy link
Owner

@bra1z - Great! If there's a way to test whether we're building in msys2, this check could perhaps be added to the autoconf files.

@veso266
Copy link
Author

veso266 commented Mar 28, 2018

yep it works but you have to go to src dir first

now is there a way to quickly test it

I tried with rtl_fm
rtl_fm -M fm -l 0 -A std -p 0 -s 171k -g 20 -F 9 -f 87.9M | redsea but nothing is shown and I know that station carries RDS and the signal is strong

is there a command that would play mpx stream over to stdout to rdssea
so I could quickly test if it works with Radio700 MPX stream: http://5.35.250.101:8000/radio700-mpx.flac

@windytan
Copy link
Owner

windytan commented Mar 28, 2018

Try this:
curl http://5.35.250.101:8000/radio700-mpx.flac | flac --ogg -d -c - | redsea -r 192000

It works for me on macOS, at least.

@veso266
Copy link
Author

veso266 commented Mar 28, 2018

hmm that odd I tried with your command but nothing interesting happened then tried ./redsea -v and it echoed redsea 0.16-SNAPSHOT by OH2EIQ so it is working

but when trying to read ./redsea -h test.spy file containing RDS into it: http://downloads.dxing.si/test.spy

it just sits there doing nothing it also does nothing if also did nothing when trying with mpx stream

curl http://5.35.250.101:8000/radio700-mpx.flac | flac --ogg -d -c - | redsea -r 192000

not sure if matters but I am using PowerShell because its the only shell that supports pipes (cmd doesn't)

@windytan
Copy link
Owner

redsea reads standard input, unless a WAV file is given with -f. So in your first example it's waiting for the hex data via stdin. (This could be changed in the future though, if it's a bit misleading.) This should work in Linux/macOS: ./redsea -h < test.spy

Unfortunately I haven't used PowerShell myself. Could it be that you'd have to set the pipe to some kind of raw mode? According to this document, the pipe is not what you'd expect, as PowerShell only pipes 'objects' https://docs.microsoft.com/en-us/powershell/scripting/getting-started/fundamental/understanding-the-windows-powershell-pipeline?view=powershell-6

@mnhauke
Copy link

mnhauke commented Mar 28, 2018

You can also cross-compile redsea via MinGW.

I created a mingw package for redsea on OBS:
https://build.opensuse.org/package/show/home:mnhauke:mingw:win64:sdr/mingw64-redsea

The example @windytan mentioned does work fine with windows cmd.exe
curl http://5.35.250.101:8000/radio700-mpx.flac | flac --ogg -d -c - | redsea -r 192000

Here's an archive with precompiled windows binaries for redsea v0.16.0, flac and curl:
https://pmtu.de/.dump/mingw64-redsea-v0-16-0.zip

@veso266
Copy link
Author

veso266 commented Mar 29, 2018

yey works like a charm
@mnhauke Thanks for compiling it so others without build-envs setups can use it

using this command to get only PS

curl -s http://5.35.250.101:8000/radio700-mpx.flac | flac --totally-silent --ogg -d -c - | redsea -r 192000 | jq ".ps" 

(cmd doesn't like ' so " it is)

now I just need to filter nulls out

PS: how can I grep TMC like you did here: http://www.windytan.com/2013/05/a-determined-hacker-decrypts-rds-tmc.html

because if I do ".tmc" I get messages not raw data like you did (and redsea crashes for some reason if reading from file)
can you share your perl version?

@windytan
Copy link
Owner

This blog post is quite old; Redsea does not use Perl anymore. The TMC printout has also changed, everything is now in these messages.

I'd be interested to hear about the error message when it crashes.

@veso266
Copy link
Author

veso266 commented Mar 29, 2018

I Think it crashes because it reaches end of file
but the error is as follows in libsndfile

Ime težave:	APPCRASH
  Program Name:	redsea.exe
  Program Version:	0.0.0.0
  Timestamp:	5abbc1d0
  Library name :	libsndfile-1.dll
  Library version:	1.0.28.0
  Error TimeStamp:	00000000
  Šifra izjeme (exeption code): 	c0000005
  Odmik izjeme (exeption offset):	0000000000001c65
  Različica operacijskega sistema:	6.1.7601.2.1.0.256.1
  Področne nastavitve:	1060
  More Info 1:	bc3a
  More Info 2:	bc3abdd9effc386365dab36d02b1fef6
  More Info 3:	0de5
  More Info 4:	0de50e418839be0272e13b196ca46db0

as for TMC is is possible to get RAW data to trow it into some other TMC Decoder like: https://github.com/razor/rds-tmc-decoder or https://github.com/mueschel/TmcDecoder?

@windytan
Copy link
Owner

Yes, using the -x option.

@veso266
Copy link
Author

veso266 commented Mar 30, 2018

great
How did you get location tables for your TMC provider?
Because I tried to do this with TrafficNav (TMC provider that we are using in Slovenija and Hungary) and they wouldn't send me their LC
they said that they wanted to sign a contract with me and I don't want to sign anything with them

because without LC you can't do much with TMC
maybe I can use public TMC LC (we also have public TMC Service) with private TMC Service? or extraxt their LC from navigation system somehow

@windytan
Copy link
Owner

This depends entirely on the individual organisation. It's unfortunate that they don't want to give that out, but it could be part of their business model. I got mine a very long time ago by just asking, but it could be that they have changed their policies, too.

You can only use a location table that has the same country code and location table number as in the transmission.

@veso266
Copy link
Author

veso266 commented Mar 30, 2018

which TMC provider did you have (probably not TrafficNav)

now the only option would be to extraxt them along with the keys from Navigation system that payed the licenses: http://www.navitotal.com/general-discussions-about-tomtom-f81/rsd-tmc-traffic-decryption-keys-t18115.html

http://download.tomtom.com/sweet/navcore/8.351.go530-go730-go930.CAB-navcore-GO.cab the file that should hold them
now I hope they are in standard format there

@ghost
Copy link

ghost commented Mar 31, 2018

I found a project with a few location tables:
https://gitlab.com/mvglasow/qz
Look in asset folder. The files are in jdbc format.
By the way, I found a really easy way to view the TMC locations using the node-red program.
I use the node daemon to run the redsea program and the node worldmap to see the points.

@veso266
Copy link
Author

veso266 commented Mar 31, 2018

nice
but I am not sure if theese LC are private or public ones
can you share your script to plot on a Map with node and Redsea?

@ghost
Copy link

ghost commented Mar 31, 2018

Yeah, sure
I use the next cmd script:
C:\rtl_fm\rtl_fm -M fm -l 0 -A std -p 0 -s 171k -g 10 -F 9 -f 93.2M | C:\rtl_fm\redsea -l TMC
Check the daemon node properties for write the correct path to the script.
Note I am using absolute paths ( maybe this is not necessary using linux or Mac ).
If you have problems installing red-node, the electron version is more easy to install:
https://electronjs.org/apps/node-red
Remember, you have also to install node-red-node-daemon and node-red-contrib-web-worldmap.
Don't forget type Ctrl. Shift M to see the map. This is a very simple flow, doesn't draw all points.
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option

[{"id":"bb9c107d.61df","type":"daemon","z":"dc7c50ab.e5301","command":"C:\\rtl_fm\\run.cmd","args":"","cr":false,"redo":true,"op":"string","name":"REDSEA","x":100,"y":80,"wires":[["a1f033a1.8a46f"],[],[]]},{"id":"cde22226.0c2f7","type":"function","z":"dc7c50ab.e5301","name":"extract plots","func":"var value = msg.payload.group;\n\nif(value==\"8A\")\n{\n if(\"tmc\" in msg.payload)\n {\n var tmc_object = msg.payload.tmc;\n\n if(\"message\" in tmc_object)\n {\n var message_object = tmc_object.message;\n \n msg.payload = { \n name : message_object.road_name + \" \" + message_object.location,\n \n lat : parseFloat(message_object.coordinates[0].lat),\n lon : parseFloat(message_object.coordinates[0].lon),\n };\n \n return msg;\n }\n }\n}\n","outputs":1,"noerr":0,"x":210,"y":260,"wires":[["f78b623d.80716"]]},{"id":"a1f033a1.8a46f","type":"json","z":"dc7c50ab.e5301","name":"","pretty":false,"x":230,"y":180,"wires":[["cde22226.0c2f7"]]},{"id":"f78b623d.80716","type":"worldmap","z":"dc7c50ab.e5301","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","panit":"false","x":190,"y":380,"wires":[]}]

@ghost
Copy link

ghost commented May 9, 2018

I made a program for Windows in C# language using redsea. The program draw the plots of RDS-TMC traffic. Be sure to put in TMC folder the correct location tables and edit the file run.cmd to change frequency and gain. https://github.com/bra1z/redseaTMCmap

@windytan
Copy link
Owner

windytan commented Jun 5, 2018

The original issue being resolved by the mingw build I'm closing this issue now. I added a mention about this in the wiki.

@master131
Copy link
Contributor

master131 commented Feb 19, 2022

Just in-case anyone looks at this issue again, I've added additional ways which redsea can be installed on Windows on the Wiki:
https://github.com/windytan/redsea/wiki/Installation

These include:

  • Cross-compiling using MinGW as already previously mentioned
  • Using the Windows Subsystem for Linux (warning: there is currently no support for libusb in WSL2)
  • MinGW build on Windows via MSYS2
  • Using Cygwin

@windytan FYI.

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

No branches or pull requests

4 participants