[ZBX-8658] Some fixes/improvements for m4 scripts Created: 2014 Aug 25  Updated: 2017 May 30  Resolved: 2014 Sep 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I)
Affects Version/s: 2.2.5, 2.3.3
Fix Version/s: 2.5.0

Type: Incident report Priority: Minor
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: compilation, regression, sqlite
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File better_unixodbc_m4_code.patch     Text File no_sqlite3_open_v2_error.patch    

 Comments   
Comment by Oleksii Zagorskyi [ 2014 Aug 25 ]

(1) Better code readability.

In r29768 when fixing ZBX-5386 dimir did a change after which libunixodbc.m4 looks strange.
He did it because of, svn log:

...
Also this fix improves configure check for unixODBC. Some GNU/Linux distributions have unixODBC packages without odbc_config binary, that you can use to get things needed to add support for unixODBC to your application. Before this fix when building Zabbix server with unixODBC support if odbc_config binary was missing configure would result in an error. This has been changed so that if odbc_config is missing we continue without additional CFLAGS and LDFLAGS with just additional -lodbc. On a Debian 6.0 this allowed successful compilation.

That's very good in general (I recall time when I had to compile odbc_config from sources), but currently the script looks strange and misleads - it happened with me.
Suggested patch improves it I believe.
I tested it.

<dimir> Thanks for the patch. There were 2 checks, odbc library availability and ability to compile a sample program. The first check wasn't working so I have fixed it and removed the second check (r48891).

CLOSED

Comment by Oleksii Zagorskyi [ 2014 Aug 25 ]

(2) Small regression, which is not critical but may be suspicious and take extra time to understand what is it -> need to fix.

Configure script for function sqlite3_open_v2 check returns "no" after r25067 (ZBX-4535).

./configure --enable-proxy --with-sqlite3
...
checking for SQLite3 library >= 3.0.0... yes
checking for function sqlite3_open_v2() in sqlite3.h... no
checking for Zabbix server/proxy database selection... ok
...
... Finished successfully.

In config.log we see that "-lsqlite3" not passed to gcc, so ld exited with 1:

configure:8814: checking for function sqlite3_open_v2() in sqlite3.h
configure:8829: gcc -o conftest -g -O2  -I/usr/include -L/usr/lib -rdynamic  conftest.c -lm -ldl  -lresolv >&5
/tmp/ccgh8OWN.o: In function `main':
/zab/zabbix-2.2/conftest.c:123: undefined reference to `sqlite3_open_v2'
collect2: error: ld returned 1 exit status

Suggested patch fixes it, tested, as well.

I reviewed other similar changes in m4 scripts and they are fine - no similar AC_TRY_LINK macro usage and similar produced warnings.

<dimir> Correct fix, thanks. Changed a bit in r48891.

CLOSED

Comment by Juris Miščenko (Inactive) [ 2014 Sep 01 ]

The patches have been applied to a development branch located at svn://svn.zabbix.com/branches/dev/ZBX-8658

Comment by dimir [ 2014 Sep 09 ]

Successfully tested. Please review my changes in r48880, r48891.

Comment by dimir [ 2014 Sep 09 ]

With fix for SQLite check for function sqlite3_open_v2() there comes one change. Previously in order to open connection to the database sqlite3_open() function was always used. After the fix sqlite3_open_v2() is used if available.

Whether we use one or another of the functions shouldn't be affecting the way we open a connection to the database according to:

http://www.sqlite.org/c3ref/open.html

Comment by Juris Miščenko (Inactive) [ 2014 Sep 15 ]

Changes merged in 2.5.0 (trunk) at r48982.

Generated at Tue Apr 16 23:51:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.