How to include additional directories when configuring makefiles - linux

I'm trying to compile geany-plugins-1.28. The debugger plugin (the only one I need) gives the error:
debug.c:53:21: fatal error: vte/vte.h: No such file or directory
#include <vte/vte.h>
Clearly it needs to know where this file is located to compile. I found the vte.h file in the src directory of the main program geany-1.28. When running
sudo ./configure cflags=-I/home/pi/Desktop/geany-1.28/src
I get the same error about the missing header later trying to compile the debugger plugin.
I ran
./configure --help
to get all the flag options. The output is here
How do I get this to configure correctly so that it compiles. I need to compile the debugger version 1.28 myself because apt only installs 1.24 which I think has a bug because it crashes when I run my code with the error:
close failed in file object destructor:
sys.execpthook is missing
lost sys.stderr

CFLAGS is case-sensitive environment variable, so you should set it before running configure, not try to pass it as a command line argument. This variant:
$ export CFLAGS=-I/home/pi/Desktop/geany-1.28/src
$ ./configure
leaves CFLAGS set for current shell until you leave it. While this:
$ CFLAGS=-I/home/pi/Desktop/geany-1.28/src ./configure
sets variable only for current command, i.e. configure.
Some other issues:
You do not need sudo to configure and make. It is also unnecessary for make install if you set PREFIX to a path you have privileges to write to.
Does plugin's build system also builds all it's dependencies? If not, you may face linker errors a bit later.
Update:
I have tried to build debugger plugin and got rid of your error. It seems that vte.h coming with Geany is it's intrinsic, while the plugin requires full-featured file from the library. So I just installed vte and vte-devel from repos. Nevertheless, I got some other unrelated errors coming from Glib. I will not continue my attempts to build all this right now. Hope my effort will be helpful at least a little.

As in this answer stated, vte.h is not the file you are looking for. Install libvte(-dev) package on your system and rerun configure.
Just for the record: vte.h on Geany is a dummy to allow Geany to kind of dynamical enable vte or disable it depending on vte is installed on the system or not.

Related

make: i686-linux-gnu-ld: Command not found

i want to install cpanm WWW::Curl::Form on my Synology NAS. But that fails. Here is the output cpanm WWW::Curl::Form WWW::Curl::Easy File::Find::Rule String::CRC32 URI::Escape
--> Working on WWW::Curl::Form
Fetching http://www.cpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz ... OK
Configuring WWW-Curl-4.17 ... OK
Building and testing WWW-Curl-4.17 ... FAIL
! Installing WWW::Curl::Form failed. See /var/services/homes/fox/.cpanm/work/1541095458.25803/build.log
the log file gives me:
make: i686-linux-gnu-ld: Command not found
But i dont know how to fix it on my Synology NAS (DSM 6.2 and appollolake architecture DS918+)
After reviewing your additional comments, I believe I have potential solution. It looks like you are trying to install some Perl modules via the default Perl shell, cpan. As part of the installation process, the make utility is being executed. This utility is heavily used for compiling and building source from C and C++ source code, along with other languages.
The make utility is trying to call some executable i686-linux-gnu-ld which is a linker, see ld. A linker is a utility used in C programming for linking (combining) multiple compiled object files into a single executable binary. make is calling this utility as some sort of build process. Instead of calling i686-linux-gnu-ld it should probably just be calling ld. The only thing I am not sure about is why it is using the full name of the utility instead of ld.
I can think of two solutions. The first would be to update the make file to use the correct name for the linker. I'm not sure how you would do this when it is being installed via cpan since it is downloading a package and executing the make file before you have a chance to modify it. The other option is to create a symbolic link from the incorrect name and path of ld that the make file is using to the correct path /opt/bin/ld. This will result in ld being called when i686-linux-gnu-ld is called. Also, I forgot to mention it earlier but the which command will tell you where an executable / command is located on your shell's path.
The Stack Overflow post, How to symlink a file in Liunx?, gives a good explanation of how to create a symlink. You need to create a symlink to point to the correct name and path of the linker. To do so run the following command:
ln -s /opt/bin/ld /usr/bin/i686-linux-gnu-ld
Depending on the permissions of these directories you may need to run this command under a account with elevated permissions or via sudo. I apologize for this post being rather long and verbose. I just wanted to explain my solution in detail. I hope this helps. Please let me know if this doesn't resolve the problem.
edit: fixed typo in the command.

