I found a library that helps to convert WAV file to Flac: https://github.com/jhurt/wav_to_flac
Also succeed to compile Flac to the platform and it works fine.
I\
Your question is not very specific, but you need to use Audio Recording Services, which will let you get access to the audio data in chunks, and then move the data you get from there into the streaming interface of the FLAC encoder. You can not use the WAV to FLAC program you linked to, you have to tap into the FLAC library yourself. API docs here.
Example on how to use a callback here.