Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

SOLVED
Go to solution
Prabha (SunTec)
Occasional Advisor

Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

During runtime, one of the executables which refers to a internally built shared library is giving error "dlsym: Unknown symbol dlsetnonuniqsymflag" .

Not sure if the shared library is using this symbol. but in the linked symbols of the shared library (ld +vtype symbols) shows

/usr/lib/hpux64/libdl.so.1:
dlgetmodinfo is DEFINED GLOBAL FUNC
memcpy is UNDEF GLOBAL FUNC
dlsetnonuniqsymflag is DEFINED GLOBAL FUNC

but the above said error is raised when tried load the DLL from another gcc compiled executable using dlopen (sl_name, RLTD_NOW)

h/w details
HP-UX B.11.31 U ia64

$ gcc -v
Using built-in specs.
Target: ia64-hp-hpux11.31
Configured with: ../gcc/configure
Thread model: posix
gcc version 4.2.1

all the library paths are included in LD_LIBRARY_PATH (inc. /usr/lib/hpux64/)

$ file /usr/local/bin/gcc
/usr/local/bin/gcc: ELF-32 executable object file - IA64

we applied the Patch PHSS_37493 (ftp + linker cumulative patch for 11.31) as said in (http://forums11.itrc.hp.com/service/forums/questionanswer.do;HP-FORUMS-S-WPA-IDX=HmcQSRtXrqvfsKVYpJTWzzvQPfcrx2ghD2C2pxP2S29L1CXDKyKQ!1521457198!2088606787?threadId=1114372) . but it didnt resolve the issue.

can any1 help!!!!
6 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

>Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

If you get this you are illegally calling dlerror(3). You can't call this unless you get an error. Otherwise you get this left over message from libCsup, when it called dlsym(3).

Hmm, I see you are pointing to that previous instance of this symbol. I'm not sure how that other problem was resolved and why it didn't work for you.

What does your code look like that is calling dlopen(3)?
Prabha (SunTec)
Occasional Advisor

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

our code is like

pHandle = dlopen(szDllName, RTLD_NOW);
szLoadErr = dlerror();

if (szLoadErr!= NULL)
{
printf("\n Error while linking DLL ::%s\n",szLoadErr);
return( T_FAILURE );
}
Dennis Handly
Acclaimed Contributor
Solution

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

>our code is like
pHandle = dlopen(szDllName, RTLD_NOW);
szLoadErr = dlerror();
if (szLoadErr!= NULL) {
printf("\n Error while linking DLL::%s\n",szLoadErr);

Ah, this is the broken linux? coding style of checking dlerror(3) that I have seen before. You need to check pHandle for the error, not dlerror(3). See:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1147411

if (pHandle == NULL) {
szLoadErr = dlerror();
printf("Error while linking DLL: %s\n",szLoadErr);
Prabha (SunTec)
Occasional Advisor

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

Thanks for the clarification Dennis.

Issue is solved by clearing the error variable before dlopen call. we are yet to check which code originally raised this error.
Dennis Handly
Acclaimed Contributor

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

>Issue is solved by clearing the error variable before dlopen call.

That would not be my recommendation. You should only call dlerror(3) if you have an error return from a dl* function.

>we are yet to check which code originally raised this error.

I told you, libCsup, by design. You could also get similar bogus errors from setlocale(3).
Prabha (SunTec)
Occasional Advisor

Re: Error while linking DLL : dlsym: Unknown symbol dlsetnonuniqsymflag

OK. I will check and get back.