public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [lm-sensors] i2c tools build failure with gcc 4.6
Date: Fri, 21 Dec 2012 09:45:41 +0100	[thread overview]
Message-ID: <20121221094541.5e6125ac@endymion.delvare> (raw)
In-Reply-To: <20121220163945.GB32096-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

Hi Guenter,

On Thu, 20 Dec 2012 08:39:45 -0800, Guenter Roeck wrote:
> I found the problem. -li2c must be specified after the .o files.
> 
> Patch:
> 
> diff --git a/tools/Module.mk b/tools/Module.mk
> index 1979248..bfd3250 100644
> --- a/tools/Module.mk
> +++ b/tools/Module.mk
> @@ -21,16 +21,16 @@ TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget
>  #
>  
>  $(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
> -	$(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
> -	$(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +	$(CC) $(LDFLAGS) -o $@ $^  $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
> -	$(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
> -	$(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  #
>  # Objects

Hmm, OK. The gcc manual page is somewhat confusing on this topic but as
I understand it, when processing a library, it only considers symbols
which were already referenced but not defined, and discards the rest.
So object files must indeed come first on the command line.

Why it has always worked for me the other way around is a mystery.

You have write permissions to the repository, so please just commit
this fix, thanks.

-- 
Jean Delvare

  parent reply	other threads:[~2012-12-21  8:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20  1:07 i2c tools build failure with gcc 4.6 Guenter Roeck
     [not found] ` <20121220010733.GA31336-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2012-12-20  9:45   ` Jean Delvare
     [not found]     ` <20121220104510.2fa8a0fb-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-20 14:20       ` Guenter Roeck
     [not found]         ` <20121220142006.GB32230-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2012-12-20 14:37           ` Jean Delvare
     [not found]             ` <20121220153735.2ae73802-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-20 14:44               ` Guenter Roeck
2012-12-20 14:53               ` [lm-sensors] " Jean Delvare
     [not found]                 ` <20121220155354.3e600483-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-20 16:31                   ` Guenter Roeck
2012-12-20 16:39                   ` Guenter Roeck
     [not found]                     ` <20121220163945.GB32096-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2012-12-21  8:45                       ` Jean Delvare [this message]
     [not found]                         ` <20121221094541.5e6125ac-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-21 16:45                           ` Guenter Roeck

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=20121221094541.5e6125ac@endymion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    /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