CMake Error: Could NOT find SWIG (missing: SWIG_DIR)

I wanted to test out Pocketsphinx in Node.JS. It says I need to install Swig version 3.0.7 or above.
I think I installed all the other dependencies correctly. I can even type Swig commands in the Terminal now, but I keep getting this error whenever I run npm install pocketsphinx:
CMake Error at /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find SWIG (missing: SWIG_DIR) (Required is at least version
"3.0.7")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindSWIG.cmake:75 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:4 (find_package)
I tried brew install swig, npm install swig, and npm install -g swig. I tried going to the swig download page and following the installation instructions, but nothing I seem to do stops the error from happening. I'm trying this on a Macbook by the way.
I really have no clue what I'm doing here. I just wanted to test out Pocketsphinx and now I've installed Swig in 4 different places, and CMake can't seem to recognise any of them.
Any help would be wonderful!
Came here looking for the Windows-based error. I found a solution that seems to work for me, so decided to post it here.
Create two environment variables in the "System Variables" section: SWIG_DIR and SWIG_EXECUTABLE. These must point to /path/to/the/swig/dir/ and /path/to/the/swig/dir/swig.exe respectively.
After this, add one more entry to the PATH variable: /path/to/the/swig/dir. Test this out by typing swig in the command prompt. It should display a message must specify an input file. Use -help for available options.
Restart the computer to apply all environment variable changes. find_package(SWIG required) should work correctly now.
Check the source code for the FindSwig.cmake.
Unfortunately, if a find script does not work as expected and you do not see right away why that is the case, you usually have to dig into its source. In your case, it looks like CMake was able to find and run the SWIG executable, but then failed to obtain the swig directory.
Try manually running swig -swiglib and check that the printed directory indeed contains a swig.swg file. Also, be sure that the swig executable found by CMake is actually the correct one (you can verify this by inspecting the value of SWIG_EXECUTABLE in either the cmake-gui, the ccmake curses interface, or in the CMakeCache.txt file directly).
Note that CMake will not update the executable path once it has been found! So if you make changes to your system that influence the executable location, you will have to clear the cache (eg. by deleting the CMakeCache.txt) and re-run CMake for the changes to take effect.
I tried to work it out for myself. The problem was when I typed npm install swig.
I forgot to set up this version of Swig, and the compiler was using it.
I typed sudo npm uninstall swig and it worked perfectly. I feel very stupid!

'Can't find hdf5 library' while installing netCDF4

