OK time to start another thread....pexe

32 views
Skip to first unread message

Steven Anderson

unread,
Jul 22, 2015, 12:48:50 PM7/22/15
to Native-Client-Discuss
Ok, my application that I am porting has multiple directories and multiple sub-directories with multiple arches.

I have compiled one arch x86_64 on glibc which I compiled from the naclports

My next step is to take this simple app example provided by google.
----------------------------------------------------------------

 Add the PNaCl toolchain to your path for convenience, if desired:

PATH=${PATH}:toolchain/linux_x86/pnacl_newlib/bin    # Adjust the name for your system  

Now compile hello.c:

pnacl-clang hello.c -o hello.nonfinal.pexe
pnacl-finalize hello.nonfinal.pexe -o hello.pexe

(NOTE: If you get an error about missing crt1.o or -lnacl, you must run the SDK install step. See the installation instructions in the previous section.)

You have now produced a "pexe", a PNaCl bitcode application. To run this pexe, it must be first translated to native code. Let's translate it to X86-32, X86-64 and ARM.

pnacl-translate -arch x86-32 hello.pexe -o hello_x86_32.nexe
pnacl-translate -arch x86-64 hello.pexe -o hello_x86_64.nexe
pnacl-translate -arch arm    hello.pexe -o hello_arm.nexe

