How to access Alsa asoundlib api's in chrome native client.

105 views
Skip to first unread message

ananthith...@gmail.com

unread,
Jul 21, 2015, 8:05:02 AM7/21/15
to native-cli...@googlegroups.com
Hi all,
     I am trying to access Alsa api's so i include <alsa/asoundlib.h> in part2 example in pepper43/gettingstarted tutorial.when i run "make TOOLCHAIN=linux" it compiled successfully but when i try to run "make" for TOOLCHAIN=newlib/glibc /pnacl it gives error like <alsa/asoundlib.h> no such file or directory.

Though asoundlib.h located in usr/include/alsa directory in linux so that linux toolchain found that header but Nacl/Pnacl toolchain cant able to find that header.Though Linux toolchain only for debugging purpose and plugin .so generated by linux toolchain only be used under linux only.In my case i have to run my application on CHROMEOS,so i should compile only in Nacl/pnacl toolchain.i dont know where to start.kinly help me.. 

Victor Khimenko

unread,
Jul 21, 2015, 8:31:41 AM7/21/15
to Native Client Discuss

The whole point of NaCl, it's raison d'être is the ability to run native CPU-dependent code WITHOUT the ability to access the underlaying OS APIs. If you'll find a way to access ALSA from NaCl on ChromeOS then it'll be priority 0 security bug which will be fixed ASAP. E.g. with ALSA API you'll be able to silently capture audio input which is most defenitely not something random website should be able to do.

If your goal is to play sound then you could use PPAPI Audio:

If your goal is capture audio input then you could use PPAPI MediaStream (but this is only for installable apps with the appropriate permissions, not for the PNaCl apps on the open web):
  https://code.google.com/p/chromium/codesearch#chromium/src/native_client_sdk/src/examples/api/media_stream_audio/

ananthith...@gmail.com

unread,
Jul 21, 2015, 9:33:26 AM7/21/15
to native-cli...@googlegroups.com
Hi khim,
         I am not supposed to use ppapi's ,i should use only ALSA as per customer requirement.My job is to call Alsa api in Native client and use the output of Alsa api i will plot graph in HTML using javascript.

      I cant find anything useful about this...Realy if there is no way to call ALSA from Nacl?thank you

Victor Khimenko

unread,
Jul 21, 2015, 10:33:27 AM7/21/15
to Native Client Discuss
On Tue, Jul 21, 2015 at 4:33 PM, <ananthith...@gmail.com> wrote:
Hi khim,
         I am not supposed to use ppapi's ,i should use only ALSA as per customer requirement.

Well, you've picked up an impossible task, deal with it.
 
My job is to call Alsa api in Native client and use the output of Alsa api i will plot graph in HTML using javascript.

      I cant find anything useful about this...Realy if there is no way to call ALSA from Nacl?

As I've said: that's the whole point. NaCl makes it possible to use native x86 (or ARM... or MIPS... depens on the CPU architecture of your device) binaries but it completely isolates them from the underlying OS. You can't do Win32 API calls on Windows, you can't access Mach API on MacOS and you can't use native Linux APIs like ALSA on ChromeOS. The only way to interact with the environmnt is via PPAPI.

thank you

On Tuesday, July 21, 2015 at 6:01:41 PM UTC+5:30, khim wrote:

The whole point of NaCl, it's raison d'être is the ability to run native CPU-dependent code WITHOUT the ability to access the underlaying OS APIs. If you'll find a way to access ALSA from NaCl on ChromeOS then it'll be priority 0 security bug which will be fixed ASAP. E.g. with ALSA API you'll be able to silently capture audio input which is most defenitely not something random website should be able to do.

If your goal is to play sound then you could use PPAPI Audio:

If your goal is capture audio input then you could use PPAPI MediaStream (but this is only for installable apps with the appropriate permissions, not for the PNaCl apps on the open web):
  https://code.google.com/p/chromium/codesearch#chromium/src/native_client_sdk/src/examples/api/media_stream_audio/

On Tue, Jul 21, 2015 at 3:05 PM, <ananthith...@gmail.com> wrote:
Hi all,
     I am trying to access Alsa api's so i include <alsa/asoundlib.h> in part2 example in pepper43/gettingstarted tutorial.when i run "make TOOLCHAIN=linux" it compiled successfully but when i try to run "make" for TOOLCHAIN=newlib/glibc /pnacl it gives error like <alsa/asoundlib.h> no such file or directory.

Though asoundlib.h located in usr/include/alsa directory in linux so that linux toolchain found that header but Nacl/Pnacl toolchain cant able to find that header.Though Linux toolchain only for debugging purpose and plugin .so generated by linux toolchain only be used under linux only.In my case i have to run my application on CHROMEOS,so i should compile only in Nacl/pnacl toolchain.i dont know where to start.kinly help me.. 

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.
To post to this group, send email to native-cli...@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-discuss.
For more options, visit https://groups.google.com/d/optout.

ananthith...@gmail.com

unread,
Jul 22, 2015, 3:32:43 AM7/22/15
to Native-Client-Discuss
Thank You Khim..
Message has been deleted

Ananthi Thangavel

unread,
Nov 5, 2015, 4:37:01 AM11/5/15
to Native-Client-Discuss
   Hi Khim,
 
 I have  *.so file  which is compiled in linux. I need to access api in this *.so file from nacl. How to Link this linux *.so file with nacl? Is it possible?

Victor Khimenko

unread,
Nov 5, 2015, 4:53:07 AM11/5/15
to Native Client Discuss
On Thu, Nov 5, 2015 at 10:34 AM, Ananthi Thangavel <ananthith...@gmail.com> wrote:
Hi Khim,

            I have  *.so file  which is compiled in linux. I need to access api in this *.so file from nacl.

If you need to access API defined in .so from NaCl then you are doing something wrong. If that's desktop OS (Linux/Mac/Windows) then you'll want to use Native Messaging. If that's fork of the ChromeOS then you want to add your own PPAPI interface. If that's standard ChromeOS then you couldn't do that at all.
 
How to Link this linux *.so file with nacl? Is it possible?

Wrong question. Yes, you could link your .so with NaCl application. But the resulting application wouldn't work!

That's the whole point of NaCl as I've said before: NaCl security components (special type of compiler, validator, and so on) exists SPECIFICALLY to make that scenario impossible!

Ananthi Thangavel

unread,
Nov 6, 2015, 12:59:43 AM11/6/15
to Native-Client-Discuss
Hi khim,

           Thank you. 

Ananthi Thangavel

unread,
Nov 6, 2015, 1:00:49 AM11/6/15
to Native-Client-Discuss
Hi khim,

           Is it possible to access ALSA in android NDK toolchain?

Victor Khimenko

unread,
Nov 6, 2015, 3:58:03 AM11/6/15
to Native Client Discuss
On Fri, Nov 6, 2015 at 7:00 AM, Ananthi Thangavel <ananthith...@gmail.com> wrote:
Hi khim,

           Is it possible to access ALSA in android NDK toolchain?

I don't know for sure. Depends on device, I guess. On devices with root access it should be possible for sure. 

Ananthi Thangavel

unread,
Nov 6, 2015, 4:07:57 AM11/6/15
to Native-Client-Discuss


Hi khim,

       Thank You for your reply and tell me how is it possible with root access devices.Kindly share your thoughts.

      

Victor Khimenko

unread,
Nov 6, 2015, 4:17:19 AM11/6/15
to Native Client Discuss
On Fri, Nov 6, 2015 at 10:07 AM, Ananthi Thangavel <ananthith...@gmail.com> wrote:


Hi khim,

       Thank You for your reply and tell me how is it possible with root access devices.Kindly share your thoughts.

With root access you could do whatever you want to the whole system (that's why many applications refuse to run on such systems), which obviously includes access to ALSA, but I don't know what specific pitfalls you could face, sorry.

Reply all
Reply to author
Forward
0 new messages