WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: run binary file(compile on other platform) on TinyCore directly boot from iso  (Read 8245 times)

Offline leehui

  • Newbie
  • *
  • Posts: 5
Hi, all
I have met a problem here.
I am now using Bochs as host system of TinyCore
I successfully installed the CorePlus-crrent.iso(32bit) into the disk(created by bochs tool named bximage),  then I complied a simple "hello world" c program for tiny core on my ubuntu  and copied it under the root dir of the disk. Finally it ran well.
But when I boot the 32bit Tiny core directly from iso file, and mounted the disk that held the binary file. the program could not run.  Similarly, a 64-bit program could not run when directly boot from a 64-bit iso.
Then, I install a pure 32bit tinycore into another disk without any extensions, and substituded the core.gz and vmlinuz with 64bit version, and tried to run the program, failed again.
I am new of TinyCore, Please help!

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Please post the error message you get.
The only barriers that can stop you are the ones you create yourself.

Offline leehui

  • Newbie
  • *
  • Posts: 5
the error message is very strange:
      hello: line 1: syntax error: unexpected "("
where "hello" is the name of the binary, and ran well on my ubuntu.

is there any experience of running binaries on 64 bit TinyCore???

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
Often that error means that the bash extension is required.

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Then it is not a binary, you copied a script.
The only barriers that can stop you are the ones you create yourself.

Offline leehui

  • Newbie
  • *
  • Posts: 5
Hi, Juanito

I installed the bash.tcz, this time the bash shows that "hello: cannot execute binary file".

It seems that the hello is not recognised
But I am sure that the hello is compiled by gcc of my ubuntu(64bit), I do not know why.

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
For best compatibility, you should compile on TinyCore.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Hi leehui
Quote
... bash shows that "hello: cannot execute binary file".
That sounds like you entered something like this to try to execute your file:
Code: [Select]
bash helloIs the program located in a directory that's listed in the  PATH  environmental variable? If it is, then just  hello  should allow
it to execute. If it's not in the path, but in the directory you are currently in, then  ./hello  should work. If it's not in the path, but
in a different directory, then  /path/to/program/hello  should work.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
"ldd /path-to-file/hello" might also be worth trying.

Offline leehui

  • Newbie
  • *
  • Posts: 5
Hi Rich

I have tried all the methods you mentioned, it did not work. It seems because the incompatibility between two platforms

Hi  Juanito

I have tried "ldd /home/tc/hello", it echoed :
linux-vdso.so.1 (0x00007f7f076b5000)
libc.so.6 = > /lib/libc.so.6 (0x00007f7f076b5000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f7f076b5000)

any problem?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
CorePure64 does not have /lib64. You could create a symlink, but the best would be to compile locally

Offline leehui

  • Newbie
  • *
  • Posts: 5
Hiļ¼ŒJuanito

I think that the /lib64 stands for the dir of my 64bit Ubuntu from where the binary is generated. Now that the ldd can link /lib64 to /lib(stands for the dir of the running TinyCore), symlink should not be needed.
I will Try to install GCC and to compile program locally.

thanks for your reply.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
OK - be sure to load the compiletc extension rather than gcc alone.