Solved

C program previously compiled on Solaris need to compile on Linux

Posted on 2011-02-22
11
675 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 84 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 83 total points
ID: 34958420
Also change -G to -g
It adds debug symbols.
0
 
LVL 8

Assisted Solution

by:ssnkumar
ssnkumar earned 83 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:Mod_MarlEE
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error creating a new C++ project in ,net 20 55
print bytes of an integer 6 46
visual C++ 1 37
using interface in TLB 3 22
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…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

738 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