Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails on linux #1374

Closed
madmaxoft opened this issue Sep 3, 2014 · 16 comments
Closed

Compilation fails on linux #1374

madmaxoft opened this issue Sep 3, 2014 · 16 comments

Comments

@madmaxoft
Copy link
Member

I tried compiling MCS on my VPS and the compilation failed:

cc1plus: error: unrecognized command line option "-Wsuggest-attribute=pure"
cc1plus: error: unrecognized command line option "-Wsuggest-attribute=const"

g++ --version reports:

g++ (Gentoo 4.4.7 p1.2, pie-0.4.5) 4.4.7
@sphinxc0re
Copy link
Contributor

Yeah although you are running gentoo, you have an outdated version of gcc installed I guess. Try updating your server.

@madmaxoft
Copy link
Member Author

I can't, it's a semi-managed hosting. I don't have root access.
But it's only a stupid flag error, can't we detect the proper flags or something?

@sphinxc0re
Copy link
Contributor

Then contact the support. The current version of GCC is 4.9 so they are already a few versions behind.
What we could do is manually enable all the Wflags accept for the one shown above... but that would be very hard work to do. There is a tremendous amount of flags in GCC...

@worktycho
Copy link
Member

Also that looks like a gcc driver compiler mismatch. We don't actually pass that flag to gcc anywhere.

@sphinxc0re
Copy link
Contributor

Of course you do! You automatically give the compiler the -Wall flag which shows all the warnings

@madmaxoft
Copy link
Member Author

I don't think passing -Wall should enable a flag that the compiler doesn't know

@worktycho
Copy link
Member

@madmaxoft whats the command line cmake's feeding gcc? If you compile with VERBOSE=1 to the makefile it should tell you.

@madmaxoft
Copy link
Member Author

Yes, it is there, although I have no idea where it came from:

cd /container/home/MCServer/Release/lib/SQLiteCpp && /usr/bin/c++   -DXML_STATIC -pthread          -fsigned-char -O2 -g -DNDEBUG -I/container/home/MCServer/lib/SQLiteCpp/include -I/container/home/MCServer/lib/sqlite    -rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -fPIC -o CMakeFiles/SQLiteCpp.dir/src/Column.cpp.o -c /container/home/MCServer/lib/SQLiteCpp/src/Column.cpp

@worktycho
Copy link
Member

What cmake version are you running?

@madmaxoft
Copy link
Member Author

2.8.12.2

@worktycho
Copy link
Member

There's something weird going on with your cmake. I'd check the defaults for the $CMAKE_CXX_FLAGS var

@madmaxoft
Copy link
Member Author

How do I do that? Remember, I'm a linux noob

@worktycho
Copy link
Member

I'd create a cmakelist thet is just:

message($CMAKE_CXX_FLAGS)

Then try and build it.

@archshift
Copy link
Contributor

Remember--you can compile GCC! If all else fails, that's what you can do, that or downloading a newer GCC binary (but not installing it).

@madmaxoft
Copy link
Member Author

Both CXX and C flags are empty. I used the following CMakeLists.txt file:

enable_language(CXX C)
message("C Flags: " "${CMAKE_C_FLAGS}")
message("CXX Flags: " "${CMAKE_CXX_FLAGS}")

The output is:

-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
C FLAGS:
CXX FLAGS:
-- Configuring done
-- Generating done
-- Build files have been written to: /container/home/test/cmake

@worktycho
Copy link
Member

Found the problem. SQLiteCPP are inserting the flag. They recommend 4.7.2 but if you can't use that I suggest you raise the issue with them.

madmaxoft added a commit that referenced this issue Sep 3, 2014
This should fix #1374.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants