[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C program previously compiled on Solaris need to compile on Linux

Posted on 2011-02-22
11
Medium Priority
?
696 Views
Last Modified: 2012-05-11
First let me preface this question and say that I am not a C programmer.  Never have been.  Code PERL, vbscript, & ASP well tho.  Have a situation where we are moving from Solaris to Linux and have a custom shared object that I cannot get to compile on Linux.  I've resolved all of the *.h file dependency error message, etc but now when I type "make" I receive the following and really don't know where to start troubleshooting...  Old system was Solaris 8 64-bit.  New System is ReHat x86_64-bit .  Please see output below.  Am looking for guidance to resolve the errors during compile.  I'm using the mozldap SDK and those functions '`ldap_init', etc should be in there.  I have setup my LD_LIBRARY_PATH and also the PATH variable to include all locations where the sdk files exist.   thanks for your time!

# make
/usr/bin/gcc -DLINUX -D_REENTRANT -I. -c getrpw.cpp
/usr/bin/gcc -DLINUX -D_REENTRANT -G getrpw.o -o libgetrpw.so
gcc: unrecognized option '-G'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
getrpw.o: In function `getUserContext':
getrpw.cpp:(.text+0x99a): undefined reference to `ldap_init'
getrpw.cpp:(.text+0x9f0): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xa14): undefined reference to `ldap_set_option'
getrpw.cpp:(.text+0xa59): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xa7d): undefined reference to `ldap_set_option'
getrpw.cpp:(.text+0xac2): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xae4): undefined reference to `ldap_simple_bind_s'
getrpw.cpp:(.text+0xaf5): undefined reference to `ldap_err2string'
getrpw.cpp:(.text+0xb46): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xbe7): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xc71): undefined reference to `ldap_search_ext_s'
getrpw.cpp:(.text+0xcc4): undefined reference to `ldap_err2string'
getrpw.cpp:(.text+0xd10): undefined reference to `ldap_msgfree'
getrpw.cpp:(.text+0xd19): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xd35): undefined reference to `ldap_count_entries'
getrpw.cpp:(.text+0xd4f): undefined reference to `ldap_first_entry'
getrpw.cpp:(.text+0xd64): undefined reference to `ldap_first_attribute'
getrpw.cpp:(.text+0xd79): undefined reference to `ldap_get_values'
getrpw.cpp:(.text+0xe1f): undefined reference to `ldap_value_free'
getrpw.cpp:(.text+0xe36): undefined reference to `ldap_ber_free'
getrpw.cpp:(.text+0xe3f): undefined reference to `ldap_memfree'
getrpw.cpp:(.text+0xe51): undefined reference to `ldap_msgfree'
getrpw.cpp:(.text+0xe5a): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xe82): undefined reference to `ldap_value_free'
getrpw.cpp:(.text+0xedb): undefined reference to `ldap_value_free'
getrpw.cpp:(.text+0xef2): undefined reference to `ldap_ber_free'
getrpw.cpp:(.text+0xefb): undefined reference to `ldap_memfree'
getrpw.cpp:(.text+0xf0d): undefined reference to `ldap_msgfree'
getrpw.cpp:(.text+0xf16): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xf33): undefined reference to `ldap_ber_free'
getrpw.cpp:(.text+0xf3c): undefined reference to `ldap_memfree'
getrpw.cpp:(.text+0xf4e): undefined reference to `ldap_msgfree'
getrpw.cpp:(.text+0xf57): undefined reference to `ldap_unbind'
getrpw.cpp:(.text+0xfed): undefined reference to `ldap_msgfree'
getrpw.cpp:(.text+0xff6): undefined reference to `ldap_unbind'
getrpw.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [libgetrpw.so] Error 1
0
Comment
Question by:jdissupport
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 336 total points
ID: 34953977
Seems like your missing the LDAP library - try adding '-lldap' to your linker switches.
0
 
LVL 11

Assisted Solution

by:cup
cup earned 332 total points
ID: 34958420
Also change -G to -g
It adds debug symbols.
0
 
LVL 8

Assisted Solution

by:ssnkumar
ssnkumar earned 332 total points
ID: 34968531
Your compilation command is:
/usr/bin/gcc -DLINUX -D_REENTRANT -I. -c getrpw.cpp

From the filename getrpw.cpp, I assume that, you have a C++ code.
So, try to compile using g++ instead of gcc.

And look at this error:
(.text+0x20): undefined reference to `main'
If you are using main() function in right way, you should not get this error.

Also, you should compile with correct library and use -lldap as somebody already pointed out.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:ssnkumar
ID: 35704747
Dhaest,

I feel that the, answers given were practical.
So, it will not be fair to just delete the question.
0
 
LVL 8

Expert Comment

by:ssnkumar
ID: 35704759
I added a comment.
Instead of pressing "Submit", I pressed "Object".
I didn't know that "Object" will remove the "Deletion Pending".
I didn't intend to do that and apologies for any problems that might create.
0
 
LVL 8

Expert Comment

by:ssnkumar
ID: 35712312
My recommendation is 3.
Accept http:#34953977, http:#34958420 and http:#34968531 as answers.
0
 

Expert Comment

by:Robert Marley
ID: 35767645
Starting the auto-close procedure on behalf of the Question Author, to implement the recommendations from the participating Expert(s).


-----
Everyt'ing is everyt'ing,

Mod_MarlEE
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question