x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

CeGCC on modern linux

1 2
Karpour Page Icon Posted 2022-01-29 12:52 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
So I just stumbled upon this: http://max.kellermann.name/projects/cegcc/

There are precompiled binaries for old Debian, but what's more interesting is that this comes with a nice build script that should in theory allow you to build this updated version of CeGCC on any modern Linux distro

I gave it a try, here are the steps

 
cd ~ 
sudo apt install texinfo flex bison libmpc-dev
git clone git://github.com/MaxKellermann/cegcc-build
cd cegcc-build
git submodule update --init
sudo mkdir /opt/cegcc
sudo chown karpour:karpour /opt/cegcc
mkdir /tmp/cegcc-build
cd cegcc-build
./build.sh --prefix=/opt/cegcc


The packages texinfo, flex, bison, libmpc-dev are required, but if you previously built gcc they're possibly already installed.

I'll update with results once it's done building. It sure takes a while!

[EDIT]

It worked! I now have arm-mingw32ce on current Ubuntu inside WSL

Edited by Karpour 2022-01-29 1:54 AM
 Top of the page
C:Amie Page Icon Posted 2022-01-29 6:29 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,983
Location:
United Kingdom
Status:
That's cool. Nice find. Are you using this to build the cab-info tool for Linux?
 Top of the page
Karpour Page Icon Posted 2022-01-29 10:37 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
No, this is mingw32 targeting Windows CE!

Just to try, I want to try compiling my cabinfo tool for Windows CE, though I've been told that glibc is not 100% implemented with this build, so I'll see whether it works out
 Top of the page
C:Amie Page Icon Posted 2022-01-29 11:49 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,983
Location:
United Kingdom
Status:
Ah, would be interesting to see if it can. We can put it in the SCL if it does!
 Top of the page
stingraze Page Icon Posted 2022-01-29 12:46 PM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Quote
Karpour - 2022-01-29 9:52 AM

So I just stumbled upon this: http://max.kellermann.name/projects/cegcc/

There are precompiled binaries for old Debian, but what's more interesting is that this comes with a nice build script that should in theory allow you to build this updated version of CeGCC on any modern Linux distro

I gave it a try, here are the steps

 
cd ~ 
sudo apt install texinfo flex bison libmpc-dev
git clone git://github.com/MaxKellermann/cegcc-build
cd cegcc-build
git submodule update --init
sudo mkdir /opt/cegcc
sudo chown karpour:karpour /opt/cegcc
mkdir /tmp/cegcc-build
cd cegcc-build
./build.sh --prefix=/opt/cegcc


The packages texinfo, flex, bison, libmpc-dev are required, but if you previously built gcc they're possibly already installed.

I'll update with results once it's done building. It sure takes a while!

[EDIT]

It worked! I now have arm-mingw32ce on current Ubuntu inside WSL

Thanks for the info, will try it out soon on my environment.

Update: Compiling now under Ubuntu 20.04 on VirtualBox.

Edited by stingraze 2022-01-29 1:12 PM




(compiling-cegcc.jpg)



Attachments
----------------
Attachments compiling-cegcc.jpg (140KB - 0 downloads)
 Top of the page
stingraze Page Icon Posted 2022-01-29 2:32 PM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Yay. Got CeGCC working on Ubuntu 20.04 under Virtualbox.

It compiled the test source code from the tutorial I wrote several years ago which ran on Ubuntu 16.04.
I didn't try testing out the .exe, but should work fine.



(cegcc-ubuntu-20.04.jpg)



Attachments
----------------
Attachments cegcc-ubuntu-20.04.jpg (71KB - 3 downloads)
 Top of the page
Karpour Page Icon Posted 2022-01-29 3:17 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Awesome! I managed to compile wcepeinfo for windows CE and then use the linux build of wcepeinfo to analyze wcepeinfo.exe

It segfaulted, because I naively assumed that PEs always include a resource directory, which my compiles one didn't, I need to add one with windres I assume. My mingw experience is very limited, but I'm positive I can compile Windows CE versions of my POSIX tools

Other caveats: putc doesn't work, but can be replaced by fputc, and perror and strerror aren't supported at all. Probably a lot more, but that's what I noticed and worked around
 Top of the page
stingraze Page Icon Posted 2022-01-29 3:19 PM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Thanks!
Will be playing with this during the weekends and my spare time.
 Top of the page
Karpour Page Icon Posted 2022-01-30 1:29 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Soo I tried running wcepeinfo on my Jornada 720 using cmd.exe

The good news: it doesn't crash

The bad news: There's no output.

I think this is because Windows CE does not really have CLI applications, so simply writing something to stdout doesn't do anything.
I guess if I wanted to make a Windows CE version of this app I'd have to go the GUI route or figure out how to write things out in cmd.exe
 Top of the page
stingraze Page Icon Posted 2022-01-30 2:41 AM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Yep. Maybe remove the gui option?
I've read here that an application called Pocket Console makes you be able to read output... not sure if it works on Handheld PC as it's for Pocket PC 2000 / 2002. Maybe using Redgear will provide the solution? Not sure.

http://moyashi.air-nifty.com/hitori/2007/03/windows_mobilec_2418.html (Japanese blog)

https://symbolictools.de/ (Pocket Console site)

Edited by stingraze 2022-01-30 2:54 AM
 Top of the page
stingraze Page Icon Posted 2022-01-30 5:49 AM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Update:

Good news! I found an application called "DOS Window" (in Japanese)
It should work with English and other OS, but it provides a DOS Window / console for Handheld PC.

It's available for H/PC 2000 and Sigmarion 3 + other Pocket PC etc. devices.
http://www.fermes-soft.com/dmo_download.htm

The thing is, the "printf" function works, and it outputs to the DOS Window.

Actually though, I tried later and cmd.exe on Windows CE .NET 4.1 supports printf.
If you are using other things to output to stdout, maybe you can convert it to printf.

I think you only need to import stdio.h by
#include <stdio.h>

and write
printf regularly with return 0;


Sample:
 
#include <windows.h>
#include <stdio.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
printf("hello";
return 0;

}


-stingraze

Edited by stingraze 2022-01-30 6:36 AM




(dos-window.JPG)



(cmd-exe.JPG)



Attachments
----------------
Attachments dos-window.JPG (178KB - 0 downloads)
Attachments cmd-exe.JPG (153KB - 0 downloads)
 Top of the page
Karpour Page Icon Posted 2022-01-30 10:21 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Oh neat! Not sure why I don't get output on CE3.0

Could you try running this and see if you can get any output? If there are no arguments, it should just print the usage instructions.



Attachments
----------------
Attachments wcepeinfo.exe (327KB - 2 downloads)
 Top of the page
stingraze Page Icon Posted 2022-01-30 12:14 PM
#
Avatar image of stingraze
Subscribers
H/PC Vanguard

Posts:
3,679
Location:
Japan
Status:
Yep, it's working!

I tried opening like

 wcepcinfo.exe APPNAME.exe


but it says "Failed to open file". hmm.


Edited by stingraze 2022-01-30 12:20 PM




(cmd-wcepcinfo.jpg)



(dos-window-wcepcinfo.jpg)



Attachments
----------------
Attachments cmd-wcepcinfo.jpg (70KB - 0 downloads)
Attachments dos-window-wcepcinfo.jpg (141KB - 0 downloads)
 Top of the page
Karpour Page Icon Posted 2022-01-30 12:42 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Oh, that was unexpected! So it seems on CE3.0 cmd.exe the output doesn't work because printf isn't supported or something?

Maybe the reason it can't read the file because Windows CE possibly gives the arguments as UTF-16 string, not sure about that, would have to try around for that.

Either way, it's great that compiling this for CE using mingw32ce works without issue
 Top of the page
Alt Bass Page Icon Posted 2022-01-30 9:24 PM
#
Avatar image of Alt Bass
H/PC Sensei

Posts:
1,169
Location:
Russia
Status:
The problem with stdout can be that Windows is treating Console output and stdout differently, on NT kernel as well. Can't really describe the issue exactly, just try WriteConsole instead.
 Top of the page
1 2
Jump to forum:
Seconds to generate: 0.312 - Cached queries : 73 - Executed queries : 13