1

我下载了

https://www.dropbox.com/s/uammywfed6d2rgj/android_gcc_r2a.tar.bz2

https://www.dropbox.com/s/uammywfed6d2rgj/android_gcc_supplement.tar.bz2

http://rwiki.sciviews.org/doku.php?id=getting-started:installation:android

并在/data 中创建/data/local/gcc,将之前的两个文件放入其中并使用它们。

然后我修改了文件 /system/etc/mkshrc 使它这样做:

导出 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/gcc/lib 导出 PATH=$PATH:/data/local/gcc/bin

按照建议。然后我创建了一个 test1.c 文件

#include <stdio.h>
int main()
{
printf("Hello")
return 0;
}

并用命令编译它

gcc test1.c -o test1

然后执行命令

./test1

结果:

“无法执行:权限被拒绝”。test1 上的 ls -l 给了我 -rw-rw-r-- root (因为我已经将它创建为 root ;但我并没有成为 root 以及相同的“权限被拒绝”结果)。然后我尝试了一个 chmod 使其可执行,但没有成功。你有什么主意吗 ?

多谢


编辑

Symbol table '.symtab' contains 55 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 000080f4     0 SECTION LOCAL  DEFAULT    1
     2: 00008108     0 SECTION LOCAL  DEFAULT    2
     3: 00008158     0 SECTION LOCAL  DEFAULT    3
     4: 00008248     0 SECTION LOCAL  DEFAULT    4
     5: 000082e8     0 SECTION LOCAL  DEFAULT    5
     6: 000082f8     0 SECTION LOCAL  DEFAULT    6
     7: 00008330     0 SECTION LOCAL  DEFAULT    7
     8: 00008388     0 SECTION LOCAL  DEFAULT    8
     9: 00010398     0 SECTION LOCAL  DEFAULT    9
    10: 000103a0     0 SECTION LOCAL  DEFAULT   10
    11: 000103a8     0 SECTION LOCAL  DEFAULT   11
    12: 000103b0     0 SECTION LOCAL  DEFAULT   12
    13: 000103b8     0 SECTION LOCAL  DEFAULT   13
    14: 00010478     0 SECTION LOCAL  DEFAULT   14
    15: 00000000     0 SECTION LOCAL  DEFAULT   15
    16: 00000000     0 SECTION LOCAL  DEFAULT   16
    17: 00000000     0 FILE    LOCAL  DEFAULT  ABS bionic/libc/arch-arm/bion
    18: 00000000     0 FILE    LOCAL  DEFAULT  ABS test1.c
    19: 00008388     0 NOTYPE  LOCAL  DEFAULT    8 $d
    20: 00008360     0 NOTYPE  LOCAL  DEFAULT    7 $a
    21: 00008384     0 NOTYPE  LOCAL  DEFAULT    7 $d
    22: 00000000     0 FILE    LOCAL  DEFAULT  ABS bionic/libc/arch-arm/bion
    23: 00008398     0 NOTYPE  LOCAL  DEFAULT  ABS __exidx_end
    24: 000103b8     0 OBJECT  LOCAL  DEFAULT   13 _DYNAMIC
    25: 00008398     0 NOTYPE  LOCAL  DEFAULT  ABS __exidx_start
    26: 00010478     0 OBJECT  LOCAL  DEFAULT   14 _GLOBAL_OFFSET_TABLE_
    27: 00008330     0 NOTYPE  LOCAL  DEFAULT    7 $d
    28: 00010398     0 NOTYPE  LOCAL  DEFAULT    9 $d
    29: 000103a0     0 NOTYPE  LOCAL  DEFAULT   10 $d
    30: 000103a8     0 NOTYPE  LOCAL  DEFAULT   11 $d
    31: 000103b0     0 NOTYPE  LOCAL  DEFAULT   12 $d
    32: 0001039c     0 NOTYPE  LOCAL  DEFAULT    9 $d
    33: 000103a4     0 NOTYPE  LOCAL  DEFAULT   10 $d
    34: 000103ac     0 NOTYPE  LOCAL  DEFAULT   11 $d
    35: 000103b4     0 NOTYPE  LOCAL  DEFAULT   12 $d
    36: 000082f8     0 NOTYPE  LOCAL  DEFAULT    6 $a
    37: 00008308     0 NOTYPE  LOCAL  DEFAULT    6 $d
    38: 0000830c     0 NOTYPE  LOCAL  DEFAULT    6 $a
    39: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS _bss_end__
    40: 0000830c     0 FUNC    GLOBAL DEFAULT  UND puts
    41: 000103a8     0 NOTYPE  GLOBAL DEFAULT   11 __FINI_ARRAY__
    42: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start__
    43: 00008318     0 FUNC    GLOBAL DEFAULT  UND __libc_init
    44: 000103b0     0 NOTYPE  GLOBAL DEFAULT   12 __CTOR_LIST__
    45: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_end__
    46: 00008330     0 FUNC    GLOBAL DEFAULT    7 _start
    47: 000103a0     0 NOTYPE  GLOBAL DEFAULT   10 __INIT_ARRAY__
    48: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
    49: 00008360    40 FUNC    GLOBAL DEFAULT    7 main
    50: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS __end__
    51: 00010398     0 NOTYPE  GLOBAL DEFAULT    9 __PREINIT_ARRAY__
    52: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
    53: 0001048c     0 NOTYPE  GLOBAL DEFAULT  ABS _end
    54: 0001048c     0 NOTYPE  GLOBAL DEFAULT   14 __data_start
