0

I am a new user on ubuntu. My project is to modify an application source code on ubuntu. I had already download an application source code which is using C++. Firstly i need to check whether the original source code can run successfully, how to run it on ubuntu?

dobey
  • 40,982
weixi
  • 11

2 Answers2

1

Before you try any of the following methods check README or INSTALL file it would be carrying whole info on installation. I'll give you some common installation methods. Make sure to do all the following things as root otherwise it may cause such "Permission Denied" errors. An easy way to do everything as root : At the beginning write sudo bash. It would open a bash as root it reduces lots of efforts writing sudo every time.

First extract the source code with

tar -xvzf something.tar.gz

1)With make file.

What ever your app is if it can be installed it should have a Make file in it. If there is a file named MAKE your app source work is now easy as pie.

Just lead the terminal to the source code folder cd /path/to/source/ (use tab key instead of writing whole path) and then write make It may ask you to configure and if it ask so it would also give instructions how to do so. Configurations are dependent on app so I can't help on it without the app name.

If it doesn't ask to config, it'll be easier now just write make install and you're done.

There might be some errors like some packges requires so just install packges using apt. i.e. apt-get install packgename


2)Without MAKE file.

In case the first method goes wrong with error i.e "Make file not found" this may work.

Check if there is a bin folder in the source, lead the terminal to the bin folder.

Run a proper executable you think is the main executable of the app using ./appname in this case the app is portable and you can use it without installation. Probably this method never works in case you have the zero compiled source code.

Or there may be such APPNAME.sh anything like install.sh run it with sh something.sh and if it runs without errors it's all yours.


However you can always install well known apps using apt.

1

Please follow the package approach.

  1. Set some essential build environment settings (you can make these up unless you are publishing these packages).

    $ export DEBEMAIL=yourname@example.com
    $ export DEBFULLNAME="Your Name Here"
    
  2. Install the build dependencies.

    $ sudo apt-get build-dep package
    
  3. Download the source package.

    $ apt-get source package
    
  4. cd into it.

    $ cd package-1.2.3
    
  5. Do any changes to the source if you like.

  6. Increment the version in the changelog.

    $ dch -i
    
  7. Build the package in the simplest form (unsigned).

    $ debuild -uc -us
    
  8. Install the new package you can find one directory level lower.

    $ sudo dpkg -i package-1.2.3-somemore.deb
    

Repeat steps 5, 7 and 8 to test your changes to the source until you're satisfied.

Please, really do not mess up your system with make install commands. This will overwrite files managed by your package management. Only run those command if you know what you are doing. Now, with the power of packages with your own changes you can install them easily, revert easily in case you mess up and distribute them among other machines without re-building.

gertvdijk
  • 67,947