Question

I am compiling a program on AIX. It is compiled successfully but gives following warnings:

ld: 0711-224 WARNING: Duplicate symbol: .basename
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

I tried to find this symbol I found in my "common.o" file.

nm -X64 -f common.o | fgrep '.basename'

.basename            T        3776         120

But when find this symbol on executable I find following:

nm -X64 CCF | fgrep '.basename'
.basename            T  4295089984         120
.basename            T  4295174672
.basename            t  4295174672          40
  • Can I display the libraries name that contains this symbol?

  • Does this symbol present in my source file ? (may be sound silly but I do not really know)

I have find the answer to this question that it can be traced in source.

  • What steps should I take to remove this warning? Also does this duplicate symbol can cause application crash? In my case it is crashing.
Was it helpful?

Solution

According to the man page, there are two versions of basename(), one POSIX and one GNU, and it looks like you are linking in both of them. You will need to choose one and suppress the other, depending on your needs. The man page explains how.

Because they behave differently, code that is compiled for one will likely crash when the linker/loader binds it to the other one. If you have a choice of compilers, choosing the non-gcc one might help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top