LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-24-2009, 03:41 AM   #1
meda75
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
arm-linux-gcc linker problem with libmodbus


Hi everyone . I have problem with arm-linux-gcc crosstool . I have download and install libmodbus library for modicon Modbus protocol . And with gcc that library works just fine . But when I try to use arm-linux-gcc instead he sends me error . this is command for compiling

$arm-linux-gcc -I/usr/local/include my_app.c -lmodbus (/usr/local/include is where actualy is modbus.h) and error is
/arm-linux-gcc/bin/ld: cannot find -lmodbus
collect2:ld returned 1 exit status .

Remark : When I installed libmodbus, as CC variable I have use CC=gcc in Makefile ( but I had try with CC=arm-linux-gcc also , but without any result )
Thank You in advance
Sorry for my poor English
 
Old 04-24-2009, 05:46 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Try using the 'absolute path' to arm-linux-gcc, when
you configure 'libmodbus' :

CC="arm-linux-gcc -B/<path-to-arm-linux-gcc>/" ./configure
( Adding it, when you do 'make' , does not always work.)

A 'libmodbus' compiled with /usr/bin/gcc cannot be used
to compile anything 'arm'.
All dependencies, libraries etc. to be used with an
'arm' application, arm-linux-gcc, must be compiled for
arm.

.....
 
Old 12-20-2013, 04:42 AM   #3
ChrisOnLinux
LQ Newbie
 
Registered: Dec 2013
Posts: 4

Rep: Reputation: Disabled
this worked for me but I get the following errors now:

...
configure:3154: checking for gcc
configure:3181: result: arm-ssv1-linux-gcc
configure:3410: checking for C compiler version
configure:3419: arm-ssv1-linux-gcc --version >&5
./configure: line 3421: arm-ssv1-linux-gcc: command not found
configure:3430: $? = 127
configure:3419: arm-ssv1-linux-gcc -v >&5
./configure: line 3421: arm-ssv1-linux-gcc: command not found
configure:3430: $? = 127
configure:3419: arm-ssv1-linux-gcc -V >&5
./configure: line 3421: arm-ssv1-linux-gcc: command not found
configure:3430: $? = 127
configure:3419: arm-ssv1-linux-gcc -qversion >&5
./configure: line 3421: arm-ssv1-linux-gcc: command not found
configure:3430: $? = 127
configure:3450: checking whether the C compiler works
configure:3472: arm-ssv1-linux-gcc conftest.c >&5
./configure: line 3474: arm-ssv1-linux-gcc: command not found
configure:3476: $? = 127
configure:3514: result: no
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME "libmodbus"
| #define PACKAGE_TARNAME "libmodbus"
| #define PACKAGE_VERSION "3.0.5"
| #define PACKAGE_STRING "libmodbus 3.0.5"
| #define PACKAGE_BUGREPORT "https://github.com/stephane/libmodbus/issues"
| #define PACKAGE_URL ""
| #define PACKAGE "libmodbus"
| #define VERSION "3.0.5"
| / end confdefs.h. */
...
configure:3519: error: in `/libmodbus-3.0.5':
configure:3521: error: C compiler cannot create executables

Anyone an idea if and how I can make my compiler work for libmodbus?
 
Old 12-20-2013, 06:40 AM   #4
nake
LQ Newbie
 
Registered: Dec 2013
Posts: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by ChrisOnLinux View Post
configure:3154: checking for gcc
configure:3181: result: arm-ssv1-linux-gcc
I thought you said your cross compiler was arm-linux-gcc and not arm-ssv1-linux-gcc

The problem I see is that your library is compiled for your normal gcc (downloaded I suppose) and not the cross-compiler one, so you will have to recompile it with the cross-compiler. Make sure you specify what gcc to use when compiling (usuarlly an option when calling ./configure).
Also, in your first post you specified where to find the header (.h) files, but not the libraries. Thats done with -L/path/to/lib

So recompile that library and specify to gcc where to find it
 
Old 12-20-2013, 07:20 AM   #5
ChrisOnLinux
LQ Newbie
 
Registered: Dec 2013
Posts: 4

Rep: Reputation: Disabled
Hello nake and thaks for your quick reply.
I think there is a misunderstanding. I am not the same person like "meda75"
and yes I am using the cross compiler arm-ssv1-linux-gcc cause I am trying to get libmodbus running on a IGW/920 from SSV Industrial Communication
http://www.ssv-comm.de/de/produkte/igw920.php

The errors I posted had appeared while running ./configure.
The command I used was:
CC="arm-ssv1-linux-gcc" ./configure

I don't think I need the -B/<path-to-arm-ssv1-linux-gcc> option cause I have that path in my bashrc
 
Old 12-20-2013, 08:19 AM   #6
nake
LQ Newbie
 
Registered: Dec 2013
Posts: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by ChrisOnLinux View Post
Hello nake and thaks for your quick reply.
I think there is a misunderstanding. I am not the same person like "meda75"
Whoops. Sorry.

Alright, so could you make sure that the command can be executed outside the ./configure script?
I mean, if you open a console and enter arm-ssv1-linux-gcc --version, does it show any output?
And maybe I'm wrong, but you could try adding the complete path to the variable CC. It seems that somehow the script can't find the cross-compiler.
 
Old 01-07-2014, 04:26 AM   #7
ChrisOnLinux
LQ Newbie
 
Registered: Dec 2013
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by nake View Post
... if you open a console and enter arm-ssv1-linux-gcc --version, does it show any output?
Yes, this works fine. I get the following:
~$ arm-ssv1-linux-gcc --version
arm-ssv1-linux-gcc (GCC) 3.4.4
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Maybe the configure file expects something else e.g. "3.4.4" and nothing else.
I tried it also with the -B option but it doesn't make a difference.
sudo CC="arm-ssv1-linux-gcc -B/usr/local/arm-ssv1-linux/bin/" ./configure
I get the same result.
...
configure:3154: checking for gcc
configure:3181: result: arm-ssv1-linux-gcc -B/usr/local/arm-ssv1-linux/bin/
configure:3410: checking for C compiler version
configure:3419: arm-ssv1-linux-gcc -B/usr/local/arm-ssv1-linux/bin/ --version >&5
./configure: line 3421: arm-ssv1-linux-gcc: command not found
configure:3430: $? = 127
...
 
Old 01-07-2014, 09:16 AM   #8
ChrisOnLinux
LQ Newbie
 
Registered: Dec 2013
Posts: 4

Rep: Reputation: Disabled
Looks like it works now. All I had to do was to enter the following command:

./configure --host arm-ssv1-linux
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile the linux2.6.14.1 for arm must ues the arm-linux-gcc-3.4.4? frankyue Linux - Embedded & Single-board computer 2 12-20-2008 07:28 AM
Linker Error while compiling gspca module for ARM processor. ravi_chobey Linux - Software 0 07-08-2008 12:19 AM
need arm-linux-gcc anshuman84 Linux - Software 1 05-03-2008 03:32 AM
urgent:problem reg compling prog using arm-linux-gcc ashok kumar reddy Linux - Kernel 1 06-30-2006 04:46 AM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration