thomasmoelhave / tpie

Templated Portable I/O Environment
Other
112 stars 24 forks source link

tpie reference not found #234

Closed gijsde1ste closed 4 years ago

gijsde1ste commented 4 years ago

I've ran into versioning incompatibilities with the current version of TPIE and boost, therefore I've chosen to compile TPIE using the steps as outlined here https://travis-ci.org/github/thomasmoelhave/tpie/jobs/349244876 . Keeping all the versions the same as that example it compiles succesfully and the unit tests run perfectly. However whenever I attempt to run the example project or any other simple project that includes tpie I run into reference not found errors.

First attempts lead to simple errors such as Snappy not being included and undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line that is easily fixed by including lpthread

After these fixes I get reference not found errors everywhere tpie is used, even though tpie seems to be linked correctly according to the attached debug.log that is generated using:"

g++-4.8 helloworld.cpp -L/home/gijs/Documents/Thesis/thomasmoelhave/tpie/build/tpie -ltpie -lboost_system -lboost_filesystem -lboost_date_time -lboost_thread -lpthread -lsnappy -Wl,--verbose

Where the -L parameter is the correct folder where libtpie.a is located

Debug.log

I'm stuck at this point so any help or indication where to look would be greatly appreciated. @Mortal

Mortal commented 4 years ago

Hi @gijsde1ste, thanks for your email and for moving to this issue tracker.

It looks like it finds libtpie.a, but refuses to link against its symbols. Have you tried moving the command-line argument helloworld.cpp to the end of the invocation of g++?

I think it's generally not a good idea to try to use g++ directly - it would be more robust to use CMake, which TPIE also uses itself and is used when integrating TPIE into other large codebases.

I recently prepared an example project at https://github.com/Mortal/tpieex that contains a TPIE hello world program and uses CMake. Please refer to the first line in the CMakeLists.txt in that repository to see how I would integrate with TPIE. Let me know if it works for you or if it gives more problems.

gijsde1ste commented 4 years ago

Thanks @Mortal for the reply.

I've tried editing the command to have helloworld.cpp at the end, this results in exactly the same error and debug.log as before.

I've also tried using the example project with CMake, ran into the same issues as mentioned in the first post about pthread and snappy so I've editted the CMake file to

CMakeLists.txt

Which results in exactly the same error as when I try it with the g++ command, tpie reference not found everywhere it is used.

I've tested the example you gave of a helloworld program that gave expected errors because I'm on an old version of ubuntu at the moment. I checked out the commit mentioned in the first post and altered main.cc to only contain a tpie::init() and a tpie::finish(), that resulted in the following output:

Debug1.log

That's how far I've tested it, I'll get a more recent version of ubuntu up and running tomorrow and report back to you how your helloworld programs runs there. Is there anywhere I can find what exact versions of boost/gcc etc you have used there?

Mortal commented 4 years ago

Now that I look at your original post again I realize you are using GCC 4.8. That's ancient! I apologize for the TPIE documentation being out of date regarding the required compiler versions. We're running TPIE applications on Ubuntu 18.04 where the GCC version is 7.5.0 and most C++17 features are supported, so your results will be best if you run on 18.04 or newer.

We're not using any GCC-specific extensions as TPIE also needs to run on Windows (with MSVC as the compiler) and Mac (with clang), but to run the TPIE current master branch, your compiler needs some C++17 features.

In particular the error in your last log file regards enable_if_t, which is part of C++14 and probably not supported by GCC 4.8.

If you have experience building and running Docker images, then you can use Docker to run TPIE. However it is probably easiest if you upgrade to a newer Ubuntu.

gijsde1ste commented 4 years ago

Thank you very much @Mortal ,

Using ubuntu 18.04 your example works after some fiddling with cmake and locating boost libraries.

Perhaps worth mentioning that the example project still does not compile because prime.h does not exist anymore.