* [LTP] [PATCH] fix lib-not-found error when compile for the second time [not found] <272150129.565151261136307450.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com> @ 2009-12-18 11:39 ` Caspar Zhang 2009-12-18 16:03 ` Subrata Modak 0 siblings, 1 reply; 4+ messages in thread From: Caspar Zhang @ 2009-12-18 11:39 UTC (permalink / raw) To: ltp-list [-- Attachment #1: Type: text/plain, Size: 3429 bytes --] 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, Caspar [-- Attachment #2: lib-not-found-compile-err.patch --] [-- Type: application/octet-stream, Size: 479 bytes --] diff -Naur a/include/mk/env_post.mk b/include/mk/env_post.mk --- a/include/mk/env_post.mk 2009-11-30 21:50:48.000000000 +0800 +++ b/include/mk/env_post.mk 2009-12-18 18:57:44.085074045 +0800 @@ -35,7 +35,7 @@ # For config.h, et all. CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include -LDFLAGS += -L$(top_builddir)/lib +LDFLAGS += -L$(top_builddir)/lib -L$(DESTDIR)/$(libdir) MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c))) [-- Attachment #3: lib-not-found-compile-err2.patch --] [-- Type: application/octet-stream, Size: 1086 bytes --] diff -Naur a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile --- a/testcases/kernel/controllers/Makefile 2009-10-10 01:55:46.000000000 +0800 +++ b/testcases/kernel/controllers/Makefile 2009-12-18 18:21:07.328136826 +0800 @@ -25,8 +25,8 @@ include $(top_srcdir)/include/mk/env_pre.mk INSTALL_TARGETS := *.sh -LIB := $(DESTDIR)/$(libdir)/libcontrollers.a LIBDIR := libcontrollers +LIB := $(LIBDIR)/libcontrollers.a FILTER_OUT_DIRS := $(LIBDIR) $(LIBDIR): diff -Naur a/testcases/network/sctp/Makefile b/testcases/network/sctp/Makefile --- a/testcases/network/sctp/Makefile 2009-10-10 01:56:05.000000000 +0800 +++ b/testcases/network/sctp/Makefile 2009-12-18 18:23:23.955198972 +0800 @@ -24,10 +24,10 @@ include $(top_srcdir)/include/mk/env_pre.mk -LIBSCTP := $(DESTDIR)/$(libdir)/libsctp.a -LIBSCTPUTIL := $(DESTDIR)/$(libdir)/libsctputil.a LIBSCTPDIR := lib LIBSCTPUTILDIR := testlib +LIBSCTP := $(LIBSCTPDIR)/libsctp.a +LIBSCTPUTIL := $(LIBSCTPUTILDIR)/libsctputil.a FILTER_OUT_DIRS := $(LIBSCTPDIR) $(LIBSCTPUTILDIR) [-- Attachment #4: Type: text/plain, Size: 390 bytes --] ------------------------------------------------------------------------------ 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 [-- Attachment #5: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] fix lib-not-found error when compile for the second time 2009-12-18 11:39 ` [LTP] [PATCH] fix lib-not-found error when compile for the second time Caspar Zhang @ 2009-12-18 16:03 ` Subrata Modak 2009-12-19 5:22 ` Garrett Cooper 0 siblings, 1 reply; 4+ messages in thread From: Subrata Modak @ 2009-12-18 16:03 UTC (permalink / raw) To: Caspar Zhang; +Cc: ltp-list 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 Ltp-list@lists.sourceforge.net 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] fix lib-not-found error when compile for the second time 2009-12-18 16:03 ` Subrata Modak @ 2009-12-19 5:22 ` Garrett Cooper 0 siblings, 0 replies; 4+ messages in thread From: Garrett Cooper @ 2009-12-19 5:22 UTC (permalink / raw) To: subrata; +Cc: ltp-list On Fri, Dec 18, 2009 at 8:03 AM, Subrata Modak <subrata@linux.vnet.ibm.com> wrote: > 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 ? Caspar, Thanks again for your good eye in spotting these two leftover issues I didn't resolve earlier. They have just been fixed on HEAD. Cheers, -Garrett ------------------------------------------------------------------------------ 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <568530967.616001261361679115.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>]
* Re: [LTP] [PATCH] fix lib-not-found error when compile for the second time [not found] <568530967.616001261361679115.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com> @ 2009-12-21 2:15 ` Caspar Zhang 0 siblings, 0 replies; 4+ messages in thread From: Caspar Zhang @ 2009-12-21 2:15 UTC (permalink / raw) To: subrata; +Cc: ltp-list ----- "Subrata Modak" <subrata@linux.vnet.ibm.com> wrote: > Caspar, > > There was also a problem with the sctp library. Did you check that out > ? Yes. sctp lib problem is also fixed in that patch. -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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-21 2:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <272150129.565151261136307450.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2009-12-18 11:39 ` [LTP] [PATCH] fix lib-not-found error when compile for the second time Caspar Zhang
2009-12-18 16:03 ` Subrata Modak
2009-12-19 5:22 ` Garrett Cooper
[not found] <568530967.616001261361679115.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2009-12-21 2:15 ` Caspar Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox