I'm a new Linux programmer trying to develop shared libraries and have been able to successfully compile one in Eclipse using the Eclipse project settings; only to find that to create a Debian package I need a ./configure script! So I set up Autotools on my system, and tried to create an Autotools project in Eclipse. I created it with the default library settings, and then renamed the .C file to a .CPP file, and changed the entry in the Makefile.am as per the documentation. I cleaned the project, rebuilt the Makefile, but for some reason it's still looking for the old .C file!!!! (No rule to make target libTest.c needed by libTest_la-libTest.lo'!
I've spend hours trying to figure this one out to no avail. Could someone please help!
The .deps folder stands for dependencies. These are generated when ./configure is run. Doing a make distclean (if one exists) or equivalent will remove this .deps directory along with any other generated files. The make clean only removes generated object files.
Re-running configure should generate a list of source file dependencies. Invoking make itself does not re-generate the dependencies.
OK. Found out the answer was hidden in a .deps folder. Deleting the .deps folder fixed the issue. I will award the answer to whoever can explain why deleting the folder worked though, because I'm really confused on this one.
Related
I am currently trying to install the libnoise library for mingw via a .a file. I've tried several things but I am not really that much experienced with makefiles.
I've ran through the included makefile and at the end it throws a "Undefined reference to 'WinMain#16'"
The .lib file does indeed work, but is there any way to compile my program through a .a library? I would be glad if someone would show me how to actually make a .a myself since I have no experience and I can't find where to start.
I found exactly what to do on libnoise while it came to my mind today.
1) install libnoise on github from https://github.com/eXpl0it3r/libnoise
2) run cmake with entries CMAKE_C_COMPILER:STRING=gcc CMAKE_CXX_COMPILER:STRING=g++ (easiest to do with cmake GUI)
it is recommended to generate into another folder, perhaps create a new one.I created one in a new one called libnoise-master/lib
3) inside that, run
make
if make doesn't work you might a) not have set up the PATH variable or b) inside your MinGW/bin you can't find make, but mingw32-make. Either rename it to make or use mingw32-make instead of make
after all of that you will generate a .a file if you havent chosen a shared library on step 2 or a .dll if you did
So I want to install the dxflibn (it allows for the program to read and write .dxf files). You can find the files here. I found, on there site, this Programmer's guide. If you go to page 3, it says how to install the library. It says to use cygwin and MinGW32. I have not used this tools before so need some help.
From what I read (when I was researching these tools), the MinGW32 is used to install the compiler needed and the Cygwin can emulate the Unix system. I do have some experience with Unix command line but limited.
Back to the instruction on page 3, it says to run two commands. The first command is for executable but from the file I downloaded (the dxflib zip) there is no "configure" file to execute. While searching even more, I found the the .pro file that is in the folder of the library can produce a make file but not sure how.
Questions:
What exactly do I need to do to install the dxflib?
After I install it, for me to run it from my C++ code, what do I need to do? I read here that I need to:
A) put the header files in a location which your compiler is aware of
B) put the dll files in a location which your linker is aware of.
Any help would be amazing, tnx :)
I was able to find a solution after all.
For question 1:
I first went and installed qmake (from the Qt website).
After that, I needed to include in my "system parameters" the qmake.exe so I can run it from the Command Prompt line (like it says here).
And finally, I opened cmd, navigated to the library directory and run the command qmake -spec win32-g++ dxflib.pro (as suggested here). This created the make file.
Now run the command MinGW32-make. This will create a "release" folder with with a static library (that will be needed a the next step) and come .o files.
For question 2:
I used the Dev-C++ IDE. After I had created a project, I went to "project>project options".
Under "Directories>Include Directories" I added the path of the source code of the library (path_of_where_you_unziped_the_library\dxflib-3.7.5-src\src).
Also, under "Parameters>Linker" I added the .a file that is under the "release" folder (path_of_where_you_unziped_the_library\dxflib-3.7.5-src\release)
This worked for me :)
I understand that CMake enables a project to be easily built in a variety of compiler/IDE environments. I have experienced this for myself and was amazed when CMake produced a working, buildable Xcode project for me from some open source project (cool!)
But what I don't understand is how you properly update the CMake system after you have made significant changes to the project that CMake created for you.
For example I am envisioning a workflow in which the project should be kept portable via CMake. So I create a clone of a github project, use CMake to create my XCode project, and then go to work implementing some new feature or bug fix. Perhaps these changes are non-trivial and affect build.
After these changes are complete I want to push the code base back to github. What happens now? Must all of the CMake files be updated by hand to reflect all of the work that I've done? Or is there some equally magical feature to update the CMake files with the changes that were implemented in XCode (or Visual Studio, or some other supported IDE/compiler combo)?
What is the general "Roundtrip" workflow with CMake and how efficient is it?
The point is that you change your project by changing the CMake configuration files themselves. It could be that you'll find some other tool which manages cmake projects, which will make changes to your cmake files. In the example you mention, you have to check if XCode is modifying your cmake files.
You have to commit all the necessary modifications you do to your cmake files, and your build program (make, ninja, or any other) will run cmake every time the cmake project files are touched.
Advanced note: if you use the command file with globbing instructions to get the list of your sources files, you might be interested to read Getting cmake to run before building after pulling from git
I am trying to compile a Qt project that uses poppler library for pdf (linux).
I put #include in the mainwindow.cpp
I put poppler folder in my project folder besides mainwindow.cpp
poppler-qt4.h is in poppler-0.16.7/qt4/src
I do not need to recompile poppler, I just need to link the library through its headers but I do not know how to do. If compilation is necessary I can do it, but I tried ./configure and it said "./configure not found".
I searched for other similar threads but they were not enough useful to me.
I know LIBS is involved but makefile is overwritten by Qt-creator?
I'd prefer to learn how to "officially" inform Qt-creator that I want to add the library.
Please can help?
You have a good example, completed with source code, here: Poppler: Displaying PDF files with Qt
Along with including the header files where apropriate, you need to link to the poppler library.
To do so, you need to edit your .pro file and include something like:
INCLUDEPATH += /usr/include/poppler/qt4
LIBS += -L/usr/lib -lpoppler-qt4
These are the "default" paths, you may need to change them accordingly to your particular install location.
EDIT:
From your comments you seem to be trying to build poppler lib from source. The problem is that you're executing ./configure ( make and make install ) in the wrong directory. You "need" to position yourself in the directory where the file configure is located(*). Then execute the traditional commands:
./configure
make
make install
You run configure (you usually have to type ./configure as most
people don't have the current directory in their search path). This
builds a new Makefile.
Type make This builds the program. That is, make would be
executed, it would look for the first target in Makefile and do what
the instructions said. The expected end result would be to build an
executable program.
Now, as root, type make install. This again invokes make, make
finds the target install in Makefile and files the directions to
install the program.
I extracted this quote from http://tldp.org/LDP/LG/current/smith.html. But there are lots of places where you can find more information about these commands. Just google it! :D
(*) You don't really need to be in the same directory as the configure file. But it's easier than writing the full path.
I have a big project that uses CMake to create Make file. Sometimes, I add one small project and then have to run the CMake script for whole project (like delete previous, and create newer CMake with this project included).
I was wondering, whehter there is some option in CMake whereby I can only "update" the Make script (created by CMake) to include newly added project (rather than above option).
Thanks,
You can only do
cmake .
in directory which contains CMakeCache.txt. This will trigger whole reconfiguration, but save your options.