Compiling token bank fails with error

Hello Mr. Chang

I was trying to practice the geospatial_search graph scenarios. I followed all the steps mentioned on github for setting up the environment.

Please follow the steps to install.

  1. Import the solution.tar.gz from your GraphStudio.

  2. Copy or merge ExprUtil.hpp and ExprFunctions.hpp to ~/tigergraph/dev/gdk/gsql/src/QueryUdf/

  3. Copy or merge TokenBank.cpp to ~/tigergraph/dev/gdk/gsql/src/TokenBank/

  4. Copy data under data/ to ~/tigergraph/loadingData/

  5. Run loading from GraphStudio.

  6. Run loader.gsql by using command gsql -g MyGraph loader.gsql

  7. Install queries in Write Queries page of GraphStudio.

  8. Follow the instructions under geospatial_ui folder to deploy the geo spatial demo UI.

At step 6, when i tried to run the loader job script from command line, I faced below issue
"Compiling token bank fails with error
The job loadGeo could not be created!
"

Can you help me how to compile the tokenBank.cpp is it the root cause?

appreciate your help in this regard.

thank you.
Khan

Sure, we will try to reproduce this internally and get back to you.

Thanks.

Hi Khan,

We were unable to reproduce this issue, but it may be due to a problem with step 2 or 3. If you didn’t replace the files and tried to manually merge the code, there could be formatting issues and or missing lines. Please double check that these two steps are correct.

Thanks,

Kevin Cai

Thank you Kevin. Although, I redo the activity by copied and replaced the mentioned files at their correct locations as were mentioned in step 2 and 3. I still have the same issue. just to add more information here. I tried to run the content of compile file manually as

g++ -fPIC -I…/TokenLib -shared “./TokenBank.cpp” “…/TokenLib/TokenLib.cpp” -o “/tmp/TokenBank.so”

although g++ compiler is installed, I got the following error.

Command ‘g++’ not found, but can be installed with:

could this be the reason behing?

Hi Khan,

Could we have an online session to find the root cause? Please send over some time slots when you are available and we can schedule something. Thanks.

Hi Khan,

Could you please try this command : source ~/.bash_tigergraph

If problems persist after this command, we can set something up for Friday (possible 4:00 pm GMT).

Thanks,

Kevin

Hi,

Was there a resolution for this? As I am experiencing the exact same issue.

I’m using the Dev version and have followed the instructions, including running source ~/.bash_tigergraph but I still cannot get this demo working or compile anything. Even followed https://docs.tigergraph.com/dev/gsql-ref/querying/operators-functions-and-expressions#user-defined-functions

Thanks

Frank

Hi Frank,

Usually, it is the C++ code in the TokenBank.hpp if you have add any customized code.

Could you check your GSQL_LOG to confirm what is the compile error?

You can find GSQL_LOG by running command gadmin log gsql

Thanks.

Hi,

Thanks for your response. I haven’t customized any of the code. I’m just trying to run the geo demo. I get an error when running the loading job. It doesn’t recognise getGridId, so I thought I needed to compile the code but I’m unable to get it to compile. I have run source. ~/.bash_tigergraph

This is a section of the log

[INFO] Start loading /home/tigergraph/tigergraph/loadingData/ca_postcode.csv, LineBatch = 1024, LineOffset = 1, ByteOffset = 72
E0314 03:50:53.765760 11905 ioutil.cpp:201] [ERROR] LoadingCallback response: {“version”:{“edition”:“developer”,“api”:“v2”,“schema”:0},“error”:true,“message”:"/home/tigergraph/tigergraph/bin/TokenBank.so_REST
PP-LOADER_1_1_w0_h1.dir/1584157853763: undefined symbol: getGridId false\n@void* gse2::GSE_GENERIC_LOADER_UTILITY<reader, writer, buffer>::loadFuncP(const string&) [with reader = restpp::PostReader; writer =
topology4::PostWriter; buffer = gse2::GSE_DELTA_BUFFER; std::string = std::basic_string](/opt/builder/workbench/buildcentos652/192.168.11.118/tg_2.5.3_dev/product/src/core/gse/gse2/loader/generic_loader
_utility.hpp:3732)\n\nMyGraph_loadGeo for Graph ‘MyGraph’.",“code”:“REST-30000”}
E0314 03:50:53.765874 11907 ioutil.cpp:201] [ERROR] LoadingCallback response: {“version”:{“edition”:“developer”,“api”:“v2”,“schema”:0},“error”:true,“message”:"/home/tigergraph/tigergraph/bin/TokenBank.so_REST
PP-LOADER_1_1_w0_h2.dir/1584157853763: undefined symbol: getGridId false\n@void* gse2::GSE_GENERIC_LOADER_UTILITY<reader, writer, buffer>::loadFuncP(const string&) [with reader = restpp::PostReader; writer =
topology4::PostWriter; buffer = gse2::GSE_DELTA_BUFFER; std::string = std::basic_string](/opt/builder/workbench/buildcentos652/192.168.11.118/tg_2.5.3_dev/product/src/core/gse/gse2/loader/generic_loader
_utility.hpp:3732)\n\nMyGraph_loadGeo for Graph ‘MyGraph’.",“code”:“REST-30000”}
E0314 03:50:53.766016 11903 ioutil.cpp:201] [ERROR] LoadingCallback response: {“version”:{“edition”:“developer”,“api”:“v2”,“schema”:0},“error”:true,“message”:"/home/tigergraph/tigergraph/bin/TokenBank.so_REST
PP-LOADER_1_1_w0_h0.dir/1584157853763: undefined symbol: getGridId false\n@void* gse2::GSE_GENERIC_LOADER_UTILITY<reader, writer, buffer>::loadFuncP(const string&) [with reader = restpp::PostReader; writer =
topology4::PostWriter; buffer = gse2::GSE_DELTA_BUFFER; std::string = std::basic_string](/opt/builder/workbench/buildcentos652/192.168.11.118/tg_2.5.3_dev/product/src/core/gse/gse2/loader/generic_loader
_utility.hpp:3732)\n\nMyGraph_loadGeo for Graph ‘MyGraph’.",“code”:“REST-30000”}
Opening TokenBank.so
Opening TokenBank.so
Opening TokenBank.so

I can post a full log if you need it.

I tried this as well

tigergraph@d8772f961f41:~/tigergraph/dev/gdk/gsql/src/TokenBank$ g++ TokenBank.cpp
In file included from /home/tigergraph/.syspre/usr/include/stdio.h:27:0,
from TokenBank.cpp:78:
/home/tigergraph/.syspre/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

include <sys/cdefs.h>

                     ^

compilation terminated.

And this

tigergraph@d8772f961f41:~/tigergraph/dev/gdk/gsql/src/TokenBank$ ./compile
In file included from /home/tigergraph/.syspre/usr/include/stdio.h:27:0,
from ./TokenBank.cpp:78:
/home/tigergraph/.syspre/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

include <sys/cdefs.h>

                     ^

compilation terminated.
In file included from /home/tigergraph/.syspre/usr/include/stdio.h:27:0,
from …/TokenLib/TokenLib.hpp:77,
from …/TokenLib/TokenLib.cpp:77:
/home/tigergraph/.syspre/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

include <sys/cdefs.h>

                     ^

compilation terminated.

But no luck

So to recap:
I installed a fresh Dev version of TigerGraph
I followed the instructions in the repo
but can not get past the loading of the edges as the getGridId is ‘undefined’

Thanks
Frank

I have resolved the issue. Part of the problem was that g++ was too old.

Steps to resolve the issue (not too sure if this was the correct way to solve it but anyhow)

I used the docker version. From within the container run

source ~/.bash_tigergraph
sudo apt-get update
sudo apt-get install build-essential

update the `TokenBank/compile file to

#!/bin/sh

/usr/bin/g++ -std=c++11 -fPIC -Wall -Wextra -I/home/tigergraph/tigergraph/.syspre/usr/include/x86_64-linux-gnu -I/home/tigergraph/tigergraph/dev/gdk/gsdk/include/thirdparty -I/home/tigergraph/tigergraph/dev/gdk/gsdk/include -I…/TokenLib -shared “./TokenBank.cpp” “…/TokenLib/TokenLib.cpp” -o “/tmp/TokenBank.so”

I am sure someone will be able to streamline the above, I’m not a c++ person, so please feel free to let me know if there is a better way.

Hopefully, everything should work from then on.

Thanks
Frank

For anyone having trouble compiling TokenBank.cpp and/or the testing code for UDFs (in tigergraph/dev/gdk/gsql/src/QueryUdf/test), this is what I had to do:

System: Ubuntu 18 (server version, default g++ is v7.5)

‘apt install g+±4.8’ - the libraries in ~/.syspre/… look to be all g++/c++ 4.8 related. Installing a copy of g++4.8 prevents the need to run .bash_tigergraph or modify system library paths and etc - the version of the g++ compiler should work all that out properly.

in ‘compile’ in QueryUdf/test:

change g++ to 'g+±4.8 -v -fPIC -Wall -Wextra ’ (will show config info and extra warning messages for debugging path problems)

change ‘third_party’ to ‘thirdparty’ ** important

a.out should be created and run successfully

in ‘compile’ for TokenBank

'g+±4.8 -std=c++11 -v -fPIC -I/home/tigergraph/tigergraph/dev/gdk/gsdk/include/thirdparty -I/home/tigergraph/tigergraph/dev/gdk/gsdk/include -I…/TokenLib -shared “./TokenBank.cpp” “…/TokenLib/TokenLib.cpp” -o “/tmp/TokenBank.so”

I have not yet tested TokenBank.so bu my functions in ExprFunctions.hpp work

Doug

1 Like