OSDev.org
https://forum.osdev.org/

Share how to compile difficult programs
https://forum.osdev.org/viewtopic.php?f=13&t=32417
Page 1 of 1

Author:  ~ [ Mon Sep 11, 2017 12:40 pm ]
Post subject:  Share how to compile difficult programs

Can you share detailed instructions, videos, code, about compiling known hard-to-compile programs?

No matter what the program is about, it will always be useful, and no matter for what platform, PC or handheld.



The latest most difficult program I learned to compile was ZSNES 1.51 for DOS using DJGPP:

Code:
make -f makefile.ms PLATFORM=dos

Use the very latest and full version of DJGPP, its bash port, and utilities.

ZSNES 1.51 source code:
https://sourceforge.net/projects/zsnes/files/zsnes/ZSNES%20v1.51/zsnes151src.tar.bz2/download

Information on compiling ZSNES 1.51 for DOS, Windows, Linux:
https://github.com/emillon/zsnes/blob/master/docs/install.txt

Compile 1.51 in DJGPP:
http://board.zsnes.com/phpBB3/viewtopic.php?f=6&t=137399&view=next

DJGPP 2.05 download and information:
http://devel.archefire.org/forum/viewtopic.php?hl=es&p=4306#p4306



http://www.zlib.net/zlib-1.2.11.tar.gz

https://sourceforge.net/projects/libpng/files/libpng14/1.4.21/lpng1421.zip/download



Add #include to stdio.h to all source files in the "tools/" directory that don't already include it, and also to parsegen.cpp in the root source directory.

Copy the libpng include files to the DJGPP include directory, no matter if you destroy it for other projects, you should modify a temporary install of DJGPP for this compilation. Do the same for zlib if any ZIP related errors appear during the compilation.


Edit the file makefile.ms and delete any -Ws GCC switch as DJGPP doesn't recognize it.
Also search for any -lpdcur occurrence and change it to -lpdc~1


Author:  Solar [ Wed Sep 13, 2017 3:29 am ]
Post subject:  Re: Share how to compile difficult programs

Oh how I despise "video instructions"... non-searchable, non-siftable, at the mercy of the presenter's speed and timing...

Besides, shouldn't instructions on how to compile known hard-to-compile programs be posted to the respective program's support forums instead of being collected in a OSDev.org thread?

Author:  AJ [ Wed Sep 13, 2017 4:39 am ]
Post subject:  Re: Share how to compile difficult programs

+1

Surely if something is hard to compile using the build system recommended by the developer, that should be a bug that they need to fix so that it isn't hard to compile? Having said that, the only tools I ever compile are OSDev tools on Bash on Ubuntu on Windows, so maybe this view is slightly naïve.

Cheers,
Adam

Author:  dseller [ Sun Sep 17, 2017 6:09 am ]
Post subject:  Re: Share how to compile difficult programs

Personally I think there is little use in "learning" how to compile a specific program. Instead, you should focus your effort on learning how to compile any piece of software.

The build process is merely a means to an end, not a goal itself.

Author:  sortie [ Sun Sep 17, 2017 6:45 am ]
Post subject:  Re: Share how to compile difficult programs

http://wiki.osdev.org/Cross-Porting_Software

Author:  ggodw000 [ Mon Sep 18, 2017 6:01 pm ]
Post subject:  Re: Share how to compile difficult programs

99% pct of compile attempt that I follow through the instruction fails. IMO, it is problem with industry, degenerate so-called developers who call themselves who cares nothing but their own build environment setup in their tiny cubicle. In the end, I usually chose not to pursue the effort if does not work on first try because it is never ending journey. Most of the time, instruction are inaccurate, incomplete and/or simply wrong.
In the past various build attempt failure I have seen:
Most of the linux utility, application source does not compile, not even close, dependency problem is difficulty to resolve. I dont remember any linux uitility that compiled right off the bat, the only exception I can remember is iperf. That is about it. The recent ones I remember that failed miserably : wireshark, AI framework i.e. tensorflow, caffe, bitcoin-cli. It is a compile-and-pray thing. (Remember plug-and-pray?).
UEFI source, even the people who were actively involved in maintaining could not setup the build environment fresh start.

Author:  iansjack [ Tue Sep 19, 2017 12:37 am ]
Post subject:  Re: Share how to compile difficult programs

I find that almost all Linux applications compile first time, as long as I read the README and ensure that any dependencies are installed before attempting to compile the main program. Perhaps I'm just lucky.

I certainly see no point in documenting individual programs here - documentation belongs with the program source, not with a website about OS development.

