Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Can't build on ubuntu 18 #1

Closed
alex-bender opened this issue Jan 31, 2019 · 10 comments
Closed

Can't build on ubuntu 18 #1

alex-bender opened this issue Jan 31, 2019 · 10 comments

Comments

@alex-bender
Copy link

So I'm trying to build the project on Ubuntu for using it with SourcetrailPythonIndexer
but I have a problem:

$ cat /etc/issue
Ubuntu 18.10 \n \l
$ g++ --version
g++ (Ubuntu 8.2.0-7ubuntu1) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ swig -version

SWIG Version 3.0.12

Compiled with g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information

The exact error:

$ cmake -DBUILD_BINDINGS_PYTHON=ON ..
fatal: No names found, cannot describe anything.
-- SourcetrailDB Version: v.db.p
-- Interface Version: 
-- Database Version: 
-- Patch Version: 
-- The SourcetrailDB Python bindings will be built.
-- Found SWIG: /usr/bin/swig3.0 (found version "3.0.12") 
-- The examples will be built.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bender/SourcetrailDB/build

$ make lib_core
[  7%] Building CXX object core/CMakeFiles/lib_core.dir/src/DatabaseStorage.cpp.o
/home/bender/SourcetrailDB/core/src/DatabaseStorage.cpp: In static member function ‘static int sourcetrail::DatabaseStorage::getSupportedDatabaseVersion()’:
/home/bender/SourcetrailDB/core/src/DatabaseStorage.cpp:35:3: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   return DATABASE_VERSION;
   ^~~~~~
make[3]: *** [core/CMakeFiles/lib_core.dir/build.make:89: core/CMakeFiles/lib_core.dir/src/DatabaseStorage.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:93: core/CMakeFiles/lib_core.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:105: core/CMakeFiles/lib_core.dir/rule] Error 2
make: *** [Makefile:118: lib_core] Error 2
@mlangkabel
Copy link
Contributor

Thanks for reporting the issue. To me it looks like the CMake script cannot derive a version number:

-- SourcetrailDB Version: v.db.p
-- Interface Version: 
-- Database Version: 
-- Patch Version: 

This may also result in the build error that you encountered afterwards, because the #define for DATABASE_VERSION may be empty (the code that defines DATABASE_VERSION will be generated by CMake and is based on the version that the CMake script derives.

The cause for this issue may be that you just downloaded the repo as a zip file, instead of cloning it. If that's the case, just clone it for now.

If this works for you, please keep this issue open, because we still need to handle the case that a user just downloads the zip file from GitHub.

@alex-bender
Copy link
Author

Hey @mlangkabel! thanks for answering. Actually I was cloning this repo, but with --depth=1 arguments for git. I've indexed SourcetrailDB itself and figured out that indeed, DATABASE_VERSION is empty. So I've hardcoded it (just workaround) to 1:
return 1;//DATABASE_VERSION;

@mlangkabel
Copy link
Contributor

Alright, so it is working for you now. Still it would be great it we could get the issue fixed for other users, too. depth=1 means that you don't have any of the tags on this repo, thus the CMake script cannot derive the version number from the latest tag. I will look into fixing this :)

@alex-bender
Copy link
Author

That make sense, thank you.

@alex-bender
Copy link
Author

Since build would not be possible when DATABASE_VERSION is not defined -- probably it's good to abort the build or show an error message.

@mlangkabel
Copy link
Contributor

Commit 4edb7f2 should fix the issue. CMake will display a proper warning message and set the version to 0.0.0.

@alex-bender: Can you please validate that the issue is fixed for you, too?

@alex-bender
Copy link
Author

sure! going to check that

@alex-bender
Copy link
Author

Now it works. Maybe it worth commenting somewhere in readme that tags are important.

-- SourcetrailDB Version: v1.db23.p0
-- Interface Version: 1
-- Database Version: 23
-- Patch Version: 0

After cloning whole repo I've got this message. So yeah, It works now.

@mlangkabel
Copy link
Contributor

Good point, I will do that.

@mlangkabel
Copy link
Contributor

Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants