Building libnoise for mingw - c++

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

Related

CMake not finding package that is clearly there

I am trying to build a project via cmake in qtcreator, but am having trouble with the external package dependencies.
There have been several packages that it could not find, but I added symlinks to the actual file locations into the directory cmake was looking in, afetr which they worked fine.
However, this one library libopencv_viz.so.3.2.0 isn't cooperationg with me. I added the symlink and visually verified that the file/link is in the correct location, but cmake is still telling me that it cannot find the file, and I have no clue how to solve this. As I stated in a prior post, I am still just learning cmake right now, so I have absolutely no clue why it would not be able to find a package that is verifiably in the correct location.
CMake Error at /usr/share/OpenCV/OpenCVModules.cmake:192 (message):
The imported target "opencv_viz" references the file
"/usr/lib/x86_64-linux-gnu/libopencv_viz.so.3.2.0"
but this file does not exist. Possible reasons include:
The file was deleted, renamed, or moved to another location.
An install or uninstall procedure did not complete successfully.
The installation package was faulty and contained
"/usr/share/OpenCV/OpenCVModules.cmake"
but not all the files it references.
Creating symlinks by hand suggests you have an incomplete installation. Clean up your manual symlinks, and figure out what's wrong with your installation.
It is normal on Linux that the .so.x.y.z with the full numeric version is the runtime library. That is, the file that is required for applications to run. The version number ensures that the application loads the same library that it was built against.
The .so symlink to .so.x.y.z is for the build chain. When the compiler (linker, really) goes to link against libopencv_viz, it will search for libopencv_viz.so, resolve the symlink to versioned file, and link that.
Many distributions (including Ubuntu) separate the runtime libraries from the development components. My guess is that you've installed the package named libopencv-viz3.2, but not the one named libopencv-viz-dev.

Issue with CLion and find_package: Generated CMake files are placed in some odd location

So basically I have the following setup:
A small test library called mylib with an according CMake file. The CMake file creates all the necessary information so that another project (which is going to be my binary) can use find_package to add the library. The library also has a install target.
A small binary called mybin again wih according CMake file which is depended on the mylib project. Using find_package I can add mylib either by specifying the location of the according myLibConfig.cmake (and myLibTargets.cmake etc.) files or by executing the install target of mylib and then letting CMake find the library itself.
Using CMake and XCode everything works like a charm. First, I configure and build the library. Second, I configure my binary project, specify the location of the library and then build it without any problems.
Now I want to do the same using CLion. My problem now is that CLion puts all the generated CMake file (which usually are placed in the build folder) in some cryptic location which can't be changed in the IDE. Now, when I want to build the mybin project I have to specify this cryptic location which seems kinda odd to me (especially because you have to find out first where CLion actually places those files).
So my question is: Is there a more convenient way to handle the described configuration? I guess this is more or less the standard use case which makes me wonder if I'm missing out on something. Being able to specify where CLion should put the generated CMake files would solve my problem I guess.
I know that i can install the library (using the install target) and then let CMake find it. The problem here is that CLion (to my understanding) doesn't support install targets and therefore I have to use (in my case) XCode to build and install the library first.
I was misunderstsanding the intention of find_package(as Tsyvarev pointed out). By using the solution proposed in this question I managed to add an install target to CLion which now allows me to conveniently build "mylib" and use it in the "mybin" project without having to configure anything manually.

How to compile a Qt program without installing sdk

Can someone tell me if it's possible to compile a project that works with Qt but without installing the entire sdk ? I mean, something like recompile Qt source code and link the libraries or something like this.
I know my problem is weird but I work in special conditions : I am on a linux machine and I have to work on a windows project therefore I use a distant server on windows to compile but I can't install anything on this serveur. I need an idea to have a fully portable folder with Qt who can compile without installing anything.
I hope I was clear in my explications.
Thank you for your help.
I has combined comments in answer.
You need to install compiler (e.g minGW) and Qt Library (as needed version).
You should add into environment variable 'PATH' your path to qmake and compiler.
Start terminal and move to directory with your source code of Qt project.
Run qmake and then exec make (e.g. It, for minGW, is mingw32-make).
For your case, you may choosen 2 way:
Build static Qt Library from source code and use static linking with your project.
Install Qt Library and copy libraries near your project with dynamic linking (recomended).

New Linux programmer -- Trying to develop libraries

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.

exploiting poppler in Qt creator - help

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.