Build Environment

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

udo
Retro freak
Retro freak
Posts: 14
Joined: Fri Jun 02, 2017 10:47 am

Build Environment

Postby udo » Sat Oct 14, 2017 10:46 am

Hi,

I tried to rebuild the Main_MiSTer repository and saw that the Makefle states that gcc 5.4.1 should be used for building. Where does this Version come from? I installed the latest Stuff from Altera/Intel Website (17.0) and ended with gcc Version 4.8.3. But after adding -std=gnu99 to CFLAGS I could compile it without problems.
In the repository there is a build.sh script that make deployment of a new Mister file very easy - Just run the script (needs to be modified for correct IP-Address).
Maybe it is just me (used to unix/linux etc) - but I had to google what "plink" is. So to run build.sh make sure You have Putty installed when running under Windows ...
With this "tricks" I could compile my own Mister - made already a small extension for me to display the current IP-Address of the Mister in the About Menu.

The second part of building own Mister stuff - the Fpga - is not so easy. Its a pity that the HDMI-Scaler is not open source (or at least buildable without the paid Licence of Quartus). This makes the hurdle in building own modifcations or new cores very high at least when You do not want to use the "old" VGA output. Yes I know that a demoversion of the scaler can be built, but this version needs to be loaded with JTAG and has some time limits. A dream would be a free available HDMI-Scaler ...

User avatar
Newsdee
Atari God
Atari God
Posts: 1034
Joined: Fri Sep 19, 2014 8:40 am

Re: Build Environment

Postby Newsdee » Sat Oct 14, 2017 12:25 pm

It's always possible to use a VGA to HDMI adapter... not ideal but in the grand scheme of things, not having HDMI shouldn't be a bottleneck if you'd like to port or write a core ;)

TorsteinP
Atariator
Atariator
Posts: 21
Joined: Tue Sep 05, 2017 5:34 pm
Location: Norway

Re: Build Environment

Postby TorsteinP » Sat Oct 14, 2017 12:32 pm

Newsdee wrote:It's always possible to use a VGA to HDMI adapter... not ideal but in the grand scheme of things, not having HDMI shouldn't be a bottleneck if you'd like to port or write a core ;)

Problem is, most cores video output to VGA isn't compatible with most VGA monitors so an adapter probably will not work.

udo
Retro freak
Retro freak
Posts: 14
Joined: Fri Jun 02, 2017 10:47 am

Re: Build Environment

Postby udo » Sat Oct 14, 2017 2:57 pm

Newsdee wrote:It's always possible to use a VGA to HDMI adapter... not ideal but in the grand scheme of things, not having HDMI shouldn't be a bottleneck if you'd like to port or write a core ;)


Maybe it should not be a bottleneck, but then I can stick to any FPGA-Board without HDMI too. I am quiet sure that as long as Sorgelig is the only person that can compile the cores completely nobody else will put much effort in developing/porting cores.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Sat Oct 14, 2017 3:11 pm

Main_MiSTer is compiled by, let's say, random gcc version. I don't use Altera/Intel environment.
So, any suitable environment is fine. You can use cygwin, mingw and of course linux. I'm using my own set of build tools including git, mingw and gcc. I'm using Visual Studio 2015 as IDE (hence you can see VS project files) which calls build script when i compile the MiSTer. So, basically i'm developing in Visual Studio. It's the best IDE from my point of view. It even provides correct code completion and navigation around the whole code and libraries.

About HDMI scaler code:
Open source is handy here. If you port/develop the core which you cannot compile with scaler but your code is open source, then simply let me know about it. I will help with compiling with scaler at regular basis when you release a new version.

udo
Retro freak
Retro freak
Posts: 14
Joined: Fri Jun 02, 2017 10:47 am

Re: Build Environment

Postby udo » Sat Oct 14, 2017 3:46 pm

Sorgelig wrote:Main_MiSTer is compiled by, let's say, random gcc version. I don't use Altera/Intel environment.
So, any suitable environment is fine. You can use cygwin, mingw and of course linux. I'm using my own set of build tools including git, mingw and gcc. I'm using Visual Studio 2015 as IDE (hence you can see VS project files) which calls build script when i compile the MiSTer. So, basically i'm developing in Visual Studio. It's the best IDE from my point of view. It even provides correct code completion and navigation around the whole code and libraries.


That is ok for me, but I can tell You that the current Main_MiSTer can not be compiled with the "official" Altera/Intel GCC.
Try to add -std=gnu99 to Your CFLAGS and check if it still compiles. If this Flag does not disturb Your compiler version just add it, and it should work with the official gcc too.
This is my CFLAGS line:
CFLAGS = $(DFLAGS) -c -std=gnu99 -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Sat Oct 14, 2017 4:04 pm

udo wrote:That is ok for me, but I can tell You that the current Main_MiSTer can not be compiled with the "official" Altera/Intel GCC.
Try to add -std=gnu99 to Your CFLAGS and check if it still compiles. If this Flag does not disturb Your compiler version just add it, and it should work with the official gcc too.
This is my CFLAGS line:
CFLAGS = $(DFLAGS) -c -std=gnu99 -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"

