GTK issue

Linux specific questions.
Post Reply
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

GTK issue

Post by sancho3 »

I am trying to access the clipboard of Ubuntu. I have tried Coder Jeffs open pipe dcop code but I don't have that here in Ubuntu.
So I want to try some GTK code but it can't find the library files.
I tried sudo apt-get install libgtk-3-dev. That was already up to date.
I installled GTK 2.0. Then I tried to isntall libgtk-2-dev and that was already a newer version.
What do I need to do to get the code here to work?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: GTK issue

Post by D.J.Peters »

With fltk for FreeBASIC it's totally simple you can use: Fl_Copy and Fl_Paste.
Same code for Windows and Linux and you don't need to install any dev packages on your box.

Joshy
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: GTK issue

Post by sancho3 »

I'll try it. Thanks.
As a heads up, your Ubuntu command is wrong, you missed a 'K':
sudo cp libflt-c*.so /usr/lib
I have run into libray issue
Cannot find -lGL
Google is not helping.

As it stands, I can't code anything past #include once "FLTK-c.bi" because it crashes poseiden. So I tried copy pasting a couple of demos from the download into Geany and got the library problem.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: GTK issue

Post by D.J.Peters »

if you don't need OpenGL or your current system isn't OpenGL compatible

you can replace (on top of any fltk-c code)

Code: Select all

#include once "fltk-c.bi"
with:

Code: Select all

' #include once "fltk-c.bi"
#include once "fltk-main.bi"
#include once "fltk-tools.bi"
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: GTK issue

Post by lizard »

If fbc says lib <xyz> is missing under ubuntu you can try

Code: Select all

apt-cache search xyz
or similar keywords to show a list of packages that might be related.
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: GTK issue

Post by sancho3 »

@DJ:
It still can't find this library.
ld: warning: libXft.so.2, needed by //usr/lib/libfltk-c-1.3.3-32.so, not found (try using -rpath or -rpath-link)
I have that file at /usr/lib/x86_64-linux-gnu. Why can't it see it?
I know I botched something here.

@Lizard:
Thanks for that tip.

It is so very frustrating being at the beginners end of Linux/Ubuntu as an OS. I wish I had made the switch 10 years ago.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: GTK issue

Post by lizard »

sancho3 wrote: What do I need to do to get the code here to work?
Here it compiles and works OK. And i have no other gtk stuff installed like this:

viewtopic.php?f=5&t=26148
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: GTK issue

Post by lizard »

Do you have Mesa installed?

Code: Select all

sudo apt-get install libgl1-mesa-dev
Something with GL? (Although this seems strange...)

Do the examples from fbc for gtk compile?


Another thing you could try would be

Code: Select all

sudo apt-get update
If some libs from gtk are missing they maybe are added.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: GTK issue

Post by caseih »

Sancho3, it looks like the problem is you're using the 32-bit version of FB, but your distro is 64-bit. So you'll need to install the 32-bit versions of the libraries and dependencies.

If I'm not mistaken, the incantation would be something like this:

Code: Select all

sudo apt-get install libgtk-3-dev:i386
FLTK would need the 32-bit version of the X11 support libraries such as libXft.
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: GTK issue

Post by sancho3 »

The install 'libgtk-3-dev:i386' failed due to some other dependency needed.
The following packages have unmet dependencies:
libgtk-3-dev:i386 : Depends: libatk-bridge2.0-dev:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
'Broken packages' sounds ominous.
caseih wrote:it looks like the problem is you're using the 32-bit version of FB, but your distro is 64-bit.
What do you recommend going forward? Should I just start using FreeBASIC 64 bit?
I am going try that route and see how it goes.

EDIT:
I got a GTK sample working with FB64 bit. That is what the problem was as far as GTK goes. This will open some doors for me.
Thanks very much.
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: GTK issue

Post by sancho3 »

Crap. Switching to FB64 runs GTK samples no problem.
But it fails with screenres.
I get 'ld: cannot find -lXpm'. Now what?
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: GTK issue

Post by caseih »

sudo apt-get install libxpm-dev

As was said before you can search for these things using apt-cache. Or even better, install synaptic (might be installed already) and search for the library package using the nice GUI.

To answer your other question, probably moving to 64-bit is your best bet. Linux is moving slowly to 64-bit clean more and more (only really wine requires 32-bit these days). But if you do a google search you might be able to find out how to install 32-bit libraries and their dependencies on Ubuntu or Debian. On my fedora box, it's pretty easy for the most part to install 32-bit versions of many libraries.
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: GTK issue

Post by sancho3 »

I actually found it using the search and fixed it before I saw your post. But I did install another one first libxpm4. I assume that is not an issue.
The problem with the search is that there is a couple of dozen results and none of them exactly match. With limited descriptions and no real idea of what is missing, I am left to guess which library to install. Thus my first guess at libxpm4.

Thanks everyone for walking me through this.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: GTK issue

Post by caseih »

xpm4 is probably a different version of Xpm, so named so it won't clash with the version you actually needed. Eventually you'll get a feel for which libraries you need and how to find them. I sometimes do a lot of google seaching for the library itself. For example, "debian libXpm.so". Often helps me identify the package I need. Most of my experience is with RPM-based distros, though, but the process is similar.
Post Reply