Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C program previously compiled on Solaris need to compile on Linux

Posted on 2011-02-22
11
Medium Priority
?
689 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 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
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.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

650 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