May be because intel uses older gcc v4.xx where C99 is not default.
gcc v5.x accepts this option. I will add it in some of near commits.

If you have some useful from your point of view features to add, then it's better to open a pull request on github or open issue there to talk about the feature.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Sun Oct 15, 2017 7:21 pm

C99 option has been added into recent commit on repository.
Note: MiSTer is dynamically linked against libraries, so correct work is not guaranteed if you don't use gcc 5.xx.

udo
Retro freak
Retro freak
Posts: 14
Joined: Fri Jun 02, 2017 10:47 am

Re: Build Environment

Postby udo » Tue Oct 17, 2017 4:44 pm

Sorgelig wrote:C99 option has been added into recent commit on repository.
Note: MiSTer is dynamically linked against libraries, so correct work is not guaranteed if you don't use gcc 5.xx.


Thanks the Makefile works now out of box.

I hope that the shared libs that are used are bundeled with the Linux-Distrbution, and that Your Linux is derived from the Altera Linux Version and therefore should be compatible with the Altera Libs no matter which gcc is used.
Otherwise I would like to have an Link where to get the "random gcc version" You are using from.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Tue Oct 17, 2017 5:16 pm

udo wrote:Thanks the Makefile works now out of box.

I hope that the shared libs that are used are bundeled with the Linux-Distrbution, and that Your Linux is derived from the Altera Linux Version and therefore should be compatible with the Altera Libs no matter which gcc is used.
Otherwise I would like to have an Link where to get the "random gcc version" You are using from.



I don't know why you are talking about Altera/Intel. Linux part has no relation to FPGA at all. It's pure ARM Linux code.
Linaro is famous gcc releaser. They have have almost all gcc versions on their site.
I don't have link to exact gcc version i'm using because i've downloaded it long time ago.

Basically all linux parts are built under linux. If you are more advanced developer then you can create build environment under Windows or other OS.
Setup the whole build environment is pretty large guide and i simply don't have one. Internet should help you.

udo
Retro freak
Retro freak
Posts: 14
Joined: Fri Jun 02, 2017 10:47 am

Re: Build Environment

Postby udo » Tue Oct 17, 2017 5:42 pm

Sorgelig wrote:
I don't know why you are talking about Altera/Intel. Linux part has no relation to FPGA at all. It's pure ARM Linux code.
Linaro is famous gcc releaser. They have have almost all gcc versions on their site.
I don't have link to exact gcc version i'm using because i've downloaded it long time ago.

Basically all linux parts are built under linux. If you are more advanced developer then you can create build environment under Windows or other OS.
Setup the whole build environment is pretty large guide and i simply don't have one. Internet should help you.


Ok I am lucky that I have a working environment to rebuild Your stuff. But I think there might be more people willing to work on this project if there were clear instruction how to get correct setup to start development. As there were no pointers in Your page, I thought that the Altera page would be a good starting point.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Tue Oct 17, 2017 9:17 pm


User avatar
Newsdee
Atari God
Atari God
Posts: 1034
Joined: Fri Sep 19, 2014 8:40 am

Re: Build Environment

Postby Newsdee » Tue Nov 07, 2017 5:40 pm

I see this in the Visual Studio file configuration

Code: Select all

git.lnk ./build.sh


What do I need to install to get this git.lnk?
I have git command line but that's something else. I guess this is more like a cygwin environment?

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Wed Nov 08, 2017 6:02 am

git.lnk is link to msys shell where i have many tools installed. i just call it git because git is the main tool i use.

User avatar
Newsdee
Atari God
Atari God
Posts: 1034
Joined: Fri Sep 19, 2014 8:40 am

Re: Build Environment

Postby Newsdee » Wed Nov 08, 2017 6:39 am

Sorgelig wrote:git.lnk is link to msys shell where i have many tools installed. i just call it git because git is the main tool i use.

aha... yes I guessed it was some kind of env. I will try to install that.

Compiling from Windows and VS would be a great improvement to the VirtualBox I was running for the MiST.

(that was already an improvement from when I was running a Raspberry Pi to compile remotely, much to Till's amusement :lol:)

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Wed Nov 08, 2017 7:24 pm

i'm trying to keep build requirement as low as possible. So, shell (msys or cygwin) with make and gcc should be sufficient to build the MiSTer. Ftp client is used in build script, but it's not required. It's only for convenience (press F7 in VS to make and upload to DE10-nano)

User avatar
Newsdee
Atari God
Atari God
Posts: 1034
Joined: Fri Sep 19, 2014 8:40 am

Re: Build Environment

Postby Newsdee » Sat Nov 11, 2017 12:51 pm

Progress notes: I've successfully installed MSYS + make + gcc like this:

Installed this:
http://www.msys2.org/

Then after doing the base setup:

Code: Select all

pacman -S make
pacman -S gcc


Now checking the Linaro stuff.
Edit:
I've installed this version:

Code: Select all

gcc-linaro-5.4.1-2017.01-rc2-i686-mingw32_arm-linux-gnueabihf.tar.xz


I added the /bin/ folder to PATH and edited msys2_shell.cmd from the MSYS2 to uncomment a line to allow PATH to be copied to MSYS environment:

Code: Select all

set MSYS2_PATH_TYPE=inherit

User avatar
Newsdee
Atari God
Atari God
Posts: 1034
Joined: Fri Sep 19, 2014 8:40 am

Re: Build Environment

Postby Newsdee » Sat Nov 11, 2017 2:23 pm

Alright! It looks like it works. For some reason, uploading the firmware with FileZilla didn't work and causes the DE10 to boot but not display any image. I fixed it by copying the file into the SD card from Windows (i.e. by removing the SD from the DE10).
Last edited by Newsdee on Sat Nov 11, 2017 11:31 pm, edited 1 time in total.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Sat Nov 11, 2017 3:34 pm

use command line ftp client. you can find command line format in build.sh script.
i also use plink (putty) to kill and start the MiSTer process remotely through ssh.

bernouilli
Atari maniac
Atari maniac
Posts: 87
Joined: Fri Jan 06, 2017 5:02 pm
Location: Paris/France

n

Postby bernouilli » Wed Nov 15, 2017 2:52 pm

I managed to have a working environment to build the MiSTer executable. I had to do some changes to succeed in compiling.

I started with a freshly installed Ubuntu 16.04 LTS.

Then I retreived the source of MiSTer and entered the directory

Code: Select all

git clone https://github.com/MiSTer-devel/Main_MiSTer
followed by

Code: Select all

cd Main_MiSTer


I installed gcc for arm :

Code: Select all

sudo apt install gcc-arm-linux-gnueabihf


I ran make and got this error :

Code: Select all

..
arm-linux-gnueabihf-gcc: error trying to exec 'cc1plus': execvp: No such file or directory
..


So I installed g++ for arm :

Code: Select all

sudo apt install g++-arm-linux-gnueabihf


I ran again make clean and make and this time I got this error :

Code: Select all

..
DiskImage.cpp(3, 22): fatal error: sys\stat.h: No such file or directory
..


I modified DiskImage.cpp to change the line #include <sys\stat.h> to <#include <sys/stat.h>

I tryied again and got these error messages

Code: Select all

..
DiskImage.o: In function `TDiskImage::~TDiskImage()':
DiskImage.cpp:(.text+0xce): undefined reference to `operator delete(void*)'
DiskImage.cpp:(.text+0xde): undefined reference to `operator delete(void*)'
..


This can be solved by using g++ instead of gcc to link but then you get linking errors : undefined reference to `shm_unlink' and to `shm_open'

What I did is modify the makefile to use gold as the linker :
I added -fuse-ld=gold to the line LFLAGS :

Code: Select all

LFLAGS  = -lc -lstdc++ -lrt -fuse-ld=gold

And now a make clean followed by make does the job.

You then just have to copy MiSTer to the DE-10 by ftp or scp but first you have to be connected to the board by ssh to kill the process MiSTer and relaunch it after copy.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Wed Nov 15, 2017 3:09 pm

Wow, so many problems :)
What gcc/g++ versions you're using?
I can change "\" to "/" in source - it should be no problem for windows version. Other problems looks weird to me.

bernouilli
Atari maniac
Atari maniac
Posts: 87
Joined: Fri Jan 06, 2017 5:02 pm
Location: Paris/France

Re: Build Environment

Postby bernouilli » Wed Nov 15, 2017 3:35 pm

Sorgelig wrote:Wow, so many problems :)
What gcc/g++ versions you're using?
I can change "\" to "/" in source - it should be no problem for windows version. Other problems looks weird to me.

Not so many, in fact it's was quite easy to solve the troubles, sometimes it takes longer to achive compiling some programs.

The version of gcc and g++ installed by apt install is 5.4.0 from Linaro :

Code: Select all

user@ubuntu:~/wa/Main_MiSTer$ arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
..

user@ubuntu:~/wa/Main_MiSTer$ arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
..


and BTW, thanks a lot for what've you've done so far, it's incredible. Mister works great and the number of cores ported to it is getting huge.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Wed Nov 15, 2017 3:54 pm

attach your final makefile. I will try it on my environment.

bernouilli
Atari maniac
Atari maniac
Posts: 87
Joined: Fri Jan 06, 2017 5:02 pm
Location: Paris/France

Re: Build Environment

Postby bernouilli » Wed Nov 15, 2017 4:13 pm

Sorgelig wrote:attach your final makefile. I will try it on my environment.

Here it is:
Makefile.zip


I had to zip it otherwise I couldn't attach it because it has no extension

The only difference is on line LFLAGS =
You do not have the required permissions to view the files attached to this post.

Sorgelig
Atari God
Atari God
Posts: 1190
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Build Environment

Postby Sorgelig » Wed Nov 15, 2017 4:25 pm

hmm.. It requires a special linker - gold. I don't want to require additional tool without a good reason.
So, i won't include such changes into repository. You can use it if it helps. I believe you can use my Makefile. It's just something wrong with your build environment.


Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 1 guest