Share how to compile difficult programs

Programming, for all ages and all languages.
Post Reply
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Share how to compile difficult programs

Post by ~ »

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: Select all

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

Last edited by ~ on Wed Sep 20, 2017 2:29 pm, edited 1 time in total.
YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Share how to compile difficult programs

Post by Solar »

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?
Every good solution is obvious once you've found it.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Share how to compile difficult programs

Post by AJ »

+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
dseller
Member
Member
Posts: 84
Joined: Thu Jul 03, 2014 5:18 am
Location: The Netherlands
Contact:

Re: Share how to compile difficult programs

Post by dseller »

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.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Share how to compile difficult programs

Post by sortie »

ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: Share how to compile difficult programs

Post by ggodw000 »

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.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Share how to compile difficult programs

Post by iansjack »

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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Share how to compile difficult programs

Post by Solar »

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...
Every good solution is obvious once you've found it.
ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: Share how to compile difficult programs

Post by ggodw000 »

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.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: Share how to compile difficult programs

Post by ~ »

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: Select all

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: Select all

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

YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: Share how to compile difficult programs

Post by Thomas »

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
Post Reply