Error in compilation of asterisk

Hello everyone.
I Hope you are all doing fine. I am trying to compile the asterisk for past few days. My setup is Centos 7 minimal with kernel 5.14. I tried to update everything. Installed new packages nothing seems to be working.

I am facing this issue. I tried to add lresolv lpthread and other libraries in:

  1. Configuration command ./config LDFLAG… and ASTLDFLAG=…
  2. in make file same as above.

What to do now how to resolve this.

Thanks everyone in advance.

Have you run ./contrib/scripts/install_prereq? Once that’s completed, a simple ./configure followed my make should compile Asterisk with no issues. When you have a successful compile, you can add options to configure like --prefix=/usr to control installation location.

If it still fails, you need to provide the exact commands you’re issuing and the full output.

for doing it for last few days I memorized everything :wink:

I did yum update at beginning.

First I un-tar the package then install all preqs using script located in contrib/scripts (mainly pjsip and jansson lib)

then I did ./configure --with libjansson. Although I added few arguments like --lib=/usr/lib64 LDFLAGS=-pg CFLAGS=-pg ASTLDFLAGS=“-lresolv -lpthread” etc.

then make menuselect gives me UI for selecting the modules for installation. For last time I unselected pjsip_resolver and in TEST I unselect all tests which are related to DNS.

then Finally I did “make”. after sometime it shows the screen which is attached in question.

What I observed that I faced the same issue in asterisk 16, 20 and 22-current. the same error when I make.

thank you for your time. Any help or suggestion is welcome.

I don’t understand. Why are you adding CFLAGS, LDFLAGS and ASTLDFLAGS? Why and how are you unselecting pjsip_resolver? You should not have to any of that. What is your objective here?

Just run…

$ ./configure --prefix=/usr --libdir=/usr/lib64
$ make

and see if you get a good compile.

Hi @gjoseph
thank you for your timely response. I unselect the pjsip stuff from make menuselect GUI. I deselected everything related to DNS.
I tried to compile the asterisk 16 and 22-current with it removed everything else except --withjansons but I am still getting the same error dn_expand res_search.
My setup is centos 7 minimal with kernal 5.5.
The command just before the error has -lresolv -lpthread by default. but unable to get pass the error.
thank you in advance.

please, please, please…
Run the exact commands I give you and nothing else. Do NOT deselect anything in menuselect or make any other changes.

Start in a clean checkout of asterisk from github.

$ git clone https://github.com/asterisk/asterisk.git ./asterisk-clean
$ cd asterisk-clean
$ git checkout releases/22
$ sudo ./contrib/scripts/install_prereq install
$ ./configure --prefix=/usr --libdir=/usr/lib64 --with-jansson-bundled --with-pjproject-bundled --with-libjwt-bundled
$ make

I just tried this in a CentOS 7 container and it worked fine.

You may see warnings during the build but they’re OK. If anything goes wrong, you MUST copy the exact commands and output from the terminal and paste it here. I can’t help if you don’t show me exactly what you’ve done and the exact errors.

2 Likes

I ran following command and face same error of dn_expand and res_search.

sudo ./contrib/scripts/install_prereq install
$ ./configure --prefix=/usr --libdir=/usr/lib64 --with-jansson-bundled --with-pjproject-bundled --with-libjwt-bundled

$ make

As usual it just unable to go beyond this step. The error: undefined reference to dn_expand and res_search which occurred in function "ebl_callback parse_naptr dns_naptr_alloc dns_srv_alloc parae_srv ".

What should I do to fix these?

Thank you for your help.

PS: Unable to attach more than 1 media items in post

You should be posting these as plain text, which you should mark up as preformatted text, which will have the added benefit that things that look like URIs won’t be counted as attempts to create links.

It looks like you’re missing the glibc-devel package.
yum install glibc-devel

Thank you @gjoseph

I did yum install glibc but it was already installed as shown below.

Can you please specify the exact version required of glibc-devel which was required for compilation?

I have glibc 2.34 version. (Checked through ldd–version). And glibc-devel version 2.17-236 (rpm -q glibc-devel)

Thank you once again for your help.

Please use plain text, not images.

Your question is for your OS supplier, but I can be pretty confident that the package name will start with glibc-devel-2.34-…

@david551 thank you for suggestion about image.

Can you point me in right direction?

Thank you in advance.

The version on -devel packages should exactly match that of the package proper, that is currently installed.

I did

rpm -qa | grep glibc

Glibc package list was shown which has 2.17 version whereas the devel package has same version (2.17).

Sorry for posting image. The result of above command is as follow

Thanks for your help.

Why did you say this? This says the version being used 2.34.

When I do

ldd --version

it shows 2.34.

ldd is provided by glibc-common which looks like it’s at 2.17. If ldd --version shows 2.34 then your system is not in a consistent state. Did you try to compile and install glibc from source at some time? If so, you need to back that out and do a yum reinstall on all of the glibc packages.

Thank you thank you so much for pointing that out.

Do I need to recompile the glibc ? or just do

yum reinstall glibc

Thanks once again.

I have no idea what state your system is in so it’s hard to advise. If this is a virtual machine or a Docker container, I suggest you delete it and start over. Otherwise… Did you in fact compile and install your own glibc? If so, what prefix did you install it to? /usr, /usr/local, somewhere else? If you installed it to /usr over the 2.17 installation, don’t remove it or your system may become unusable, just do the yum reinstall for the glibc 2.17 packages. If you installed it to /usr/local, you need to remove all traces of it from there. If you still have the glibc source directory where you built it from, you can do a make uninstall there and it should remove all traces of it from whatever directory you specified for --prefix and/or --libdir when you ran ./configure. If you look at the end of config.log you can confirm what libdir and prefix were set to.

@gjoseph thank you for detailed explanation.
For now I’m able to install it using t

Tucny

I have added tucny repo in yum. And one by one I enabled them. And finally I did

Yum install asterisk

So far asterisk 19 was successfully installed.
I really appreciate your effort.
Also I am working on physical computer. I will update you after trying the solution.

Thank you once again.