Bug #70759 NDB API Example programs do not compile
Submitted: 29 Oct 2013 2:10 Modified: 19 Dec 2013 12:59
Reporter: Jesper wisborg Krogh Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S3 (Non-critical)
Version:7.2.13 OS:Any
Assigned to: CPU Architecture:Any

[29 Oct 2013 2:10] Jesper wisborg Krogh
Description:
Trying to compile the NDB API example programs fail as they do not include all the necessary system libraries.

How to repeat:
For example compiling ndbapi_event.cpp:

g++ -o ndbapi_event  -I/MySQL/Cluster-7.2.13/include  -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -I/home/MySQL/Cluster-7.2.13/include/storage/ndb -I/MySQL/Cluster-7.2.13/include/storage/ndb/ndbapi -I/MySQL/Cluster-7.2.13/include/storage/ndb/mgmapi  -L/MySQL/Cluster-7.2.13/lib -lmysqlclient_r -lpthread -lm -lrt -ldl -lndbclient ndbapi_event.cpp
ndbapi_event.cpp: In function ‘int main(int, char**)’:
ndbapi_event.cpp:124: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:127: error: ‘atoi’ was not declared in this scope
ndbapi_event.cpp:129: error: ‘strchr’ was not declared in this scope
ndbapi_event.cpp:146: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:152: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:158: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:164: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:196: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:217: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:241: error: ‘abort’ was not declared in this scope
ndbapi_event.cpp:269: error: ‘memset’ was not declared in this scope
ndbapi_event.cpp:300: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:308: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:310: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp: In function ‘int myCreateEvent(Ndb*, const char*, const char*, const char**, int, bool)’:
ndbapi_event.cpp:327: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:330: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:348: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:351: error: ‘exit’ was not declared in this scope
ndbapi_event.cpp:353: error: ‘exit’ was not declared in this scope

Suggested fix:
Add necessary include files to the source. E.g. for ndbapi_event.cpp:

#include <stdlib.h>
#include <string.h>
[19 Dec 2013 12:58] Magnus Blåudd
Pushed fixes with additional include file directives and some adjustments of the Makefiles to 7.2.15 and 7.3.4
[19 Dec 2013 12:59] Magnus Blåudd
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[15 Jan 2014 7:38] Jon Stephens
Documented in the NDB 7.2.15 and 7.3.4 changelogs as follows:

        Compilation of example NDB API program files failed due to
        missing include directives.