Conflict type resolution for functions with the same name in two external libraries

I have included the following libraries in my code.

#include <minix/drivers.h> #include <curl/curl.h> #include <sys/stat.h> #include <time.h> #include <assert.h> #include <string.h> 

Now I get the following error:

 In file included from /usr/local/include/curl/curlbuild.h:152 from /usr/local/include/curl/curl.h:34 from xxx.c:2 /usr/pkg/gcc44/lib/gcc/i686-pc-minix/4.4.3/include-fixed/sys/socket.h:134: error: conflicting types for '_send' /usr/include/minix/ipc.h:152: note: previous declaration was here 

As far as I know, this means that _send was declared in two libraries ( minix/drivers.h and curl/curl.h ), I was wondering if this problem can be solved or get around it somehow?

+6
source share
1 answer

Since you are on a mini-server, you can change one (or both) libraries using objcopy . On the man page:

 --redefine-sym old=new Change the name of a symbol old, to new. This can be useful when one is trying link two things together for which you have no source, and there are name collisions. 

or, if you do not need _send from one of the libraries:

 -L symbolname --localize-symbol=symbolname Make symbol symbolname local to the file, so that it is not visible externally. This option may be given more than once. 

Of course, you will need to update the headers accordingly. I would also recommend calling the modified library and headers something else, so it’s clear that you modified them.

+1
source

Source: https://habr.com/ru/post/906345/


All Articles