and apply it to this (which is the output of my complile with compat-glibc x86_64?
                                  **********Thanks in advance**************

*************I hope the answers help others besides myself!**************

steven@Steven:~/Downloads/NaCl/naclports/src/qemu/pnacl_qemu-0.9.1/qemu-2.2.1$ ls -al x86_64-softmmu/
total 31184
drwxr-xr-x   7 steven steven     4096 Jul 20 13:38 .
drwxr-xr-x 111 steven steven    16384 Jul 21 18:34 ..
-rw-r--r--   1 steven steven    29533 Jul 20 13:37 arch_init.d
-rw-r--r--   1 steven steven   131744 Jul 20 13:37 arch_init.o
-rw-r--r--   1 steven steven    21857 Jul 20 13:37 balloon.d
-rw-r--r--   1 steven steven    39352 Jul 20 13:37 balloon.o
-rw-r--r--   1 steven steven    18209 Jul 20 13:37 bootdevice.d
-rw-r--r--   1 steven steven    49216 Jul 20 13:37 bootdevice.o
-rw-rw-r--   1 steven steven     1656 Jul  8 21:09 config-devices.mak
-rw-rw-r--   1 steven steven     1656 Jul  8 21:09 config-devices.mak.old
-rw-r--r--   1 steven steven      321 Jul 20 09:21 config-target.h
-rw-r--r--   1 steven steven      321 Jul 20 09:21 config-target.h-timestamp
-rw-rw-r--   1 steven steven      285 Jul 20 08:56 config-target.mak
-rw-r--r--   1 steven steven    18328 Jul 20 13:37 cpu-exec.d
-rw-r--r--   1 steven steven    82816 Jul 20 13:37 cpu-exec.o
-rw-r--r--   1 steven steven    23831 Jul 20 13:37 cpus.d
-rw-r--r--   1 steven steven   178048 Jul 20 13:37 cpus.o
-rw-r--r--   1 steven steven    19146 Jul 20 13:37 cputlb.d
-rw-r--r--   1 steven steven   205152 Jul 20 13:37 cputlb.o
-rw-r--r--   1 steven steven    19421 Jul 20 13:37 device_tree.d
-rw-r--r--   1 steven steven    60160 Jul 20 13:37 device_tree.o
-rw-r--r--   1 steven steven    19409 Jul 20 13:37 disas.d
-rw-r--r--   1 steven steven    70272 Jul 20 13:37 disas.o
-rw-r--r--   1 steven steven    22058 Jul 20 13:37 dump.d
-rw-r--r--   1 steven steven   181912 Jul 20 13:37 dump.o
-rw-r--r--   1 steven steven    24466 Jul 20 13:37 exec.d
-rw-r--r--   1 steven steven   313168 Jul 20 13:37 exec.o
drwxr-xr-x   2 steven steven     4096 Jul 20 13:37 fpu
-rw-r--r--   1 steven steven    21499 Jul 20 13:37 gdbstub.d
-rw-r--r--   1 steven steven   203256 Jul 20 13:37 gdbstub.o
-rw-r--r--   1 steven steven    23354 Jul 20 13:37 hmp-commands.h
drwxr-xr-x  17 steven steven     4096 Jul 20 09:21 hw
-rw-r--r--   1 steven steven    17783 Jul 20 13:37 ioport.d
-rw-r--r--   1 steven steven    52888 Jul 20 13:37 ioport.o
-rw-r--r--   1 steven steven    25320 Jul 20 13:37 kvm-all.d
-rw-r--r--   1 steven steven   284696 Jul 20 13:37 kvm-all.o
lrwxrwxrwx   1 steven steven       90 Jul 20 08:56 Makefile -> /home/steven/Downloads/NaCl/naclports/src/qemu/pnacl_qemu-0.9.1/qemu-2.2.1/Makefile.target
-rw-r--r--   1 steven steven    19821 Jul 20 13:37 memory.d
-rw-r--r--   1 steven steven    17019 Jul 20 13:37 memory_mapping.d
-rw-r--r--   1 steven steven    47560 Jul 20 13:37 memory_mapping.o
-rw-r--r--   1 steven steven   358944 Jul 20 13:37 memory.o
-rw-r--r--   1 steven steven    34933 Jul 20 13:37 monitor.d
-rw-r--r--   1 steven steven   767672 Jul 20 13:37 monitor.o
-rw-r--r--   1 steven steven    22639 Jul 20 13:37 numa.d
-rw-r--r--   1 steven steven    64864 Jul 20 13:37 numa.o
-rwxr-xr-x   1 steven steven 27461128 Jul 20 13:38 qemu-system-x86_64
-rw-r--r--   1 steven steven    15181 Jul 20 13:37 qmp-commands-old.h
-rw-r--r--   1 steven steven    20432 Jul 20 13:37 qtest.d
-rw-r--r--   1 steven steven   119472 Jul 20 13:37 qtest.o
-rw-r--r--   1 steven steven    24388 Jul 20 13:37 savevm.d
-rw-r--r--   1 steven steven   162816 Jul 20 13:37 savevm.o
drwxr-xr-x   2 steven steven     4096 Jul 20 13:38 target-i386
drwxr-xr-x   2 steven steven     4096 Jul 20 13:37 tcg
drwxr-xr-x   2 steven steven     4096 Jul 20 13:38 trace
-rw-r--r--   1 steven steven    18738 Jul 20 13:37 translate-all.d
-rw-r--r--   1 steven steven   108056 Jul 20 13:37 translate-all.o
-rw-r--r--   1 steven steven    20800 Jul 20 13:37 xen-common.d
-rw-r--r--   1 steven steven    64160 Jul 20 13:37 xen-common.o
-rw-r--r--   1 steven steven    27304 Jul 20 13:37 xen-hvm.d
-rw-r--r--   1 steven steven   161104 Jul 20 13:37 xen-hvm.o
-rw-r--r--   1 steven steven    21457 Jul 20 13:37 xen-mapcache.d
-rw-r--r--   1 steven steven    52752 Jul 20 13:37 xen-mapcache.o

Steven Anderson

unread,
Jul 24, 2015, 10:52:06 AM7/24/15
to Native-Client-Discuss, wanfu...@gmail.com
*************UPDATE************

Looks like the solution to getting from  a large application to NaCl or PNACL involves following cross compile directions and using CMake or AutoConfig.

Anyone have good directions on doing this with NaCl/PNACL?
Reply all
Reply to author
Forward
0 new messages