Correctly getting libuv up and running so programs can be compiled using it

StackOverflow https://stackoverflow.com/questions/15441855

  •  24-03-2022
  •  | 
  •  

Pregunta

I am trying to us libuv in a project. My first step is just to get libuv on the computer and ready for use. I am using Mac OS X version 10.6.8. I downloaded the zip file and extracted it. The instructions on their site simply say to use the make command to build the library. When I do this it creates the libuv.a file. I have #include in the code file. In fact at this point I am simply trying to compile and run the sample program provided in their introduction paper. http://nikhilm.github.com/uvbook/basics.html. With help from a friend I finally found that if I run make run-test it will create libuv.dylib and then the program will compile and run as long as I set the LD_LIBRARY_PATH=../deps/libuv-master ./testEventLoop.

I have make version 3.81. My project is in a folder called echo which has two directories deps and src. The extracted libuv files, including all their sub files are inside deps. The test.c file and my make file are in the src folder.

This is the first time that I have ever used a third party library and it seems that I am beating my head against the wall. I have looked at everything I can find on the net on using a third party library and libuv in particular. Including but not limited to pouring through the GNU make instructions http://www.gnu.org/software/make/manual/make.html#Overview in order to try to understand libuv's makefile and the make files from several other project on the web that are using libuv.

These projects are so large that digging out this one little thing is something that I am having a very hard time doing. There must be other people who need help with third party libraries. I feel like I am very close but just not getting something, like I am missing some small piece to making it work that way that it should.

If I have left off any information that I should have included let me know and I will edit the question.

¿Fue útil?

Solución

I was able to get the library to install by changing the make file. I needed both the libuv.a and libuv.dylib files installed, (though I am still not sure why) and I had to split targets in the makefile that had two targets in the same rule. As they were they would create the prerequisites for either the libuv.a or the libuv.dylib but but not both. By splitting the rule into two rules one for the prerequisites of each of the files I needed, and then add an all target that had both libuv.a and libuv.dylib as prerequisites.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top