LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-04-2013, 11:53 PM   #1
prkhr4u
LQ Newbie
 
Registered: Oct 2013
Location: Bangalore,India
Distribution: ubuntu 12.04
Posts: 19

Rep: Reputation: Disabled
linker error in make


I am trying to run 'make' command on a cpp file.The makefile has been provided.
After i issue make command the command elaborates to:

Code:
/usr/bin/g++ -I/opt/pylon/genicam/library/CPP/include -I/opt/pylon/include -DUSE_GIGE  -c -o AcquireContinuous.o AcquireContinuous.cpp
/usr/bin/g++ -L/opt/pylon/lib64 -L/opt/pylon/lib -L/opt/pylon/genicam/bin/Linux64_x64 -L/opt/pylon/genicam/bin/Linux64_x64/GenApi/Generic -L/opt/pylon/genicam/bin/Linux32_i86 -L/opt/pylon/genicam/bin/Linux32_i86/GenApi/Generic -Wl,-E -o AcquireContinuous AcquireContinuous.o -lpylonbase
Then 1 linker error is coming as:
Code:
/usr/bin/ld: AcquireContinuous.o: undefined reference to symbol 'GenICam::GenericException::what() const'
/usr/bin/ld: note: 'GenICam::GenericException::what() const' is defined in DSO /opt/pylon/genicam/bin/Linux32_i86/libGCBase_gcc40_v2_1.so so try adding it to the linker command line
/opt/pylon/genicam/bin/Linux32_i86/libGCBase_gcc40_v2_1.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [AcquireContinuous] Error 1
I have got many solutions on google,but failed to rectify it.
I am not familiar with LD and linking.
Could someone pl guide step by step for this issue.

using ubuntu 12.04 32 bit
Note: code correctly compiling and linking in RHEL6
 
Old 10-05-2013, 12:52 AM   #2
prkhr4u
LQ Newbie
 
Registered: Oct 2013
Location: Bangalore,India
Distribution: ubuntu 12.04
Posts: 19

Original Poster
Rep: Reputation: Disabled
I contact the camera technical support,they have given me the exact solution but i do not know how to implement this,pl help
Their solution is:
Quote:
It turns out that this problem is caused by changing the Linker behavior in newer Linux distributions, i.e. Ubuntu 11.04 or 11.10, Fedora 13 etc.

That is, up to the above mentioned revisions, the Linker used to search for dependent libraries (indirect linking of shared library symbols) automatically. In the case of pylon, it is the libGCBase_gcc40_v2_1.

However, from e.g. Ubuntu 11.04 on all shared libs must be explicitly added to the command-line compiler flags in order to be found during compilation.

Hence, in this given case, use the following command-line switch:

-lGCBase_gcc40_v2_1

More information on that can be found under:
https://wiki.ubuntu.com/NattyNarwhal...hainTransition
Can someone tell step by step what to do..

The Makefile is like this:
Code:
# Makefile for Basler Pylon sample program
.PHONY			: all clean

# the program to build
NAME			:= AcquireContinuous


# Build tools and flags
CXX			:= /usr/bin/g++
LD			:= /usr/bin/g++
CPPFLAGS		:= -I$(GENICAM_ROOT_V2_1)/library/CPP/include \
			   -I$(PYLON_ROOT)/include -DUSE_GIGE
CXXFLAGS		:=    			#e.g., CXXFLAGS=-g -O0 for debugging

# To keep the makefile for 32 and 64 in sync we add 64 and 32-bit library paths
# If you are targeting only 32 bit for you can remove the entries containing "64"
LDFLAGS			:= -L$(PYLON_ROOT)/lib64 \
			   -L$(PYLON_ROOT)/lib \
			   -L$(GENICAM_ROOT_V2_1)/bin/Linux64_x64 \
			   -L$(GENICAM_ROOT_V2_1)/bin/Linux64_x64/GenApi/Generic \
			   -L$(GENICAM_ROOT_V2_1)/bin/Linux32_i86 \
			   -L$(GENICAM_ROOT_V2_1)/bin/Linux32_i86/GenApi/Generic \
			   -Wl,-E
LIBS			:= -lpylonbase,-lGCBase_gcc40_v2_1

all			: $(NAME)

$(NAME)			: $(NAME).o
	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)

$(NAME).o		: $(NAME).cpp
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<

clean			:
	$(RM) $(NAME).o $(NAME)
 
Old 10-05-2013, 01:50 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by prkhr4u View Post
Can someone tell step by step what to do..

Code:
LIBS			:= -lpylonbase,-lGCBase_gcc40_v2_1
The Makefile already has the solution: they added -lGCBase_gcc40_v2_1 to the list of libraries that is used by the $(LD) command some lines below. I have doubts about the comma as separator (if it doesn't work change it to a blank space. Anyway, it's not clear what Makefile is this? This doesn't seem the one you had when trying make the first time, since in the command line you posted there is only -lpylonbase. If it is a Makefile they provided along with their support, you simply have to substitute the Makefile in the main installation directory and run make again.
 
1 members found this post helpful.
Old 10-05-2013, 04:45 AM   #4
prkhr4u
LQ Newbie
 
Registered: Oct 2013
Location: Bangalore,India
Distribution: ubuntu 12.04
Posts: 19

Original Poster
Rep: Reputation: Disabled
I have added -lGCBase_gcc40_v2_1 after running make.
Anyways I tried a bit,and now i am able to fix the issue.

My resolution was:
$(NAME) : $(NAME).o
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) -lGCBase_gcc40_v2_1

while keeping LLIBS := -lpylonbase

only.

Thanks for the help!!
 
Old 10-05-2013, 05:52 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Well done!
 
Old 10-06-2013, 11:19 PM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
a little fix:

Code:
old: LIBS			:= -lpylonbase,-lGCBase_gcc40_v2_1
new: LIBS			:= -lpylonbase -lGCBase_gcc40_v2_1
 
  


Reply

Tags
linker, make, ubuntu 12.04



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
Make: Building project with different linker and compiler capo Linux - Software 1 06-08-2011 07:32 AM
Static linker with make bertlef Programming 1 10-02-2010 11:00 PM
Linker issues and make dpeterson3 Programming 1 02-11-2010 09:15 PM
make error when compliling courier-authlib-0.55 -- /usr/bin/ld: cannot find -linker j-rus Linux - Software 3 02-11-2010 10:34 AM
[SOLVED] cryptic linker error (i really dont like linker errors); smeezekitty Programming 2 09-19-2009 02:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:43 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