Search code examples
cgoogle-nativeclient

Compiling native client's hello_world.c


In the pepper_21 examples folder is a hello_world.c file I'm trying to compile. Here's the command I'm using:

$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin/x86_64-nacl-gcc hello_world.c -o a.nexe -lppapi

And here's the error:

hello_world.c: In function ‘Instance_DidCreate’:
hello_world.c:86: error: ‘TCNAME’ undeclared (first use in this function)

I adapted the command from this page. How can it successfully be compiled?


Solution

  • You can see by inspecting the Makefile that TCNAME is defined on the command line.

    x86_64-nacl-gcc hello_world.c -o a.nexe -lppapi -DTCNAME=newlib 
    

    OR

    x86_64-nacl-gcc hello_world.c -o a.nexe -lppapi -DTCNAME=glibc
    

    Depending on which version of the toolchain you are using.