beginners guide

HI guys,

trying to get my first Linux app working and not having much luck,

First the specs
Running Oracle VM Virtual box
Ubuntu 12.10 - which runs fine - well I think it is anyway.

Xojo 2014r1 running on windows 7 and compiling for Linux.

WIndows box 64 bit
uname -a returns Linux ubuntu-virtualbox 3.5.0-17-generic #28-ubuntu SMP Tue Oct 9 19:32:03 UTC 2012 i686 i686 i686 GNU/linux

On compiling there is a folder called Linux which I move to the desktop of the Ubuntu machine.

Properties / permissions
set everything to read/write and “create and delete”
Apply permissions…
Close

Double left click on the app icon and get a warning

Run TIme error


Common/loaders/loader.cpp: 171
Failure condition:0
Failed to Load Kernel 32
kernel32.so cannot open shared object file : No such File or directory drone(weird icon)

Check in the Libs folder and there is no kernel32.so file

Any ideas?

Thanks
Damon

[quote=88405:@damon pillinger]HI guys,

trying to get my first Linux app working and not having much luck,

First the specs
Running Oracle VM Virtual box
Ubuntu 12.10 - which runs fine - well I think it is anyway.

Xojo 2014r1 running on windows 7 and compiling for Linux.

WIndows box 64 bit
uname -a returns Linux ubuntu-virtualbox 3.5.0-17-generic #28-ubuntu SMP Tue Oct 9 19:32:03 UTC 2012 i686 i686 i686 GNU/linux

On compiling there is a folder called Linux which I move to the desktop of the Ubuntu machine.

Properties / permissions
set everything to read/write and “create and delete”
Apply permissions…
Close

Double left click on the app icon and get a warning

Run TIme error


Common/loaders/loader.cpp: 171
Failure condition:0
Failed to Load Kernel 32
kernel32.so cannot open shared object file : No such File or directory drone(weird icon)

Check in the Libs folder and there is no kernel32.so file

Any ideas?

Thanks
Damon[/quote]
Have you followed these requirements: http://documentation.xojo.com/index.php/System_requirements for Linux

Hi john,

So what you are telling me is that Linux is crap.

Appreciate the honesty

Damon

Damon, I was just checking whether your Ubuntu installation was a 32bit installation? You may need to install the 32bit libraries to get the application running if the Linux installation is 64bit.

Since you’re running Linux in a VM, the easiest thing for you to do is to install a 32-bit version of Linux. Getting the necessary 32-bit libraries installed on 64-bit versions of Linux can be rather challenging on some versions of Linux and is not something most beginners will want to deal with.

Linux Mint 32-bit with the Cinnamon desktop has been working pretty well for a lot of people.

No, just that you need to perform some additional steps to get things working properly for 32bit apps.

There is a 32bit version of the Oracle Linux VM available Ubuntu platform available. I’d recommend that you start there rather than trying to get 32bit support working on your 64bit platform.

Have you checked for a declare into the Windows Kernel32 dll
That’d be my first thing to look for

Hi Guys,

thanks for the reply’s, I don’t want you to think I was being flippant. I thought John was politely pointing out that Linux isn’t like Windows where everything just runs, you can only get certain applications, like XOJO, to work on certain machines.

That being said, I spent a large chunk of last night looking at Linux and from what I can see it must be near impossible to create an app which will run on all variants. The recommended list is luckily the majority of installation types so I will continue on. I am currently downloading Mint 32.

Thanks Norman, my app does use the Win32 dll (quite a bit) however I have put targetWIN32 around everything that uses it.

#if TargetWin32
Declare Sub GetComputerNameA Lib “Kernel32” ( name as Ptr, ByRef size as Integer )

dim mb as new MemoryBlock( 256 )
dim size as Integer = mb.Size()
GetComputerNameA( mb, size )

return mb.CString( 0 )

#endif

Shouldn’t this mean that the compiled Linux version doesn’t include these in the compiled app?

I am also downloading XOJO for Linux ( may as well make use of the professional license) to see if the app will run or offer ways of finding offensive code just in case I missed a declare.

The app I am creating is a monitor for services such as pop, http, smtp etc…that runs on the same machine as the services/applications it is monitoring.
I assume most servers run Linux although all of the ones I use are Windows based. I would like to make the app compatible with both and later down the track even for mac servers as well.

Many thanks, going into a new world.

Damon

For linux your computers (netbios) name is found in the textfile ‘hostname’ located in folder ‘/etc/’ so open a textstream and read this file to get the computer name.

  Dim fiHostname As FolderItem = GetFolderItem("/etc/hostname")
  If fiHostname <> Nil Then
    If fiHostname.Exists Then
      Dim tiHostname As TextInputStream
      Dim stHostname As String = ""
      Try
        tiHostname = TextInputStream.Open(fiHostname)
        stHostname = tiHostname.ReadLine
      Catch e As IOException
        tiHostname.Close
        MsgBox("Error accessing file.")
      End Try
      MsgBox("Your hostname: " + stHostname)
    End If
  End If

[quote=88439:@damon pillinger]Hi john,

So what you are telling me is that Linux is crap.

Appreciate the honesty

Damon[/quote]

Nope, all those distributions of Linux aren’t crap.
Not all of those versions got enough love in the past (tho some got too much love too ^^).
Still all those versions of Windows rule 80%+ of our Desktops.
So there’s a long road to go … :wink:

But - as you see above - some things are easier in Linux - different approach, but definately much, much easier.

Hi Thomas ,
Appreciate your passion.

Great interpreting of code as well, thanks will use that one.

I have managed to get one of my program’s running on mint Linux . About 70 % happy with it.

Could you recommend a DUMMY questions Linux website, I think most of my questions are Linux rather than rb related now.

I have a dozen or so dumb questions which I am googling the answers as i type. There are many commands which I will use.

However if you feel generous ,

Dim s as shell
S.execute “reboot”

Tried shutdown -r etc… And as you are aware the problem is changing to the root user. Which is fine if you can type in the password . Which you cant easily from shell, but as i type this maybe a interactive shell…

Trying in the morning.

Thanks Damon

Ps , thanks Norman - there were 2 lines i coded out with
If win…
Rather than
#win

All fixed now, no errors on start up

[quote=88600:@damon pillinger]Could you recommend a DUMMY questions Linux website, I think most of my questions are Linux rather than rb related now.

[/quote]

No question is dumb. Answers can be snotty or sometimes too complex, but you will probably be able to ask here :
https://www.linuxquestions.org/

Don’t be afraid to ask. Or to google your questions. You will be surprised as how many answers you find.

[quote=88600:@damon pillinger]

I have a dozen or so dumb questions which I am googling the answers as i type. There are many commands which I will use.

However if you feel generous ,

Dim s as shell
S.execute “reboot”

Tried shutdown -r etc… And as you are aware the problem is changing to the root user. Which is fine if you can type in the password . Which you cant easily from shell, but as i type this maybe a interactive shell…
… [/quote]

The commands ‘sudo’ and ‘gksudo’ are used to ask for superuser-password. Tho i recommend not to use it, better let the user do this manually if needed. Prompt him to restart (or shutdown) might be the better style. Linux isn’t Windows.

And … bout your Linux-questions … I’d prefer you to ask here in Xojo-forums (target - linux) to show the Xojo staff how many users write programs in/for Linux nowadays. The more the merrier, we might get 64Bit support faster … who knows :stuck_out_tongue_winking_eye:

[quote=88574:@Thomas Rottensteiner]For linux your computers (netbios) name is found in the textfile ‘hostname’ located in folder ‘/etc/’ so open a textstream and read this file to get the computer name.

Dim fiHostname As FolderItem = GetFolderItem("/etc/hostname") If fiHostname <> Nil Then If fiHostname.Exists Then Dim tiHostname As TextInputStream Dim stHostname As String = "" Try tiHostname = TextInputStream.Open(fiHostname) stHostname = tiHostname.ReadLine Catch e As IOException tiHostname.Close MsgBox("Error accessing file.") End Try MsgBox("Your hostname: " + stHostname) End If End If [/quote]

You could also just use the command: hostname

Works both in windows and linux . Just invoke it from a Xojo shell class

Dim s As Shell s = New Shell #If TargetWin32 Then s.Execute("hostname") #Elseif TargetLinux Then s.Execute("hostname") #Endif If s.ErrorCode = 0 Then msgbox("Hostname: "+ s.Result) Else MsgBox("Error code: " + Str(s.ErrorCode)) End If

Morning all, just did the school sports drop off, looks like a nice day here in australia.
Hi Thomas,
Yes found those commands and today will try to send a password inline using a shell. My software will be running on un manned servers and is designed to reboot the machine if it has no internet at all. It is an option for the owner so they can turn it off, actually it is off by default so they have to turn it on.

I will post the dummy questions in new topics so sorry if there is a flood , well small wave of new topics.

Hi john,
Many thanks i will try that today.

Hi Michael,
Googling like a mad man, it is apparent that nearly everything is available via command in Linux. You just need to know the command and then work out what grep is and how to use it ( not a question for this thread ). In some ways easier than using declares in windows.

Thanks Damon