AROS Exec

Development => AROS Software Development => Topic started by: amigamia on June 02, 2020, 09:51:53 PM

Title: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 02, 2020, 09:51:53 PM
Hi Ya'll,

I am trying to compile some C code on an AROS hosted on Linux Mint. Without modifying the AROSBootstrap.conf running make starts and runs into an out of memory error:

Code: [Select]
cc1: Out of memory allocating 535296 bytes
and it's always at the same .c file.

I tried to change the conf file to allow 512MB or RAM but it crashes completely with stack trace etc.

Any clue?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 02, 2020, 10:08:19 PM
Are you using ABIv0 (32bit) or ABIv1 (32 or 64bit?)
Since you are anyhow using Linux, why not use cross compilers and compile directly from linux?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 02, 2020, 10:40:03 PM
Are you using ABIv0 (32bit) or ABIv1 (32 or 64bit?)
Since you are anyhow using Linux, why not use cross compilers and compile directly from linux?

Hi deadwood,

I am using ABIv0(32) and I have been having all sorts of config problems from the linux side. I have installed the AROS SDK but not sure how to run a make and target it as AROS.
AROS hosted with all contrib files seems to work fine but runs into this error on the same .c file in this project.

Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 02, 2020, 10:47:12 PM
Let me try to help you :)

I put together a simple script that will most of the things for you, please see this instruction:

https://github.com/deadw00d/AROS/blob/alt-abiv0/INSTALL.md

You should get a cross-compiler and linux-hosted 32bit as a result. With this cross compiler you can compile your problem. I will help you as well there.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 02, 2020, 10:54:23 PM
Hey that is great deadwood. I'll toy around this evening and let you know...
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 03, 2020, 02:55:51 PM
Hi deadwood,

I was able to compile AROS and the tool chains as described in the steps. I am able to start AROS hosted but how do i go by using the cross compiler from the linux side?

Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 03, 2020, 06:02:46 PM
Good , now your cross compiler is located in

<yourdirectory>toolchain-alt-abiv0-i386/i386-aros-gcc

Use it in your makefile.

You might also need to add -I<yourdirectory>/alt-abiv0-linux-i386/bin/linux-i386/AROS/Development/include to compiler parameters for it to see headers.

This should get you compiling.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 05, 2020, 11:32:08 PM
OK I finally had a chance to play with this again. I modified the makefile to use the correct compiler but like you said, I needed to probably place the location for the headers in the makefile but I am a bit lost.

Code: [Select]
/bin/sh: 1: hg: not found
make: *** No rule to make target '/Development/include/SDL/SDL_types.h', needed by 'obj/keyboard.o'.  Stop.

I did place the SDL folder from the contrib into
Code: [Select]
/home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-i386/AROS/Development/include/ but I have a feeling it's not the right location?

I'll send you the makefile so maybe you can guide me there.
Would it help if I added
Code: [Select]
/home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-i386/AROS/Development/include/ to the $PATH ?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 06, 2020, 07:25:45 AM
Ok, we are making progress. :) There are two things you need to do now:

1) Compile contrib
2) Add AROS includes to compiler path

1)

Clone this repostitory (https://github.com/deadw00d/contrib) into directory named 'contrib' and then checkout branch alt-abiv0
Copy the contrib directory into /home/vinny/myrepo/AROS directory
Then:
Code: [Select]
cd /home/vinny/myrepo/alt-abiv0-linux-i386/
make contrib

2)

Change:

Code: [Select]
ALL_CFLAGS += -std=c99 -I./src -DTARGET_$(PLATFORM) $(EXTRA_CFLAGS) $(SDL_CFLAGS) $(CFLAGS)

Into

Code: [Select]
ALL_CFLAGS += -std=c99 -I./src -I/home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-i386/AROS/Development/include/ -DTARGET_$(PLATFORM) $(EXTRA_CFLAGS) $(SDL_CFLAGS) $(CFLAGS)
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 08, 2020, 05:01:28 AM
Thanks deadwood! I tried to compile contrib but got some errors along the way. I actually ended up installing Icaros Desktop 2.2.8 on my Dell Latitude D520 and copying the source code of the popular game Open Tyrian. At first it compiled and with the strip command it kept running with "Out of memory". Removed the strip option and it compiled again but this time the game actually started!. It crashed on Icaros after a few menu selections but it played OK on AROS hosted on my Linux computer. It still needs to be properly compiled and errors checked, although when compiled for Linux it plays just fine. Without further ado I give you Open Tyrian (C Conversion of Tyrian 2.1) for AROS i386 ABIv0.

Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 08, 2020, 07:11:36 AM
Well done :)
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 08, 2020, 03:17:15 PM
I have uploaded it in The AROS Archives but I guess it won't show up until an admin approves it?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: magorium on June 08, 2020, 07:10:48 PM
Hi amigamia,


Your file is there, thx.


You can press the uploads (http://archives.aros-exec.org/index.php?function=uploads) link (all the way up at the top, somewhere in the middle) and read that besides your upload, that there are a few others "waiting for approval".  ;)


It sometimes takes a little time for them files to get the approval stamp.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: salvo on June 08, 2020, 09:00:16 PM
ok works fine for me
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 09, 2020, 08:02:54 PM
Thanks deadwood! I tried to compile contrib but got some errors along the way. I actually ended up installing Icaros Desktop 2.2.8 on my Dell Latitude D520 and copying the source code of the popular game Open Tyrian. At first it compiled and with the strip command it kept running with "Out of memory". Removed the strip option and it compiled again but this time the game actually started!. It crashed on Icaros after a few menu selections but it played OK on AROS hosted on my Linux computer. It still needs to be properly compiled and errors checked, although when compiled for Linux it plays just fine. Without further ado I give you Open Tyrian (C Conversion of Tyrian 2.1) for AROS i386 ABIv0.

Hi deadwood, I am still trying to fix the make contrib error. This i what I get after cloning, check the branch, copying into the location and running make contrib:

Code: [Select]
[MMAKE] Building AROS.contrib
[MMAKE] Read vars...
[MMAKE] Scanning dirs...
/home/vinny/myrepo/AROS/contrib/MultiMedia/libs/flac/mmakefile.src:In instantiation of fetch_and_build_gnu_development, line 18
Syntax error in arguments: nlsflag=no xflag=no


[MMAKE] /home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-x86_64/tools/genmf.py /home/vinny/myrepo/AROS/config/make.tmpl --listfile /tmp/genmfsEiCRS  failed: 256
[MMAKE] Error: Error regenerating makefile: No such file or directory
Makefile:203: recipe for target 'contrib' failed
make: *** [contrib] Error 10
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 09, 2020, 11:39:51 PM
Do

Code: [Select]
cd AROS/contrib
git branch

and paste what you got please.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 04:48:15 AM
Code: [Select]
vinny@iMacX ~/myrepo/AROS/contrib $ git branch
* alt-abiv0
  core
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 10, 2020, 07:01:55 AM
Well, for some reason you have code mixed between alt-abiv0 branch and core :/

contrib/MultiMedia/libs/flac/ is not even present in alt-abiv0 branch.

I just did
Code: [Select]
$ git clone https://github.com/deadw00d/contrib contrib
$ cd contrib
$ git checkout alt-abiv0

And didn't get "contrib/MultiMedia/libs/flac/" directory. Can you try again?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 07:53:56 PM
I may have messed something up when I did these steps:

Code: [Select]
Clone this repostitory (https://github.com/deadw00d/contrib) into directory named 'contrib' and then checkout branch alt-abiv0
Copy the contrib directory into /home/vinny/myrepo/AROS directory

I cloned the repo while I was inside ~myrepo and then checked the branch while in there. I then copied the folder contrib in /home/vinny/myrepo/AROS

I am going to remove it from both and try again

Here is the terminal window log:

Code: [Select]
vinny@iMacX ~ $ git clone https://github.com/deadw00d/contrib contrib
Cloning into 'contrib'...
remote: Enumerating objects: 917, done.
remote: Counting objects: 100% (917/917), done.
remote: Compressing objects: 100% (633/633), done.
remote: Total 114665 (delta 357), reused 572 (delta 277), pack-reused 113748
Receiving objects: 100% (114665/114665), 162.82 MiB | 3.34 MiB/s, done.
Resolving deltas: 100% (65630/65630), done.
Checking connectivity... done.
Checking out files: 100% (17516/17516), done.
vinny@iMacX ~ $ cd contrib/
vinny@iMacX ~/contrib $ git checkout alt-abiv0
Branch alt-abiv0 set up to track remote branch alt-abiv0 from origin.
Switched to a new branch 'alt-abiv0'
vinny@iMacX ~/contrib $
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 08:09:50 PM
looks like that did the trick:
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 10, 2020, 09:13:57 PM
Good, let me know if you run into any other issues.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 10:03:46 PM
Stopped again but this time much further down:

Code: [Select]
Trying     /home/vinny/myrepo/portssources/icu4c-4_2_1-src.tgz...
Trying     /home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-x86_64/Ports/host/icu4c/icu4c-4_2_1-src-aros.diff...
Unpacking  `icu4c-4_2_1-src.tgz'...

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
fetch: Error while unpacking `icu4c-4_2_1-src.tgz'.
mmakefile:2528: recipe for target 'crosstools-icu--fetch' failed

I deleted the offending file but in downloading again it stops right in the middle:

Code: [Select]
Length: unspecified [text/html]
Saving to: ‘/home/vinny/myrepo/portssources/icu4c-4_2_1-src.tgz.tmp’

/home/vinny/myrepo/ports     [ <=>                               ]  44.46K  --.-KB/s    in 0.03s   

2020-06-10 16:05:58 (1.36 MB/s) - ‘/home/vinny/myrepo/portssources/icu4c-4_2_1-src.tgz.tmp’ saved [45528]

Trying     /home/vinny/myrepo/alt-abiv0-linux-i386/bin/linux-x86_64/Ports/host/icu4c/icu4c-4_2_1-src-aros.diff...
Unpacking  `icu4c-4_2_1-src.tgz'...
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 10, 2020, 10:11:38 PM
Seems like the downloaded icu4c-4_2_1-arc.tgz is somehow damaged. Does it work when you unpack it manually?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 10:26:40 PM
Downloaded the file manually and placed it in its destination folder and it's moving along now...
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 10, 2020, 11:05:28 PM
Spoke too soon. Ran for a while and it stopped here:

Code: [Select]
Linking    AROS/Extras/Emu/UAE/uae...
[MMAKE] Building AROS.contrib-setup-dirs
[MMAKE] Making contrib-setup-dirs in
mmakefile:3: /home/vinny/myrepo/AROS/config/aros-contrib.cfg: No such file or directory
make[1]: *** No rule to make target '/home/vinny/myrepo/AROS/config/aros-contrib.cfg'.  Stop.
[MMAKE] make --no-print-directory TOP=/home/vinny/myrepo/alt-abiv0-linux-i386 SRCDIR=/home/vinny/myrepo/AROS CURDIR= TARGET=contrib-setup-dirs --file=mmakefile contrib-setup-dirs failed: 512
[MMAKE] Error: Error while running make in : No such file or directory
Makefile:203: recipe for target 'contrib' failed
make: *** [contrib] Error 10
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 11, 2020, 09:02:36 AM
This again suggests you have somewhere files from "core" branch of contrib instead of "alt-abiv0"

Do this to find them:
Code: [Select]
cd AROS
grep -rnw '.' -e 'aros-contrib.cfg'
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 14, 2020, 04:03:51 AM
Hi amigamia,


Your file is there, thx.


You can press the uploads (http://archives.aros-exec.org/index.php?function=uploads) link (all the way up at the top, somewhere in the middle) and read that besides your upload, that there are a few others "waiting for approval".  ;)


It sometimes takes a little time for them files to get the approval stamp.

How do I replace the file that is in the uploads waiting for approval? The one I uploaded seemed to have a bug that caused to make it crash right before starting to play. I have since recompiled it and tested on my Dell Latitude D520 with latest Icaros installed.
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 14, 2020, 04:07:12 AM
Hi deadwood,

I ended up scrapping the whole myrepo as it was becoming too much of a pain in my rear and it was starting to take too much time to troubleshoot. After some struggle, I ended up installin the latest version of Icaros on a Dell Latitude D520 as Nikos had suggested in the past. Much to my surprise, it was much easier to run the makefile from the shell and with minor changes to it. OpenTyrian compiled with no errors and during the running test it worked flawlessly.

Posting this reply from OWB on Icaros on Dell Latitude D520  :D
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: magorium on June 14, 2020, 09:34:17 AM
How do I replace the file that is in the uploads waiting for approval?
as far as i am able to recollect: you can't  :'(


If the file is approved (in the public list) you can replace it using your credentials. As long as the file is in 'approval' state you either need to contact archives-admin, or upload the new version with another name (it was possible to request a name-change long time ago,  but seeing how not active things are...).


It has been long ago, but have you already tried to upload the new file using the old/previous name ? Perhaps there have been some improvements at the archives-software so that it is allowed/possible these days to replace a waiting upload. But then i guess you wouldn't be asking this question.


Sorry to be the bearer of not so enjoyable news, and hope you are doing fine in these crazy times.


cheers
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 15, 2020, 09:52:57 PM
@magorium

Hi Magorium, I tried to replace the file but looks like only works if t has been approved already. I guess the best option is to wait, unless the admin is on this forum and I can ask him/her directly?

I have been on the AROS arena again for the summer. I have some time to play and being at home most of the time, has given me more time to spend on AROS.

I am still battling AROSWORLD.ORG and issues with the database since the upgrade but the more I patch the more issues I find. I think I need to just wipe it out and let users register again or just plainly shut it down and spend time here.

Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: amigamia on June 15, 2020, 09:56:02 PM
Hi amigamia,


Your file is there, thx.


You can press the uploads (http://archives.aros-exec.org/index.php?function=uploads) link (all the way up at the top, somewhere in the middle) and read that besides your upload, that there are a few others "waiting for approval".  ;)


It sometimes takes a little time for them files to get the approval stamp.

How do I replace the file that is in the uploads waiting for approval? The one I uploaded seemed to have a bug that caused to make it crash right before starting to play. I have since recompiled it and tested on my Dell Latitude D520 with latest Icaros installed.

Hi deadw00d, I scrapped the myrepo directory and did it all from scratch, retracing my steps. I managed to get everything to compile, including the contrib files. However, when I compile for AROS which gcc do I call and from where?
I have been using Icaros native to compile and it seems to do a good job without crashing. Is it better to compile code from the Linux terminal for AROS or straight from AROS native Shell?
Title: Re: Running out of memory when compiling in AROS linux hosted
Post by: deadwood on June 15, 2020, 10:09:06 PM
Hi,

The toolchain is in myrepo/toolchain-alt-abiv0-i386/i386-aros-gcc and you also need to add includes (I wrote about it in some earlier posts).

About which one to use? For small applications, use whatever works best for you. For bigger ones, natives version might be too slow or ran out of RAM in my experience.