×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

cross-compile of kstars

  • Posts: 95
  • Thank you received: 14
Anyone....

Just wondering whether it is possible (without too much work) to cross-compile kstars from ubuntu Linux to Windows32/64 from a git clone?

I spent some time looking at the possibility of native compiling onto Windows, but it started to get rather complicated very quickly!

Thanks..

Phil
5 years 3 months ago #33245

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
Yes, this is what craft is designed for, to take care of all the dependencies, qt, and kde stuff that is required so that you can build versions of kde applications on windows and macs.

community.kde.org/Guidelines_and_HOWTOs/..._from_source/Windows

Did you try craft? It works pretty well. You can edit code in qt creator once craft gets all set up if you want to as well
5 years 3 months ago #33257

Please Log in or Create an account to join the conversation.

  • Posts: 95
  • Thank you received: 14
Hi Rob,

I found that link during my many trawlings.... but have not embarked on any installations yet. I have already installed MS VisualStudio, CMake GUI, GIT for Windows & the QT stuff in order to compile Stellarium builds I tinker with....

When I get some more time (& inclination) I'll have a go... I'm not a Windows C/C++ user & merely suffer that pain from time to time LOL - I was just seeing if there was an easier option in cross-compiling whilst I had all the Dev environment installed in Ubuntu....

Phil
Last edit: 5 years 3 months ago by Phil Shepherd.
5 years 3 months ago #33258

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
That sounds good Phil,

As far as I know, the easiest and nicest solution is craft. It is fairly easy to use and does all the heavy lifting, so to speak.

Thanks,

Rob
5 years 3 months ago #33262

Please Log in or Create an account to join the conversation.

  • Posts: 95
  • Thank you received: 14
Well!

I took the plunge & went through the steps to install craft... went fine...

Then, it took me a while to actually figure out how the hell to use it!! :oops:

Initially, it threw an error pretty much straight away... something about not finding libs/lcms.... this took me a while but turned out that the craft-blueprints-kde repository on Github was being modified & 3 of the files I originally downloaded had been modified!
Finally figured out how to update my copy ("craft -i craft-blueprints-kde") and away the build went....

On my 6-core AMD 3.2GHz, the whole thing took just over 14 minutes! But then I realised it had to build the whole of the KF5 environment + a whole load of other things (Perl for 1!)

Final hurdle was figuring out how to run the damn thing!

First, just trying to run the binaries some way down in the craft build directories, resulted is various DLLs not found

Then I found "craft --run kstars" - tada!

Finally, another cmd to note - "craft --package kstars" (needed me to initially add nsis with "craft nsis") & it generated a Windows install EXE in the tmp directory (took a few mins to find that)

I installed in it's own directory and it does seem to work!

For my next trick, I intend to make the Eiffel Tower disappear! LOL

Phil
The following user(s) said Thank You: Rob Lancaster
Last edit: 5 years 3 months ago by Phil Shepherd.
5 years 3 months ago #33302

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
Well done sir! The craft documentation leaves a bit to be desired . . . seriously. But it is a really good tool. It allows you to build quite a bit of stuff that would be difficult to do without it, with just a few lines of code. That's why I have been working with it to build the OS X version of KStars for the last 2 years and have been working over the last year to make some recipes so that the Mac version of KStars could be built with craft without having to use our build script. The most useful thing about it is that it builds everything in a totally separate ecosystem from your main machine's packages. So installing a package in craft should not mess up other things on your computer and even better, you can have more than one independent craft system with different packages installed, or different versions of programs/packages. It is pretty nice in that regard and is really good for building packages for distribution. But as you observed, since they are not actually installed to the main system directories, you can't just run the stuff you just built without craft, to do that, you would need to take the final steps to deploy the program (package it up so that it can be installed on a computer). But a craft installation is also really great for trying out the latest code or editing code in the program to make improvements and test new ideas.
5 years 3 months ago #33304

Please Log in or Create an account to join the conversation.

  • Posts: 95
  • Thank you received: 14
OK, Rob... last question (hopefully)

How do I get craft to download (or clone) the source from KDE/kstars on Github rather than the stable branch from download.kde.org?

The whole point of what I am trying to do is be able to build from the latest sources if needed....

Thanks

Phil
5 years 3 months ago #33319

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
Hi Phil,

This change will not be too hard to make. All the packages in craft are built using simple python scripts. In my/your craft installation, the relevant script should be in the craft root directory in etc/craft-blueprints-kde/kde/applications/kstars/kstars.py.

You should change the current code that downloads the stable version:

def setTargets(self):
self.versionInfo.setDefaultValues()
self.description = 'a desktop planetarium'
for ver in :
self.targets[ver] = 'download.kde.org/stable/kstars/kstars-%s.tar.xz' % ver
self.targetInstSrc[ver] = 'kstars-%s' % ver
self.defaultTarget = '3.0.0'
self.displayName = "KStars Desktop Planetarium"

To download the current version on git:

def setTargets(self):
self.description = 'a desktop planetarium'
self.svnTargets = "github.com/KDE/kstars.git"
self.targetInstSrc = ""
self.displayName = "KStars Desktop Planetarium"
self.defaultTarget = 'Latest'

Thanks,

Rob
5 years 3 months ago #33322

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
P.S. Be careful of spaces and tabs, python is ridiculously picky about those. Python uses indenting to determine what code is inside or outside of a code block. For example, if you try to indent the same way as the code above using tabs when the code above it used spaces, it will complain that the file has syntax errors. So try to match the syntax that already exists in the python file when you change it.
5 years 3 months ago #33323

Please Log in or Create an account to join the conversation.

  • Posts: 95
  • Thank you received: 14
Thanks for sticking with this, Rob..

My blueprint file is actually at :

etc\blueprints\locations\craft-blueprints-kde\kde\applications\kstars

The top part of the file is :
class subinfo(info.infoclass):
    def setTargets(self):
        self.versionInfo.setDefaultValues()
        self.description = 'a desktop planetarium'
        for ver in ['3.0.0']:
            self.targets[ver] = 'http://download.kde.org/stable/kstars/kstars-%s.tar.xz' % ver
            self.targetInstSrc[ver] = 'kstars-%s' % ver
        self.defaultTarget = '3.0.0'
        self.displayName = "KStars Desktop Planetarium"

When I replace after "def setTargets(self):" with (only using spaces as the indent)

class subinfo(info.infoclass):
    def setTargets(self):
        self.description = 'a desktop planetarium'
	self.svnTargets = " github.com/KDE/kstars.git "
	self.targetInstSrc = ""
	self.displayName = "KStars Desktop Planetarium"
	self.defaultTarget = 'Latest'


I get :

'in <string>' requires string as left operand, not NoneType
Traceback (most recent call last):
  File "C:\CraftRoot\craft\bin\craft.py", line 250, in <module>
    success = main()
  File "C:\CraftRoot\craft\bin\craft.py", line 238, in main
    if not CraftCommands.run(package, action, tempArgs):
  File "C:\CraftRoot\craft\bin\CraftCommands.py", line 246, in run
    depList = depPackage.getDependencies(depType=depType)
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 105, in getDependencies
    self.depenendencyType = depType
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 45, in depenendencyType
    self.__resolveDependencies()
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 58, in __resolveDependencies
    self.dependencies.extend(self.__readDependenciesForChildren([(x, None) for x in self.children.values()]))
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 74, in __readDependenciesForChildren
    p.depenendencyType = self.depenendencyType
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 45, in depenendencyType
    self.__resolveDependencies()
  File "C:\CraftRoot\craft\bin\Blueprints\CraftDependencyPackage.py", line 50, in __resolveDependencies
    subinfo = self.subinfo
  File "C:\CraftRoot\craft\bin\Blueprints\CraftPackageObject.py", line 319, in subinfo
    return self.instance.subinfo
  File "C:\CraftRoot\craft\bin\Blueprints\CraftPackageObject.py", line 307, in instance
    pack = mod.Package()
  File "C:\CraftRoot\etc\blueprints\locations\craft-blueprints-kde\kde\applications\kstars\kstars.py", line 53, in __init__
    CMakePackageBase.__init__(self)
  File "C:\CraftRoot\craft\bin\Package\CMakePackageBase.py", line 15, in __init__
    PackageBase.__init__(self)
  File "C:\CraftRoot\craft\bin\Package\PackageBase.py", line 32, in __init__
    CraftBase.__init__(self)
  File "C:\CraftRoot\craft\bin\CraftBase.py", line 38, in inner
    return fun(*args, **kwargs)
  File "C:\CraftRoot\craft\bin\CraftBase.py", line 58, in __init__
    self.subinfo = mod.subinfo(self)
  File "C:\CraftRoot\craft\bin\info.py", line 68, in __init__
    self.setBuildTarget()
  File "C:\CraftRoot\craft\bin\info.py", line 116, in setBuildTarget
    self.buildTarget = self.defaultTarget
  File "C:\CraftRoot\craft\bin\info.py", line 91, in defaultTarget
    if target in self.targets or target in self.svnTargets:
TypeError: 'in <string>' requires string as left operand, not NoneType
Last edit: 5 years 3 months ago by Phil Shepherd.
5 years 3 months ago #33332

Please Log in or Create an account to join the conversation.

  • Posts: 2877
  • Thank you received: 812
I think that is likely the error I was telling you about. Probably the easiest way to fix this is instead of just copying and pasting the code that I gave you, start with the file the way it was and just edit each line appropriately. Then you won't have any syntax errors. Watch those spaces and tabs, they are not the same.
5 years 3 months ago #33333

Please Log in or Create an account to join the conversation.

  • Posts: 95
  • Thank you received: 14
In the original, there are no tabs... I use the same spaces and indent exactly the same
5 years 3 months ago #33334

Please Log in or Create an account to join the conversation.

Time to create page: 1.004 seconds