Search code examples
c++gcclinkerapache-traffic-server

Unable to compile bnull-transform.c - Apache Traffic Server


I am trying to run bnull-transform example of Apache traffic server. After a making few changes which are not present on github version of the code, I was finally able to resolve the errors. But when I compile it using gcc I am getting the below errors -

/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function _start': (.text+0x20): undefined reference tomain' /tmp/cc5gVORu.o: In function my_data_alloc': bnull-transform.c:(.text+0x13): undefined reference to_TSmalloc' /tmp/cc5gVORu.o: In function my_data_destroy': bnull-transform.c:(.text+0x7b): undefined reference toTSIOBufferDestroy' bnull-transform.c:(.text+0x87): undefined reference to _TSfree' /tmp/cc5gVORu.o: In functionhandle_buffering': bnull-transform.c:(.text+0xa8): undefined reference to TSVConnWriteVIOGet' bnull-transform.c:(.text+0xbe): undefined reference toTSIOBufferCreate' bnull-transform.c:(.text+0xe7): undefined reference to _TSAssert' bnull-transform.c:(.text+0xf9): undefined reference toTSIOBufferReaderAlloc' bnull-transform.c:(.text+0x122): undefined reference to _TSAssert' bnull-transform.c:(.text+0x130): undefined reference toTSVIOBufferGet' bnull-transform.c:(.text+0x155): undefined reference to TSVIONTodoGet' bnull-transform.c:(.text+0x16e): undefined reference toTSVIOReaderGet' bnull-transform.c:(.text+0x176): undefined reference to TSIOBufferReaderAvail' bnull-transform.c:(.text+0x19f): undefined reference toTSVIOReaderGet' bnull-transform.c:(.text+0x1bd): undefined reference to TSIOBufferCopy' bnull-transform.c:(.text+0x1cf): undefined reference toTSVIOReaderGet' bnull-transform.c:(.text+0x1da): undefined reference to TSIOBufferReaderConsume' bnull-transform.c:(.text+0x1e6): undefined reference toTSVIONDoneGet' bnull-transform.c:(.text+0x1ff): undefined reference to TSVIONDoneSet' bnull-transform.c:(.text+0x20b): undefined reference toTSVIONTodoGet' bnull-transform.c:(.text+0x222): undefined reference to TSVIOContGet' bnull-transform.c:(.text+0x233): undefined reference toTSContCall' bnull-transform.c:(.text+0x24b): undefined reference to TSVIOContGet' bnull-transform.c:(.text+0x25c): undefined reference toTSContCall' /tmp/cc5gVORu.o: In function handle_output': bnull-transform.c:(.text+0x294): undefined reference toTSTransformOutputVConnGet' bnull-transform.c:(.text+0x2a8): undefined reference to TSIOBufferReaderAvail' bnull-transform.c:(.text+0x2c6): undefined reference toTSVConnWrite' bnull-transform.c:(.text+0x2ef): undefined reference to _TSAssert' /tmp/cc5gVORu.o: In functionhandle_transform': bnull-transform.c:(.text+0x315): undefined reference to TSContDataGet' bnull-transform.c:(.text+0x341): undefined reference toTSContDataSet' /tmp/cc5gVORu.o: In function bnull_transform': bnull-transform.c:(.text+0x3b0): undefined reference toTSVConnClosedGet' bnull-transform.c:(.text+0x3c0): undefined reference to TSContDataGet' bnull-transform.c:(.text+0x3d4): undefined reference toTSContDestroy' bnull-transform.c:(.text+0x3f1): undefined reference to TSVConnWriteVIOGet' bnull-transform.c:(.text+0x401): undefined reference toTSVIOContGet' bnull-transform.c:(.text+0x412): undefined reference to TSContCall' bnull-transform.c:(.text+0x420): undefined reference toTSTransformOutputVConnGet' bnull-transform.c:(.text+0x432): undefined reference to TSVConnShutdown' /tmp/cc5gVORu.o: In functiontransformable': bnull-transform.c:(.text+0x46a): undefined reference to TSHttpTxnServerRespGet' bnull-transform.c:(.text+0x47d): undefined reference toTSHttpHdrStatusGet' bnull-transform.c:(.text+0x49b): undefined reference to TS_NULL_MLOC' bnull-transform.c:(.text+0x4aa): undefined reference toTSHandleMLocRelease' bnull-transform.c:(.text+0x4be): undefined reference to TSError' /tmp/cc5gVORu.o: In functiontransform_add': bnull-transform.c:(.text+0x4e0): undefined reference to TSTransformCreate' bnull-transform.c:(.text+0x4f9): undefined reference toTSHttpTxnHookAdd' /tmp/cc5gVORu.o: In function transform_plugin': bnull-transform.c:(.text+0x54e): undefined reference toTSHttpTxnReenable' /tmp/cc5gVORu.o: In function TSPluginInit': bnull-transform.c:(.text+0x59c): undefined reference toTSPluginRegister' bnull-transform.c:(.text+0x5af): undefined reference to TSError' bnull-transform.c:(.text+0x5bf): undefined reference toTSError' bnull-transform.c:(.text+0x5d2): undefined reference to TSContCreate' bnull-transform.c:(.text+0x5df): undefined reference toTSHttpHookAdd' collect2: ld returned 1 exit status

Please help.


Solution

  • You are trying to compile this plugin (which is a .so) as a standalone app. That won't work. You should use the tsxs script that comes with your ATS installation, e.g.

    tsxs -o null-transform.so null-transform.cc