From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: Caspar Zhang <czhang@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] fix lib-not-found error when compile for the second time
Date: Fri, 18 Dec 2009 21:33:02 +0530 [thread overview]
Message-ID: <1261152182.8993.22.camel@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <76281794.565171261136353220.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
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
next prev parent reply other threads:[~2009-12-18 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1261152182.8993.22.camel@subratamodak.linux.ibm.com \
--to=subrata@linux.vnet.ibm.com \
--cc=czhang@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox