Greetings, I am too lazy to do bare metal, but found a very light weight Linux distro which uses Musl and Busybox. Thought was to get basic port up using XFCE desktop then switch to direct framebuffer and not use the desktop. Let someone else do usb and net drivers et al. Unfortunately, I gave away all my C references and it has been a couple of decades since I did anything serious in C. I added -D_GNU_SOURCES to the CFLAGS but am getting a wierd (to me) error. Apparently FILE is #defined as some kind of opaque type? Anyway, breakage in platforms/Cross/vm/sqVirtualMachine.c for pushOutputFile() Can some kind soul help me out with a workaround for this? Thanks a bunch! -KenD AlpineLinux-aarch64-LOG (13K) Download Attachment
-KenD
|
On 03/12/19 3:50 AM, [hidden email] wrote: > ^ > /home/kend/Opensmalltalk-vm/platforms/Cross/vm/sqVirtualMachine.c: At top level: > /home/kend/Opensmalltalk-vm/platforms/Cross/vm/sqVirtualMachine.c:555:13: error: array type has incomplete element type 'FILE' {aka 'struct _IO_FILE'} > static FILE stdoutStack[STDOUT_STACK_SZ]; ostvm code compiles with gcc/glibc but may need tweaking for musl. See https://www.musl-libc.org/faq.html (from "Is musl compatible with glibc") FILE is a type defined in stdio.h and its structure in libio.h. stdio.h is so basic that I am surprised it is not being picked up. Are you able to compile and run hello world example on this distro? Regards .. Subbu |
In reply to this post by KenDickey
On Mon, Dec 02, 2019 at 02:20:08PM -0800, [hidden email] wrote: > I am too lazy to do bare metal, but found a very light weight Linux distro > which uses Musl and Busybox. I've built pharo.cog.spur.minheadless on Alpine Linux x86_64. Check out https://github.com/PierceNg/opensmalltalk-vm/tree/pierce_alpine. This is using the cmake build system. And these are the pre-requisite packages: build-base git bash perl curl linux-headers libexecinfo-dev util-linux-dev cmake clang clang-dev I'm using this to work towards the smallest possible Docker image for Pharo for running headless, batch and server-side applications: https://github.com/pharo-contributions/Docker-Alpine Pierce |
In reply to this post by KenDickey
hi Ken, On Mon, Dec 2, 2019 at 2:21 PM <[hidden email]> wrote: Greetings, I would try two things. One is to find out where FILE is defined by searching the system's include files. There has to be some kind of definition because e.g. open answers a FILE *. So one /has/ to be able to write e.g. FILE *f = open("foo.txt",... and that's all the code is doing, trying to declare a small array of FILE *'s. The second thing would be to commit a change to swVirtualMachine.c which simply ifdef's out push/popOutputFile if some manifest constant, such as CANT_USE_FILE_STAR or DONT_USE_FILE_STAR is defined in the makefile (so that files are compiled with -DDONT_USE_FILE_STAR=1 or some such).
_,,,^..^,,,_ best, Eliot |
In reply to this post by KenDickey
Hi Ken, oops. Ignore the part about having to be able to declare FILE *. I wasn't understanding. Just develop the work around. On Mon, Dec 2, 2019 at 2:21 PM <[hidden email]> wrote: Greetings, _,,,^..^,,,_ best, Eliot |
In reply to this post by KenDickey
> I would try two things. One is to find out where FILE is defined by
> searching the system's include files. There has to be some kind of > definition because e.g. open answers a FILE *. So one /has/ to be able > to > write e.g. > FILE *f = open("foo.txt",... > > and that's all the code is doing, trying to declare a small array of > FILE > *'s. Ya. Attached. The code array uses 'FILE', not 'FILE *', btw. static FILE stdoutStack[STDOUT_STACK_SZ]; Hey, I once used '***' in EPROM boot code -- because I had to! My ol' brain has now rotted and no longer does cdecl. Back to the '80's. I am just confused by this. I don't know enough memory usage context to safely convert to 'FILE *' > The second thing would be to commit a change to sqVirtualMachine.c > which > simply ifdef's out push/popOutputFile if some manifest constant, such > as > CANT_USE_FILE_STAR or DONT_USE_FILE_STAR is defined in the makefile (so > that files are compiled with -DDONT_USE_FILE_STAR=1 or some such). I will continue to play around. Thanks! Part of my confusion is lack of understanding as to why pushOutputFile() side-effects stdout rather than using a global 'output' variable universally. *stdout = *output Just initialize 'output' global on startup an side effect that. Thanks again much for all, -KenD file-def.txt (1K) Download Attachment
-KenD
|
Hi Ken, On Wed, Dec 4, 2019 at 7:25 AM <[hidden email]> wrote: > I would try two things. One is to find out where FILE is defined by It does this to ensure that any and all references to stdout in the system now refer to the new file as established by pushOutputFile, or the old one as restored by popOutputFile. You could try changing it to be an array of FILE *'s and see if that works for you. Then we could have a define that mandates that usage.
_,,,^..^,,,_ best, Eliot |
Hey, I can play Solitaire in Cuis! ;^) OK. The details and the breakage. =================== [1] Basics working: =================== I commented out (via #ifndef MUSL) the refs to FILE in Cross/vm/sqVirtualMachine.c and added empty {push,pop}OutputFile() funs to unix/vm/sqUnixMain.c. For musl: I added -DGNU_SOURCE to CFLAGS in build.linux64ARMv8/squeak.stack.spur/build/mvm I changed the call of getwd() to getcwd() in securityPlugin/sqUnixSecurity.c ============ [2] Breakage ============ The squeak script reports /lib/ld-musl-aarch64.so.1: cannot load /usr/local/bin/lib/squeak/5*..*/squeak [but the lib/squeak/5*/squeak executable works fine] Also, there is a problem with floats. SmallInteger 0.0 does not print well. Scaled is '000.0' and ulp leads to nextTowardZero -> "Error: Not for zero values" Musl is a bit different from glibc in numeric rounding and does not signal float errors. === So. Some work to do here, but basic image is running! Thanks again to all! -KenD
-KenD
|
Free forum by Nabble | Edit this page |