Re: Questions thread

13 views
Skip to first unread message

Fabrizio Bertocci

unread,
May 25, 2021, 3:35:47 AMMay 25
to John F, cosmopolitan cosmonauts
John,
See inline

On Fri, May 21, 2021 at 2:54 AM John F <joao...@gmail.com> wrote:

Hi, all! Hope it's ok to start a questions thread.
I'll go first...
I followed the tutorial to get started on windows. Everything worked beautifully, but I noticed my hello.com didn't work when moved to a different drive on my computer. I click it, nothing happens.
Worked fine in other folders in the same drive where it was compiled, in a different windows machine, and I even got a friend to test in on his mac. Does this make any sense?
For this I am going to defer the answer to somebody else who is more expert on Windows (or at least that has a way to see what's going on)... 


 

speaking of mac, he tells me he had to do chmod +x hello.com to run it, clicking it doesn't work. Is there any simple trick I can do from windows to make it clickable?
(I suppose there are probably more appropriate places to ask this one...)
Making a file executable on Mac/Linux has to do with the filesystem, so it also depends on how you transfer the file. For example, if you put your executable on a FAT formatted USB drive and you move it to a Linux/Mac, it should work without chmod (because FAT does not support ownership attributes on files).


 
And, more seriously now, what cosmopolitan would really revolutionize for me is distribution of C+SDL software and games for linux and mac. I already saw that thread on github and I'm very excited about the future of cosmopolitan, but in the meanwhile, I tried to compile my simple pong example with cosmo like so:

bin\x86_64-pc-linux-gnu-gcc.exe -g -O -o pong.com.dbg main.c^
  -static -fno-pie -no-pie -mno-red-zone -fno-omit-frame-pointer -nostdlib -nostdinc^
  -Wl,--gc-sections -Wl,-z,max-page-size=0x1000 -fuse-ld=bfd^
  -Wl,-T,ape.lds -include cosmopolitan.h crt.o ape.o cosmopolitan.a^
  -IC:/SDL/SDL2-2.0.14/i686-w64-mingw32/include/SDL2^
  -LC:/SDL/SDL2-2.0.14/i686-w64-mingw32/lib^
  -lmingw32 -lSDL2main -lSDL2
bin\x86_64-pc-linux-gnu-objcopy.exe -SO binary pong.com.dbg pong.com
pong.com


and this is what I get:

C:/SDL/SDL2-2.0.14/i686-w64-mingw32/include/SDL2/SDL_stdinc.h:56:12: fatal error: stddef.h: No such file or directory
   56 | #  include <stddef.h>
      |            ^~~~~~~~~~
compilation terminated.

SDL needs standard library stuff, which cosmo provides to my code (with magic??) but apparently the magic doesn't reach all the way to SDL..

So, this is a common problem when building existing code for Cosmopolitan. Your source code contains references to include files that don't exist in Cosmopolitan. You have two options here. You can modify the source files and remove all those includes, or you can create empty files (or grab them from another repo) matching all those header files.
When porting apps to Cosmo I have my set of emptpy header files. If you want you can just clone this repo and use them (they are all empty files...):
This is not even close to matching the header files in a modern Linux system... But it's easy to add more empty files as you discover them.

Regards,
Fab
Reply all
Reply to author
Forward
0 new messages