Math Library Errors while building using Cygwin/GCC (Very Tough)

Started by
3 comments, last by RSinfar 17 years, 10 months ago
This will be the 4th day spent trying to get this library to work. Its an SML library used for advanced math. I have Cygwin installed so that we can use a GNU compiler. Eventually We will be using C++/OpenGL/SML to do some work and the library is a necessity. I have spoken two 3 people, two who were experienced in with this sort of thing and one tech rep from SML but none have even dented the problem yet. The situation is this. I have a folder that holds all the files for the library. I have 4 folders and a makefile within the first folder. The makefile is tiny and just calls other makefiles. Two of the folders I am not aware if they do anything. The important two folders are NLib and NMTLib. So far when I told the main makefile to do everything it declared it was working on NLib and running a makefile within that folder (within are a few folders and files for building the library. the fodlers are full of .o .h and .c) this make works without complications and the main makefile continues to change directories and move to NMTLib and begins to work. after about 10 or so minutes it fails declaring Error 2. There is output generated to a txt file that says what happened: Making libnmtlib.so g++ -shared -m32 -g -o libnmtlib.so objects/IwAObject.o ... objects/my_nurbs_srf.o -L.:NLib -lnlib (I cut out the other .o's as there are MANY) (Also the addition of :NLib to -L. was added while trying to fix the issue, it came as -L) /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lnlib collect2: ld returned 1 exit status make[1]: *** [libnmtlib.so] Error 1 make[1]: Leaving directory `/cygdrive/c/Documents and Settings/Julio Gonzales/Desktop/SML resources/SMLib/NMTLib This error occurs no matter what we have tried. The only thing altering the problem is if we remove -lnlib all together in which I get hundreds of undefined errors instead. Anyone up to attempting to help with this daunting task please please PLEASE help. you can respond here or contact me at RySinfar on AIM, ryox_sinfar@msn.com on MSN, or RSinfar for yahoo. (AIM or MSN prefered) ICQ is now an option 233704007 I will be sitting here for hours at work trying to solve the problem so feel free to contact me. [Edited by - RSinfar on June 9, 2006 10:52:52 AM]
Advertisement
So far we hyave tried rearranging the order of pieces in the Makefiles and setting enviroment paths or setting paths in the makefile. Nothing has worked >.<
(Disclaimer: I don't know much about GCC or Makefiles, so the following is just a guess.)
From the "Leaving directory" line, it sounds like it's inside .../SMLib/NMTLib. From your description, it sounds like nlib is in .../SMLib/NLib. From the call to g++ with "-L.:NLib", it looks like that's telling it to look in .../SMLib/NMTLib/NLib (which doesn't exist). I can't see the documentation saying -L accepts a colon-separated list of paths (though I'm not at all sure it doesn't), so it may work better as "-L. -L../NLib".
Just to clarify things: You have a folder 'SMLib', which contains the folders 'NMTLib' and 'NLib'. Your makefile changes the current directory to '.../SMLib/NMTLib'.

Then you should call the compiler like this:
g++ -shared -m32 -g -o libnmtlib.so objects/IwAObject.o ... objects/my_nurbs_srf.o -L. -L../NLib -lnlib

Every directory to search for libs should have its own -L option. Every library should have its own -l option.


Edit:
Just wondering how did you build your libnlib.a (a static library) ? Or did you build a libnlib.so (a dynamic link library) instead ? To make use of the -L and -l options, you have to build a static library, i.e. libnlib.a.
The main makefile I ran first went into NLib and ran a makefile there. That makefile generated libnlib.so in NLib. The makefile in NMTLib then goes into NLib and copies his file into NMTLib itself. Atleast it did so when I first ran it, it doesn't show that it does again, I imagine because there has been no changes.

I messed aroudn with the directories again, as was suggested and I still get the same results no matter what I do.

This topic is closed to new replies.

Advertisement