Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help with compiling error: /usr/bin/ld: cannot find -lgcc

1,714 views
Skip to first unread message

mbs...@gmail.com

unread,
Jun 4, 2015, 6:56:43 PM6/4/15
to
I'm not a C user and I'm struggling with a seemingly simple problem.
I'm trying to compile a C program (smm.c) which comes inside i8kutils fan-control package for a Dell laptop. The packages g++ libc-dev libc6-dev-i386 build-essential are already at their newest version. I have a feeling this might be a 32bit/64bit compatibility issue. This is the error that I'm getting:

$ gcc -g -O2 -Wall -I. -o smm -m32 smm.c

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

Is there anything else I can try ? Thanks.

mbs...@gmail.com

unread,
Jun 4, 2015, 7:02:12 PM6/4/15
to
Forgot to add, I'm running: Linux Mint 17.1 64 Bit.

Paul Beeler

unread,
Jul 12, 2015, 5:45:26 PM7/12/15
to
On Thursday, June 4, 2015 at 6:56:43 PM UTC-4, mbs...@gmail.com wrote:
It's definitely a issue with 32/64bit. That's why it says incompatible. Your /usr/bin/ld is for 64bit but it appears your trying to compile a program for 32bit. I think you would have to use a 32bit cross compiler toolchain in order to compile the program but take that with a grain of salt as I'm just making some guesses here. You could also try installing some i686 packages which I think are 32bit compatible for x86_64 machines.

Paul Beeler

unread,
Jul 12, 2015, 5:49:40 PM7/12/15
to
On Thursday, June 4, 2015 at 6:56:43 PM UTC-4, mbs...@gmail.com wrote:
You could also try removing -m32 if unless you absolutely need it.

Richard Kettlewell

unread,
Jul 13, 2015, 4:28:54 AM7/13/15
to
mbs...@gmail.com writes:
> I'm not a C user and I'm struggling with a seemingly simple problem.
> I'm trying to compile a C program (smm.c) which comes inside i8kutils
> fan-control package for a Dell laptop. The packages g++ libc-dev
> libc6-dev-i386 build-essential are already at their newest version.

I guess from the above that you’re using Debian, Ubuntu or some variant.

> I have a feeling this might be a 32bit/64bit compatibility issue. This
> is the error that I'm getting:
>
> $ gcc -g -O2 -Wall -I. -o smm -m32 smm.c

Why -m32?

> /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
> /usr/bin/ld: cannot find -lgcc
> /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for
> -lgcc_s
> /usr/bin/ld: cannot find -lgcc_s
> collect2: error: ld returned 1 exit status
>
> Is there anything else I can try ? Thanks.

1. Don’t do 32-bit builds on 64-bit systems unless you actually have a
good reason.

2. If you do have a good reason, install the relevant
gcc-<version>-multilib package.

--
http://www.greenend.org.uk/rjk/

mbs...@gmail.com

unread,
Aug 20, 2015, 11:26:17 PM8/20/15
to
Thanks Paul and Richard, sorry for my late reply! I thought my post went unanswered.
Anyway, I solved my issue by compiling the program on 32bit Linux machine, then I copied the binaries over to my 64bit setup. Thanks the same.
0 new messages