Author:  Solar [ Tue Sep 19, 2017 10:55 pm ]
Post subject:  Re: Share how to compile difficult programs

Just recall how many people, over the years, complained about the cross-compiler tutorial in our wiki "not working".

Hundreds?

And every single time, it turned out they were missing something along the lines, hadn't really followed the instructions or made some other newb mistake...

Author:  ggodw000 [ Wed Sep 20, 2017 1:35 am ]
Post subject:  Re: Share how to compile difficult programs

Solar wrote:
Just recall how many people, over the years, complained about the cross-compiler tutorial in our wiki "not working".

Hundreds?

And every single time, it turned out they were missing something along the lines, hadn't really followed the instructions or made some other newb mistake...

Yes there are hundreds but also am afraid there are shoddy instructions and documentations everywhere. As for myself, speaking from my experience, I read line by line digest every word written, still most open source does not compile whatever documentation comes along are mostly POC. Even the publisher say something like "it everything goes well", "hope this works", "try this". In a strictest sense it is hesitation, uncertainty and usually problematic.

Author:  ~ [ Wed Sep 20, 2017 2:32 pm ]
Post subject:  Re: Share how to compile difficult programs

Solar wrote:
Oh how I despise "video instructions"... non-searchable, non-siftable, at the mercy of the presenter's speed and timing...

Besides, shouldn't instructions on how to compile known hard-to-compile programs be posted to the respective program's support forums instead of being collected in a OSDev.org thread?


I always do my best to include the instructions in text form to my video tutorials, which exist just in the known ~99% likely case that the person compiling will not understand them readily:
Code:
make -f makefile.ms PLATFORM=dos

Use the very latest and full version of DJGPP, its bash port, and utilities.

ZSNES 1.51 source code:
https://sourceforge.net/projects/zsnes/files/zsnes/ZSNES%20v1.51/zsnes151src.tar.bz2/download

Information on compiling ZSNES 1.51 for DOS, Windows, Linux:
https://github.com/emillon/zsnes/blob/master/docs/install.txt

Compile 1.51 in DJGPP:
http://board.zsnes.com/phpBB3/viewtopic.php?f=6&t=137399&view=next

DJGPP 2.05 download and information:
http://devel.archefire.org/forum/viewtopic.php?hl=es&p=4306#p4306



http://www.zlib.net/zlib-1.2.11.tar.gz

https://sourceforge.net/projects/libpng/files/libpng14/1.4.21/lpng1421.zip/download



Add #include to stdio.h to all source files in the "tools/" directory that don't already include it, and also to parsegen.cpp in the root source directory.

Copy the libpng include files to the DJGPP include directory, no matter if you destroy it for other projects, you should modify a temporary install of DJGPP for this compilation. Do the same for zlib if any ZIP related errors appear during the compilation.


Edit the file makefile.ms and delete any -Ws GCC switch as DJGPP doesn't recognize it.
Also search for any -lpdcur occurrence and change it to -lpdc~1



------------------------------------------------
------------------------------------------------
------------------------------------------------
------------------------------------------------

How to Compile CWSDPMI 5 or 7

This is very important for learning how to use paging usefully in the real world with the NUR paging algorithm by [email protected]



Code:
Version 5:
http://ftp.gwdg.de/pub/msdos/gcc/djgpp/v2misc/csdpmi5s.zip

set path=%path%;\bc31\bin
cd \csdpmi5s\SRC\CWSDPMI
make
make -DRING=0

Version 7:
http://ftp.gwdg.de/pub/msdos/gcc/djgpp/v2misc/csdpmi7s.zip

set path=%path%;\bc31\bin
cd \csdpmi7s\SRC\CWSDPMI
make
make -DRING=0


Borland C++ 3.1 with TASM:
http://devel.archefire.org/downfile.php?path=/compilers/DOS/Borland/&filename=BC31INST.zip


Author:  Thomas [ Fri Nov 03, 2017 10:09 am ]
Post subject:  Re: Share how to compile difficult programs

AJ wrote:
+1

Surely if something is hard to compile using the build system recommended by the developer, that should be a bug that they need to fix so that it isn't hard to compile? Having said that, the only tools I ever compile are OSDev tools on Bash on Ubuntu on Windows, so maybe this view is slightly naïve.

Cheers,
Adam


Most often what happens is that, original plugins libraries become depreciated and project has been abandoned for a long time. All of a sudden, some customer has a request to make it work for the latest and greatest. Then even though, you can get it compiled with some efforts and hacks here and there, It will have loads of issues and a huge chunk will need to re written. But it is art to come up with solution with minimal changes so that your contributions to bugs is minimal. I am still learning the trade ...

--Thomas

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/