I am trying to build NetCDF4 from source on MacOSX. When I run ./configure I get the error:
checking for library containing H5Fflush... no
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.
I installed hdf5 before, and set the environment variables as:
LDFLAGS=-L/opt/local/lib
CPPFLAGS=-I/opt/local/include
In /opt/local/lib I have these files:
libhdf5.8.dylib
libhdf5.a
libhdf5.dylib
libhdf5.settings
libhdf5_cpp.8.dylib
libhdf5_cpp.a
libhdf5_cpp.dylib
libhdf5_hl.8.dylib
libhdf5_hl.a
libhdf5_hl.dylib
libhdf5_hl_cpp.8.dylib
libhdf5_hl_cpp.a
libhdf5_hl_cpp.dylib
And in /opt/local/include I have:
hdf5.h hdf5_hl.h
Why doesn't the configure script find the hdf5 library? I am happy to provide more information if needed!
EDIT:
My ultimate goal is to install netcdf4 for use as a Fortran module. I have tried installing everything through MacPorts, and it seemed to work, but when I tried to use it, the compiler told me that there was no netcdf.mod file, and sure enough there wasn't one to be found anywhere.
It turns out that just typing:
sudo port install netcdf-fortran
only installs the library files, but doesn't create a .mod file, which I guess is needed. So I found out that other people had the same problem, and the advice given was to install it with gcc44, which did create a .mod file, but then my compiler told me that the .mod file was built with a different version of gfortran and it couldn't be used, so that's why I am trying to build it from scratch, but if someone has a faster option, I would be more than happy to try it!
Ok, I finally figured it out.
I reinstalled netcdf-fortran with macports, then the .mod file suddenly appeared, I then had the problem, however, that when running gfortran, it would tell me that netcdf.mod was compiled with a different version of fortran than the one I am using. (Macports uses 4.8), so got gcc48 from macports and am using gfortran-mp-4.8 to compile now and it works.
Still don't know how to build all these things from scratch, but it works now at least!!!
Typically, I see this when there is a downstream dependency that cannot be fulfilled. The test program created by configure is finding libhdf5, but compilation is still failing because it cannot find something like libz or libszip, depending on how your libhdf5 was compiled.
If you check your config.log file and look for the error, it will probably tell you something along the lines of 'unresolved symbol'. This will give a clue as to which library is missing. If it is linking against the statically-built libhdf5, you may need to add the appropriate library usingLDFLAGS.
If you post the relevant portion of your config.log file, we may be able to help sort out what exactly is going wrong.
Sometimes it doesn't work in the configure parameters like
./configure --enable-shared --enable-fortran --enable-netcdf-4
CPPFLAGS=-I$home/apps2/include LDFALGS=-L$home/apps2/lib --prefix=$home/apps2
or doesn't work when export CPPFLAGS=-I$home/apps2/include in the open SHELL.
Maybe you can set the env vars CPPFLAGS and LDFLAGS in the .bashrc file (prior to the first two ways).

How to compile GTK2 source code?

I'm trying to modify GTK2 on Ubuntu Oneiric.
I download the source:
apt-get source libgtk2.0-0
cd gtk+2.0-2.24.6/
I try to compile and overwrite the current GTK2:
./configure --prefix=/usr
sudo make
Soemhow I get an error (I have all the necessary libraries and the build-essential package etc):
In file included from gtkquery.c:26:0:
gtkquery.h:31:2: error: #error "gtkfilechooserprivate.h is not supported API for general use"
By the way, I am able to modify and recompile GTK3 with no problems with the same steps.
If use debuild, I get thousands of
dpkg-source: error: cannot represent change to gtk+2.3.0-2.24.6/gtk+2.0-2.24.6/something: binary file contents changed
You won't get anything near the Ubuntu-provided build if you try building it by hand that way -- you'll miss all the ./configure options and other settings. (Look into debian/rules for the full details of what they're setting.)
Instead, try debian/rules build.
For reasons I haven't investigated yet (possibly including me not understanding how it should work), that didn't work on the first package I tried, but setting up pbuilder let me build the package I wanted.
It might feel like overkill to get a clean chroot as a build environment, but it is way too easy to build yourself problems that no one else in the world can replicate because you've got something funny on your local system.

Cannot run Code::Blocks: libwx_gtk2u-2.8.so.0 not found

I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux
Then I configured C::B with
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
and ran
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
When trying to run C::B, I get the following error:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.
The output of wx-config --prefix is /opt/wx/2.8,
The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,
and that of which wx-config is /opt/wx/2.8/bin/wx-config.
I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.
What might be wrong here?
The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:
LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks
The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.
Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.
If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.
You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps
If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.
Approach 1: Putting the path in .bashrc
gedit /home/{your-username}/.bashrc
Then after the line # User specific aliases and functions paste the following
export $LD_LIBRARY_PATH=/usr/local/lib.
This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.
Approach 2: Creating your own conf files
cd /etc/ld.so.conf.d
gedit wxformbuilder.conf
Give the path /usr/local/lib and save the file.
ldconfig (To update the library path).

Resources