From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5312 invoked by alias); 18 Dec 2011 13:30:54 -0000 Received: (qmail 5302 invoked by uid 22791); 18 Dec 2011 13:30:53 -0000 X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLY X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 13:30:40 +0000 Received: by wgbdr1 with SMTP id dr1so8164033wgb.8 for ; Sun, 18 Dec 2011 05:30:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.206.200 with SMTP id fv8mr9876964wbb.11.1324215039619; Sun, 18 Dec 2011 05:30:39 -0800 (PST) Received: by 10.216.158.3 with HTTP; Sun, 18 Dec 2011 05:30:39 -0800 (PST) Date: Sun, 18 Dec 2011 13:30:00 -0000 Message-ID: Subject: -lm and -lm64 problems From: Xianwen Chen To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg00134.txt.bz2 Hi, I wrote a simple C script in which sqrt() is used. The program compiles fine on Debian i686; however, on Ubuntu 11.10 AMD64, it can't be compiled: 1) if I compile it as 'gcc -Wall -g -m64 -lm64 -o foo foo.c', it complains: /usr/bin/ld: cannot find -lm64 collect2: ld returned 1 exit status 2) if I compile it as 'gcc -Wall -g -m64 -o foo foo.c', or 'gcc -Wall -g -m32 -lm -o foo foo.c', it complains: /dir/to/foo.c:15: undefined reference to `sqrt' collect2: ld returned 1 exit status Can someone offer me a hint? Thanks. Kind regards, Xianwen -- Please notice that my previous email address v9@dr.com is no longer accessible.