LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-14-2023, 08:24 AM   #1
jay.cross.bee
LQ Newbie
 
Registered: Dec 2023
Location: USA
Distribution: Kubuntu
Posts: 4

Rep: Reputation: 0
What to do when /lib or /usr/lib has a folder with cmake files? Installing pre-reqs for a program.


I'm trying to build gmsh from source so I can use all the extra functionality, like PETSc, openMPI, openBLAS, etc...

[XY Problem Awareness]
I guess I'm doing the XY problem. I've come back to the top here and labeled [X], [Y] after writing most of this. Hopefully this partially explains why it's all over the place.

[X]
I want to install a solid FEM/FEA program and I chose gmsh with onelab, getDP, PETSc. Those aren't standard and so I'm building from source. Being new to linux, I don't know whether or not a library (fltk here, but there are others) is installed as PIC, I'm confused by the fact that APT shows it installed but the fltk directories in /lib/fltk and /usr/lib/fltk are filled with cmake files:

Code:
/usr/lib/fltk$ ll
total 48
drwxr-xr-x   3 root root 4096 Dec 14 08:44 ./
drwxr-xr-x 129 root root 4096 Dec  8 23:52 ../
-rw-rw-r--   1 root root 1328 Dec 14 08:44 CMakeCache.txt
drwxrwxr-x   2 root root 4096 Dec 14 08:44 CMakeFiles/
-rw-r--r--   1 root root 1820 Sep  7  2022 FLTKConfig.cmake
-rw-r--r--   1 root root 1706 Sep  7  2022 FLTK-Functions.cmake
-rw-r--r--   1 root root 7211 Sep  7  2022 FLTK-Targets.cmake
-rw-r--r--   1 root root 8751 Sep  7  2022 FLTK-Targets-none.cmake
lrwxrwxrwx   1 root root   13 Sep  7  2022 FLTKUse.cmake -> UseFLTK.cmake
-rw-r--r--   1 root root  496 Sep  7  2022 UseFLTK.cmake

[Y]
I've run in to an issue I haven't been able to figure out. FLTK is needed for the gmsh GUI. I ran

Code:
sudo apt list --installed | grep fltk
and the result makes me think it is already installed:
Code:
fltk1.3-doc/mantic,mantic,now 1.3.8-5 all [installed,automatic]
libfltk-cairo1.3/mantic,now 1.3.8-5 amd64 [installed,automatic]
libfltk-forms1.3/mantic,now 1.3.8-5 amd64 [installed,automatic]
libfltk-gl1.3/mantic,now 1.3.8-5 amd64 [installed,automatic]
libfltk-images1.3/mantic,now 1.3.8-5 amd64 [installed,automatic]
libfltk1.3-dev/mantic,now 1.3.8-5 amd64 [installed,automatic]
libfltk1.3/mantic,now 1.3.8-5 amd64 [installed,automatic]
However, the installation says that I will have trouble with static libraries, which are default for fltk.

Here's from the installation [https://gitlab.onelab.info/gmsh/gmsh...pilation#fltk] page, it says I need to build it as PIC:

Code:
git clone https://github.com/fltk/fltk.git
cd fltk
mkdir build
cd build
# Notes:
# * by default FLTK is compiled as a static library, which has been reported to cause issues with OpenGL libraries on some systems; to build a shared library, add -DOPTION_BUILD_SHARED_LIBS=ON
# * if you don't have root access, add -DCMAKE_INSTALL_PREFIX=path-to-install
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make
sudo make install
# Notes:
# * if you don't have root access, remove "sudo"
I tried configuring fltk using cmake gui but I don't know where the source code is (I'll bet I find a src directory if I look) but I'm not sure that's even the right way to do this. It doesn't seem like it.

So before I break anything, I am here asking for help/education.

What should I do when I think I need to recompile something that is likely used by the OS and change an option so I can use it in a different program?
 
Old 12-15-2023, 01:01 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,864

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
the source is what you get with that git clone command (I think). The cmake files belong to the build system, not to the final "product". cmake gui will configure the build system, you need to [re]build the software after [re]configuration.
You can build whatever you want, that won't harm your system (don't do it as root), just don't replace the official version.
 
1 members found this post helpful.
Old 12-15-2023, 09:01 AM   #3
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,604

Rep: Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547
Quote:
Originally Posted by jay.cross.bee View Post
I'm confused by the fact that APT shows it installed but the fltk directories in /lib/fltk and /usr/lib/fltk are filled with cmake files:
Those are development files, put there by the libfltk1.3-dev package. You can confirm this with "dpkg-query --search /usr/lib/fltk/*"

To confirm the files in the main library, you can, use "dpkg-query --listfiles libfltk1.3" - there should be a libfltk.so file listed.

You can also use "dpkg-query --list '*fltk*'" to show the status of packages dpkg knows about.

(If you're unfamiliar with dpkg vs apt, dpkg is the low-level package management software; whilst apt is [intended as] the user-friendly front-end to it.)

Quote:
I ran

Code:
sudo apt list --installed | grep fltk
You don't need sudo or grep here - apt only needs super-user access when making changes, not for listing information, and the list command accepts a pattern - so "apt list --installed '*fltk*'" is enough.

 
1 members found this post helpful.
Old 12-15-2023, 09:08 AM   #4
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
One should never download (clone) an app into a system directory which your description seems to indicate may have been done.

I always do a git clone into a directory under my users home, do the compile as my user, then the install only of the compiled files (done with the make or cmake).

This process prevents damage to the system directories as well as ensuring the cruft of the text files used for compile is not placed into those directories.
 
1 members found this post helpful.
Old 12-16-2023, 01:12 PM   #5
jay.cross.bee
LQ Newbie
 
Registered: Dec 2023
Location: USA
Distribution: Kubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
More Information

I didn't clone anything yet.

I made a different post that asked the question a different way. In that post I asked if installing the differently compiled libs in my directory and changing the path when installing my target. How to do that is beyond my level of knowledge. I assume, as I wrote, that changing the path would suffice.

How to do this? Or what is the right thing to do?
 
Old 12-16-2023, 01:51 PM   #6
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,604

Rep: Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547
Quote:
Originally Posted by jay.cross.bee View Post
How to do this? Or what is the right thing to do?
Setup a safe environment to experiment in: i.e. a VM, or a second system that it doesn't matter if you break and have to delete and reinstall from scratch.

Not being root and not using sudo adds a layer of protection, but it does NOT stop a system being harmed; a wrong command can still wipe out a home directory, which for many people is a bigger pain. (What's the current state of your backups...?)


Quote:
I want to install a solid FEM/FEA program and I chose gmsh with onelab, getDP, PETSc.
None of these terms mean anything to me, but if they are available in your repo's repositories, then make sure you get the source code from your repo's source repositories, and check the provided documentation.

Even though you want to compile with different options, starting with a known working setup - one that includes any Debian/Ubuntu-specific fixes already applied - is the sensible thing to do.

If the only repository is a separate one, be aware that any "Linux" instructions may not match the right way for your specific distro - whilst instructions for Debian will work on Ubuntu, the reverse is not always true, and instructions for Arch or RHEL or others can be completely different.

If there isn't relevant documentation, asking on the forums or mailing lists for the project may get better answers - even if they don't know how a different distro does something, they can inform what a command/script intends to do, which then allows finding the equivalent.

 
Old 12-16-2023, 02:05 PM   #7
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
I tried configuring fltk using cmake gui but I don't know where the source code is (I'll bet I find a src directory if I look) but I'm not sure that's even the right way to do this. It doesn't seem like it. [/QUOTE]

Did you try it with the static libraries? The warning says you *may* have trouble, on *some* systems. You may not to rebuild.

If you do need to rebuild, there is no need to mess with the cmake gui. Go to the build directory for fltk, and do

Code:
cmake -DOPTION_BUILD_SHARED_LIBS=ON <other_options> <source_dir>
I would get the source package from Debian and look at the necessary files, they may have used more options.

While you're at it, why not find out how to build the package after you make the modification? This way the files will be tracked by APT. I use Fedora and openSuSE, and when I find a package that doesn't have an option I need, I grab the source package, make the modifications, and build the package.

Take a look here: https://wiki.debian.org/BuildingTutorial

Of course that may be deeper than some people want to go, but I like my system applications and libraries tracked. This avoids future collisions and problems.

That warning also hints at an installation for your user. So, if you don't want to mess with the system installation, something like

Code:
cmake -DOPTION_BUILD_SHARED_LIBS=ON <other_options> -DCMAKE_INSTALL_PREFIX=<path-to-install> <source_dir>
Where <path-to-install> is, say, /home/user/lib/fltk. That gets kind of messy though and can lead to all kinds of conflicts with the system installed libs. Then you must make sure to build gmsh pointing to your personal lib dir. You ready for headaches tracking down issues?

Last edited by goumba; 12-16-2023 at 04:03 PM. Reason: Added debian wiki reference.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using library from /usr/local/lib instead of /usr/lib when compiling gnunet program usr345 Slackware 5 06-27-2019 04:00 AM
Slackware-current: /usr/share/cmake and /usr/share/cmake-3.3 directories igor29768 Slackware 1 11-07-2015 12:37 AM
Preparing to test a broad array of cloud clients, what pre-reqs would be needed? slacker_ Linux - Virtualization and Cloud 5 11-11-2014 06:44 PM
Compromised? Files "/usr/lib.hwm", "/usr/lib.pwd", "/usr/lib.pwi" Klaus Pforte Linux - Security 4 09-28-2004 11:33 PM
/usr/lib and /usr/local/lib doxxan Slackware 5 06-15-2004 12:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration