cmake and enabling systemd service - cmake

I am installing a systemd service in my cmake file:
install(FILES test.service DESTINATION /lib/systemd/system)
My question is how do I then enable the service automatically? i.e.
systemctl enable test
I could run a script to do it as part of the install but that doesn't seem right.

As Alex Reinking said CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA was what I needed. I also needed to run configure_file before setting CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA

Related

Unable to manually configure apache httpd 2.4.12 on ubuntu 13.10

I need to manually install apache httpd 2.4.12 on ubuntu 13.10. For some reasons I cannot use apt-get install.
Having gone through the instructions provided for httpd installation, I execute the following commands in order
Unzip the installation that was downloaded
Navigate to the folder where the installation is present till the bin folder
Within the bin folder execute ./configure with the needed parameters.
make (Error occurs here. Unable to proceed further)
make install
When I execute the make command, I get this error
**make: *** No targets specified and no makefile found. Stop.**
Anyone has any idea where I am going wrong.
You either are
in the wrong folder (no Makefile)
failed to properly ./configure (any errors?)
configure is responsible for generating the Makefiles. If you don't succeed at configuring (maybe you are missing some library needed for compilation?) then you won't get Makefiles and cannot call make.
Never ignore errors. They are errors, after all. They'll come back to bite you.

Could not find module `Test.QuickCheck' on Ubuntu

I'm importing QuickCheck at the top of my file:
import Test.QuickCheck
...
Compiling the file with ghc Lab1.hs gives me this error:
Lab1.hs:1:8:
Could not find module `Test.QuickCheck'
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
I tried an apt-cache search for quickcheck and got a dire list of packages. Tried installing libghc-test-framework-dev just because I thought the name seemed appropriate, but the error persists.
How do I install the QuickCheck module?
If you're interested in managing your Haskell packages outside of your package manager (which may be beneficial if you're interested in using the latest versions of things) then Cabal is the Haskell package manager which would allow you to do
apt-get install cabal-install
cabal update
cabal install QuickCheck
to make QuickCheck available globally.
What's more recommended of late however is to use the sandbox feature of Cabal. This is very similar to Python's virtualenv or Ruby's bundle if you're more familiar with those. To do this, you must create a "cabalized" project
cabal init # in an empty directory
and then put QuickCheck (and your other library dependencies) in the build-depends: slot of the generated <folder name>.cabal file.
After you've done this you use Cabal for all further package management and compilation commands.
cabal sandbox init # creates your local package sandbox
cabal install --only-dependencies # gets and installs all the build-dependencies
cabal repl # starts up GHCi in the local sandbox
cabal build # configures and builds the local project
cabal sandbox delete # cleans up the sandbox
In Ubuntu 14.04.1:
sudo apt-get install libghc-quickcheck2-dev
Before:
> :m +Test.QuickCheck
<no location info>:
Could not find module `Test.QuickCheck'
It is not a module in the current program, or in any known package.
After:
Prelude> :m +Test.QuickCheck
Prelude Test.QuickCheck>

CMake missing modules directory

I've installed CMake 2.8.11.2 package from CMake's website for Mac 64-bit. We recently upgraded a project from Qt 4 to Qt 5 and the CMake upgrade is mandatory for CMake to use Qt 5. However, when I type cmake . I get the following error:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/Applications/CMake 2.8-11.app/Contents/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
I can confirm, there is no modules directory in the bin folder. I really don't know how to resolve this error, or how to get the modules needed.
Do hash -r to clear the cache, then do cmake --version.
It should work.
I had the same problem after upgrading on Ubuntu.
Removing cmake and the cmake-data package before performing the update solved it for me.
sudo apt-get remove cmake cmake-data
Now perform the update via
sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo -E apt-get update
sudo apt-get install cmake
This worked for me :
cd cmake-3.4.3
./bootstrap --prefix=/usr
make
sudo make install
Additionally, you may encounter the same error when running CMake from Cygwin. This may be caused by a PATH variable listing /bin before /usr/bin: in this case CMake is launched as /bin/cmake instead of /usr/bin/cmake, and trying to load modules from //share/cmake-X.Y.Z (which is a UNC path on Windows) instead of /usr/share/cmake-X.Y.Z.
Explicitly export'ing a correct CMAKE_ROOT isn't helpful, and cmake keeps displaying the same misleading message.
The issue can be solved by setting PATH to /usr/bin:/bin:/everything/else in your .bash_profile.
I was able to fix this error on Linux (for other who may be searching for answer on Linux) while trying to upgrade cmake 2.8.11 to 2.8.12 by exporting the CMAKE_ROOT environment variable like so:
export CMAKE_ROOT=/path_to_install/cmake-2.8.12.2-Linux-i386/share/cmake-2.8
The share directory should be on the same level as your bin directory.
I got the same error message upgrading cmake-3.5.1 to cmake-3.7.1 on Ubuntu 16.04.01 LTS. I just updated the repositories with
sudo apt-get update
Then
cmake --version
brought up the correct and upgraded cmake version and the error messages was gone.
In my opinion/case this is a developer "problem". I suspect this occurs mostly to new developers so I go a bit deeper to put it in the right perspective:
To "not mess with" the original system files used for daily work and separate the new compiled and volatile programs in a separate location it is common to not just change but add/mount a complete folder structure similar to the original OS folder structure in a special "development" location.
So more or less a mirrored folder structure of the original one but connected/linked to the original resources.
There for we need to add an environment variable to our user bash profile where we tell the system: "link our development folders to the following direction/dir."
On Arch Linux this is done in a file in ~/.bashrc - that is linked/forwarded in/by the ~/.bash_profile ("~" stands for /home/your user name/) and MacOS/Unix will be similar.
To do that there are 2 ways:
you can open the .bashrc file and add your environment path to the bottom of it
or
you can use "export" to put the environment variables to the right place in your user bash file.
for kde development e.g. you need to add a path at the end of the ~/.bashrc file like so:
# Adding the kdesrc-build directory to the path
export PATH="$HOME/kde/src/kdesrc-build:$PATH"
what basically tells the system: the development is done in the /home/user name/kde/src folder - there are your files. You can choose where you want to locate your development environment.
If you execute cmake it "thinks" your files are in the original OS folder and the "Could not find CMAKE_ROOT" - message will disappear because it finds all your files since properly linked from your development folder structure to your system folder structure.
So basically to solve the problem you could just execute cmake in the right system folder - it just could mess up your system if the program or make files are not proper done so it is pulled to the home folder development folder structure. And you just have to tell that cmake, so it can find all needed files to compile your stuff, including the CMAKE_ROOT.
Another problem could be that cmake isn't properly installed.
On Arch Linux systems that can be made sure by using the "sudo pacman -Syu cmake" command and it copies the files in the right direction and sets the right user variables to get it executed and reinstall cmake if necessary.
Btw, if you are on other systems like Debian make sure to use a Debian apt repository, it can differ from the Ubuntu repository, especially if you compile for the chosen system.
I tried to write a general "beginners in mind" overview to get em a fundamental picture. Executing cmake in the right folder solved that exact problem for me that was asked for.
(Actual that flags works for the actual cmake version from the official arch repository:
1:
cd /home/ivanovic/kde/src/program_name
than:
2:
cmake -S/home/ivanovic/kde/src/program_name -B/home/ivanovic/kde/build/program_name -DCMAKE_INSTALL_PREFIX=/home/ivanovic/kde/usr -DCMAKE_BUILD_TYPE=Debug
Pay attention that between -S and /home/... is no space, same at -B and /home/...
This worked fine for my kde system software builds.
)
If anyone gets the following error:
Modules directory not found in
/usr/share/cmake-3.20
cmake version 3.20.2
Solution which worked for me:
sudo cp -r /share/cmake-3.20 /usr/share/
The above command copies the cmake-3.20 directory from /share to /usr/share
This also happened to me on a fresh install of Ubuntu 21.04 and was fixed by installing it from "snap":
sudo snap install cmake --classic
(and then making sure that /snap/bin is in $PATH)
tl;dr: check the permission of folder /usr/local/share/cmake-x.xx.
I had a similar problem with the cmake that I build from source code. I compile the code with the following command.
./configure
make
sudo make install
and the binary files were placed into /usr/local/bin as expected. But I will encounter the same problem when executing cmake without sudo privilege. This is because the normal user don't have reading permission with folder /usr/local/share/cmake-3.xx.
The error went away when I give myself the permission to read/execute, with the command.
sudo chmod 755 /usr/local/share/cmake-3.xx
(xx will be the specific version that you installed.)

Php-gd: PHP Extension gd must be loaded & Unable to locate package

Having an issue with php-gd
I inserted this command:
sudo apt-get install php5-curl php5-mcrypt php5-gd php5-common
throughout the process to setup Magento but when I went through Validation, this is what I got:
"PHP Extension gd must be loaded"
When the warning showed up. I tried to install it again using:
sudo apt-get install php5-gd
This was the message that I received:
"Reading package lists... Done E: Unable to locate package"
I Would like some direction on how to fix this Error.
Restarting the webserver after installing php5-gd loads the package.
check. reloading the web server. services such as php-pfm (php5-fpm), fcgi, fastcgi, etc load once and remain in the background. Adding modules does not impact the running copy. It must be restarted to load the module into active use.
Use synaptic package manager for easier installation.
After installing and it still does not work, look at the apache modules, mine is at /etc/php5/apache2/conf.d/20-gd.ini
; configuration for php GD module
; priority=20
; extension=gd.so
Even if the module exists and is installed on the system, it is commented out on the module config. Uncomment it, then restart Apache, then you should be fine.

Jboss run with sudo

I'm trying to run JBoss with sudo under certain configuration. I type: sudo jboss config.
And get the following result: path-to-jboss/bin/run.sh: 255: java: not found
I think it could be a JVM installation issue, but not sure.
It looks like sudo is changing your $PATH, so that the java executable can no longer be found. See this question for some possible reasons why.