root@android:/sdcard/Development/cpp #

编辑 2:运行“mount”的结果:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
shell@android:/ $ su
su
root@android:/ # mount
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p13 /system ext4 ro,relatime,barrier=1,data=ordered 0 0
/dev/block/mmcblk0p3 /efs ext4 rw,nosuid,nodev,noatime,barrier=1,journal_async_commit,data=ordered 0 0
/dev/block/mmcblk0p12 /cache ext4 rw,nosuid,nodev,noatime,errors=panic,barrier=1,journal_async_commit,data=ordered 0 0
/dev/block/mmcblk0p16 /data ext4 rw,nosuid,nodev,noatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,dis
card 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/fuse /storage/sdcard0 fuse rw,nosuid,nodev,noexec,relatime,user_id=1023,group_id=1023,default_permissions,allow_oth
er 0 0
/dev/block/dm-0 /mnt/asec/eu.chainfire.supersu.pro-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-1 /mnt/asec/com.keramidas.TitaniumBackupPro-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-2 /mnt/asec/stericson.busybox.donate-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-3 /mnt/asec/eu.chainfire.mobileodin.pro-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-4 /mnt/asec/com.vito.lux-2 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-5 /mnt/asec/com.speedsoftware.rootexplorer-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-6 /mnt/asec/eu.chainfire.triangleaway-2 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-7 /mnt/asec/com.ea.game.realracing2_OTD_row-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-8 /mnt/asec/com.zausan.zscreenrecorderpro-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-9 /mnt/asec/sixgreen.aos.itap.notes-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0 0
/dev/block/dm-10 /mnt/asec/com.square_enix.android_googleplay.ffl_gp-1 ext4 ro,dirsync,nosuid,nodev,noatime,barrier=1 0
0
/dev/block/vold/179:17 /storage/extSdCard exfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1023,fmas
k=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=utf8,namecase=0,errors=remount-ro 0 0
root@android:/ #
4

1 回答 1

0

看起来您的编译程序位于 /sdcard/ 中。/sdcard/ 很可能是 FAT 文件系统,因此 chmod +x 将不起作用。你必须把它放在 /system/ 里面(注意: /system/ 是只读的)。

我在运行 CyanogenMod 的 GS3 上尝试了相同的操作,并将其放入 /system/ 为我工作。

于 2013-04-02T20:06:52.437 回答