oskardolch / SteamCAD

2D CAD especially designed to draw steam locomotives
GNU General Public License v3.0
194 stars 14 forks source link

Please document how to compile on Ubuntu #1

Closed probonopd closed 5 years ago

probonopd commented 5 years ago

Please document with step-by-step instructions how to compile on Ubuntu 14.04. The instructions in the PDF are vague and don't provide the exact steps with command line instructions.

Thanks.

oskardolch commented 5 years ago

Hi probonopd,

thanks you for your interest in the SteamCAD. You are right that the compiling instructions are not very clear. So from the terminal, navigate to the folder you would like to have the copy of the software source code. Then issue the following sequence of commands: $ sudo apt-get install gcc libcairo2-dev gtk+-dev $ git clone https://github.com/oskardolch/SteamCAD.git $ cd SteamCAD $ mkdir Build $ make main

Finally, SteamCAD executable should appear in the Build folder. You can run it issuing the command: $ Build/SteamCAD

But prior running SteamCAD, create a hidden folder under your home directory named .SteamCAD, and copy the *.ini files from the Papers folder to the /home//.SteamCAD folder. And then it should run.

Finally, regardless my statement about the future development in the pdf guide, I am going to post a bundle of updates and bug fixes soon. And I will also update the documentation. So even if you manage to compile and run the software, please check it here in one or two weeks to get the newest release.

Oskar

probonopd commented 5 years ago

On Ubuntu 14.04, getting cannot find -ldxflib:

g++ -o Build/SteamCAD Build/SteamCAD.o Build/DMenu.o Build/DApplication.o Build/DDataTypes.o Build/DMath.o Build/DTopo.o Build/DDrawTypes.o Build/DPrimitive.o Build/DLine.o Build/DCircle.o Build/DEllipse.o Build/DArcElps.o Build/DHyper.o Build/DParabola.o Build/DSpline.o Build/DEvolv.o Build/DExpCairo.o Build/DParser.o Build/DFileMenu.o Build/DModeMenu.o Build/DEditMenu.o Build/DViewToolsMenu.o Build/DFileSetupDlg.o Build/DLineStyleDlg.o Build/DDimEditDlg.o Build/DStatDlg.o Build/DSnapDlg.o Build/DScaleDlg.o Build/DExpDXF.o -L./Build -Wl,-rpath,/home/pavel/Programs/SteamCAD/Build `pkg-config --cflags --libs gtk+-2.0 gthread-2.0 gio-2.0` -ldxflib
/usr/bin/ld: cannot find -ldxflib

Also installing libdxflib-dev results in

/Programs/SteamCAD/Build `pkg-config --cflags --libs gtk+-2.0 gthread-2.0 gio-2.0` -ldxflib
Build/DExpDXF.o: In function `ExportDXFFile(char*, CDataList*, CDUnitList*)':
DExpDXF.cpp:(.text+0x21e4): undefined reference to `DL_Dxf::writeLinetype(DL_WriterA&, DL_LinetypeData const&)'
DExpDXF.cpp:(.text+0x22d9): undefined reference to `DL_Dxf::writeLinetype(DL_WriterA&, DL_LinetypeData const&)'
DExpDXF.cpp:(.text+0x250d): undefined reference to `DL_Dxf::writeLinetype(DL_WriterA&, DL_LinetypeData const&)'
DExpDXF.cpp:(.text+0x2a83): undefined reference to `DL_Dxf::writeStyle(DL_WriterA&, DL_StyleData const&)'
DExpDXF.cpp:(.text+0x30a7): undefined reference to `DL_Dxf::writeObjects(DL_WriterA&, std::string const&)'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1

Do we need to compile it from source?

oskardolch commented 5 years ago

OK, you must run $ make libdxflib.a prior running make main. I forgot that.

probonopd commented 5 years ago

Thanks; with this I can get the binary compiled indeed. But make install does not work as usual:

$ make install DESTDIR=$(readlink -f appdir) ; find appdir/
make: *** No rule to make target `install'.  Stop.
find: `appdir/': No such file or directory
probonopd commented 5 years ago

If you are wondering what I am doing, I am trying to build an AppImage for StreamCAD.

oskardolch commented 5 years ago

Indeed, make install does not work. Once you build the executable, you can run it from the Build folder or copy it to any location. But you should copy the two ini files into your home/.SteamCAD folder, as mentioned in the pdf documentation. When I created the software, I didn't believe that many people would like to use it. So I tried to make the things as simple (for me) as possible. But I'll do my best to help you with your effort.

probonopd commented 5 years ago

What about desktop files (for menus) and icons?

oskardolch commented 5 years ago

Hi, I am sorry for the delay, but I was working on the update, which I pushed just before a while (hope there will be less problems than benefits). Regarding your last question, I am not quite sure what you mean. If you mean the application icon, there is none. I simply didn't have enough invention to design anything meaningful. If you want to contribute with something, you are welcome :-)

oskardolch commented 5 years ago

Hi, I have added the GNU build system to SteamCAD, so now it is possible to install it using ./configure, make, sudo make install. So perhaps it is the time to change the travis yml script to reflect this change (although the manual build still work). The new GNU build has two benefits - it uses gettext and it stores the ini files in the system, and the application then copies them to the user profile, if they don't exist. So after "make install" no further configuration is required.

probonopd commented 5 years ago

Thank you very much - this is much easier. Let's see how https://travis-ci.com/probonopd/SteamCAD/builds/98355581 goes.

oskardolch commented 5 years ago

I just pulled your version with "git clone --depth=50 --branch=master https://github.com/probonopd/SteamCAD.git probonopd/SteamCAD", and it is definitively an old version. It looks like you didn't pull the last commit from oskardolch. And another note - you don't need to bother with copying the .desktop and icon files, this should be done automatically with "sudo make install" now.

probonopd commented 5 years ago

Sorry, my bad, I had pulled from the wrong repository. But now I am getting a merge conflict...

https://github.com/probonopd/SteamCAD/pull/3

oskardolch commented 5 years ago

It should be nothing difficult. In order to support Autoconf, I have renamed the makefile for Linux manual build to makefile.gcc, so I had to make appropriate change in .travis.yml. Just go ahead and correct the conflicted file manually. I would still suggest you, if you have a chance, try the "./configure, make, sudo make install" on your machine prior testing the automated build. To see if everything is OK. Honestly, somebody calls the GNU build system "AutoHell" and I quite understand why :-)

probonopd commented 5 years ago

Running into many build errors: https://travis-ci.com/probonopd/SteamCAD/builds/98376573

oskardolch commented 5 years ago

I have no idea what might be wrong. There are lots of warnings but none of them seems to be critical. I might test it on Ubuntu one day, but I am not sure when it will happen. Actually there is only one error, and it is the link error, meaning that it cannot find the gtk+-2.0 and cairo libraries. But it was certainly able to find gtk+-2.0 and cairo include files while compiling. Weird. And also it is strange that it can find the linked libraries when linking from the makefile.gcc.

oskardolch commented 5 years ago

So I have slightly updated the build system, but I don't think it will fix the issue.

oskardolch commented 5 years ago

The automated build should be fixed on Ubuntu now. Please test it.

probonopd commented 5 years ago

Thanks, it is working for me now. :+1: