Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error compiling on c-ares AIX #224

Closed
amandeepgautam opened this issue Oct 1, 2018 · 16 comments
Closed

error compiling on c-ares AIX #224

amandeepgautam opened this issue Oct 1, 2018 · 16 comments

Comments

@amandeepgautam
Copy link

@amandeepgautam amandeepgautam commented Oct 1, 2018

When trying to compile on AIX, I see the following error:

In file included from /tmp/aix_softwares/cares-1.14.0/ares_parse_a_reply.c:34:
/usr/include/arpa/nameser_compat.h:244:3: error: conflicting types for 'HEADER'
 } HEADER;
   ^~~~~~
In file included from /usr/include/arpa/nameser.h:645,
                 from /tmp/aix_softwares/cares-1.14.0/ares_parse_a_reply.c:29:
/usr/include/arpa/onameser_compat.h:265:3: note: previous declaration of 'HEADER' was here
 } HEADER;
   ^~~~~~

To compile, I did the following:

cd /path/to/cmake/source
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/cares ..

Any suggestions on how to solve the problem? I would be willing to send a PR for this, if suggestion is given. Problem seems to be that on AIX both these HEADER is defined in both .h files. Please let me know.

@bradh352
Copy link
Member

@bradh352 bradh352 commented Oct 10, 2018

What version of AIX are you running? What version of c-ares are you testing (e.g. official 1.14.0 release, git master, etc)?

In my AIX version, at the top of nameser.h is a #define BIND_4_COMPAT which causes nameser_compat.h to be included if _USE_IRS is also defined. That said, I don't see anything setting _USE_IRS so onameser_compat.h would be included.

#ifdef _USE_IRS
#ifdef BIND_4_COMPAT
#include <arpa/nameser_compat.h>
#endif /* BIND_4_COMPAT */
#else /* _USE_IRS */
#include <arpa/onameser_compat.h>
#endif /* _USE_IRS */

So if things have changed on more recent versions of AIX we'd need to know how. Its possible it simply isn't appropriate to include arpa/nameser_compat.h manually any longer on AIX. Either that or previously we really should have just done
#define _USE_IRS
rather than manually including nameser_compat.h.

@amandeepgautam
Copy link
Author

@amandeepgautam amandeepgautam commented Oct 10, 2018

I am using AIX 7200-01-03-1720 and official release 1.14.0 release.
Following is how the two files look on this versions of AIX:
https://pastebin.com/c9VZPwGn
https://pastebin.com/WcjMnffk

@bradh352
Copy link
Member

@bradh352 bradh352 commented Oct 10, 2018

basically looks the same, not sure why I'm not seeing that same issue on AIX 5. I really think the solution is to set _USE_IRS on AIX. I wonder if autotools doesn't already set that flag and its just something we ned to add to cmake.

@amandeepgautam
Copy link
Author

@amandeepgautam amandeepgautam commented Oct 12, 2018

@bradh352 I am very unfamiliar with the code base but if you could explain in more detail, i could give it a try and test it.

bradh352 added a commit that referenced this issue Oct 12, 2018
AIX attempts to include both nameser_compat.h and onameser_compat.h.  It appears
the proper fix is to define _USE_IRS so that only nameser_compat.h is used.

Bug: #224
Fix By: Brad House (@bradh352)
@bradh352
Copy link
Member

@bradh352 bradh352 commented Oct 12, 2018

If you try the current git master, I've made the change for the CMakeLists.txt to define _USE_IRS on AIX.

@amandeepgautam
Copy link
Author

@amandeepgautam amandeepgautam commented Oct 13, 2018

@bradh352 yes that compiles. Thanks for fixing this.
However, it only generates 32-bit lib? How could we generate 64-bit libs?

@bradh352
Copy link
Member

@bradh352 bradh352 commented Oct 15, 2018

That's just whatever your compiler and tools default to. No build system ever builds both 32bit and 64bit.

From what I recall though, on AIX, pretty much everything honors the OBJECT_MODE environment variable and the valid values are/were 32 or 64.

@bradh352 bradh352 closed this Oct 23, 2018
DronRathore added a commit to DronRathore/c-ares that referenced this issue Mar 11, 2020
AIX attempts to include both nameser_compat.h and onameser_compat.h.  It appears
the proper fix is to define _USE_IRS so that only nameser_compat.h is used.

Bug: c-ares#224
Fix By: Brad House (@bradh352)
@anshul-j
Copy link

@anshul-j anshul-j commented Nov 9, 2020

Hi
I am using the c-ares 1.14.0 library on AIX and using the below command to build the libcares.a
./configure --prefix=/usr
make)
Now i am trying to use this library with my application executable but While linking i am getting the below errors

[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_inet_pton
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_init_options
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_strerror
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_query
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_cancel
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_destroy
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_fds
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_process
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_expand_name
[00:49:11]W: [install] ld: 0711-317 ERROR: Undefined symbol: .ares_free_string
[00:49:11]W: [install] ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
[00:49:11]W: [install] collect2: error: ld returned 8 exit status

Please help here.

Thanks
Anshul Jain

@dfandrich
Copy link
Collaborator

@dfandrich dfandrich commented Nov 9, 2020

@anshul-j
Copy link

@anshul-j anshul-j commented Nov 9, 2020

c-ares 1.14.0 version was released on 16-feb-2018.This is working fine for windows and linux but for aix i am getting above mentioned errors. According to you, it is c-ares verison related issue or AIX version related issue ?
Please confirm.

@dfandrich
Copy link
Collaborator

@dfandrich dfandrich commented Nov 9, 2020

@anshul-j
Copy link

@anshul-j anshul-j commented Nov 9, 2020

I tried with c-ares 1.15.0 version.Getting the below errors after running the make command

$ make
make all-recursive
CC ahost-ahost.o
CC ahost-ares_getopt.o
CC ahost-ares_nowarn.o
CC ahost-ares_strcasecmp.o
make: Cannot find a rule to create target ./libcares.la from dependencies.
Stop.
make: The error code from the last command is 1.

Stop.
make: The error code from the last command is 2.

@bagder
Copy link
Member

@bagder bagder commented Nov 9, 2020

@anshul-j why 1.15.0? The latest release is 1.16.1!

@anshul-j
Copy link

@anshul-j anshul-j commented Nov 9, 2020

I have tried compiling c-ares 1.16.1 also. getting the similar errors as c-ares 1.15.0

$ make
make all-recursive
CC ahost-ahost.o
CC ahost-ares_getopt.o
CC ahost-ares_nowarn.o
CC ahost-ares_strcasecmp.o
make: Cannot find a rule to create target ./libcares.la from dependencies.
Stop.
make: The error code from the last command is 1.
Stop.
make: The error code from the last command is 2.

@dfandrich
Copy link
Collaborator

@dfandrich dfandrich commented Nov 9, 2020

@anshul-j
Copy link

@anshul-j anshul-j commented Nov 9, 2020

i have opened a new bug 369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants