On Fri, 2009-12-18 at 06:39 -0500, Caspar Zhang wrote: > Hi all, I meet a problem, if I compile and install ltp for the first time, > ltp can pass the compilation, but if I don't delete installation direcotry > (originally been /opt/ltp) and try to build ltp for the second time in > another ltp source folder, ltp failes in compiling: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall > -I/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel/include > -I/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel/controllers/cpuctl/../libcontrollers > -I../../../../include -I../../../../include > -L/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel/controllers/cpuctl/../libcontrollers > -L../../../../lib cpuctl_def_task01.c -lltp -lm -lcontrollers -o > cpuctl_def_task01 > cpuctl_def_task01.c: In function ‘main’: > cpuctl_def_task01.c:90: warning: ‘num_cpus’ may be used uninitialized in > this function > cpuctl_def_task01.c:90: warning: ‘test_num’ may be used uninitialized in > this function > cpuctl_def_task01.c:94: warning: ‘my_group_num’ may be used > uninitialized in this function > /usr/bin/ld: cannot find -lcontrollers > collect2: ld returned 1 exit status > make[5]: *** [cpuctl_def_task01] Error 1 > make[5]: Leaving directory > `/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel/controllers/cpuctl' > make[4]: *** [all] Error 2 > make[4]: Leaving directory > `/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel/controllers' > make[3]: *** [all] Error 2 > make[3]: Leaving directory > `/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases/kernel' > make[2]: *** [all] Error 2 > make[2]: Leaving directory > `/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130/testcases' > make[1]: *** [testcases-all] Error 2 > make[1]: Leaving directory > `/mnt/tests/kernel/distribution/ltp/20091130/ltp-full-20091130' > make: *** [build] Error 2 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > After investigating, I find the key to solve the problem: > > Suppose we build ltp to /opt/ltp. > > In testcases/kernel/controllers/Makefile[1] and > testcases/network/sctp/Makefile[2], > library files which need to be built are defined in /opt/ltp/lib: > > LIB := $(DESTDIR)/$(libdir)/libcontrollers.a > > when compiling&linking objects in controllers/ subdirs, the LDFLAGS paths are: > > -L$(topbuilddir)/testcases/kernel/controllers/libcontrollers > -L../../../../lib (see the error messages above) > > /opt/ltp/lib isn't included in LDFLAGS paths here. > > The first time when you compile ltp, a libcontrollers.a will be generated > under $(topbuilddir)/testcases/kernel/controllers/libcontrollers, so we can > find libcontrollers.a in LDFLAGS paths and the compilation could still pass. > But if you don't delete /opt/ltp and try to build ltp in another source > directory, error will occur. Since $(LIB) in Makefile[1] and Makefile[2] > are already up-to-date, no libcontrollers.a will be generated in > $(topbuilddir)/testcases/kernel/controllers/libcontrollers due to makefile > policy. Thus, ltp can't find libcontrollers.a in LDFLAGS paths. > > So we can fix this problem in two ways: add $(DESTDIR)/$(libdir)/lib to > LDFLAGS or change $(LIB) paths in Makefile[1] and Makefile[2]. Find details > in my attachments.
Thanks. I too faced the same thing sometime back. Garret, please apply the solution you would like the most. Caspar, There was also a problem with the sctp library. Did you check that out ? Regards-- Subrata > > Thanks, > Caspar > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ Ltp-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ltp-list ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
