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

Trouble with compiling #24

Closed
mikilopez opened this issue Jun 26, 2013 · 18 comments
Closed

Trouble with compiling #24

mikilopez opened this issue Jun 26, 2013 · 18 comments

Comments

@mikilopez
Copy link

Trying to compile, I got an error in render/config.cpp, with fs::absolute. Replacing it with fs::complete I solved the problem, based on examples here:
http://en.highscore.de/cpp/boost/filesystem.html

But then I got another error.

render/rendermodes/lighting.cpp: In member function ‘mapcrafter::render::CornerColors mapcrafter::render::LightingRendermode::getCornerColors(const mapcrafter::mc::BlockPos&, const mapcrafter::render::FaceCorners&) const’:
render/rendermodes/lighting.cpp:257: error: no matching function for call to ‘std::array<double, 4u>::array(<brace-enclosed initializer list>)’
/usr/include/c++/4.4/tr1_impl/array:50: note: candidates are: std::array<double, 4u>::array()
/usr/include/c++/4.4/tr1_impl/array:50: note:                 std::array<double, 4u>::array(const std::array<double, 4u>&)
render/rendermodes/lighting.cpp: In member function ‘void mapcrafter::render::LightingRendermode::lightTop(mapcrafter::render::Image&, const mapcrafter::render::CornerColors&, int) const’:
render/rendermodes/lighting.cpp:301: error: no matching function for call to ‘mapcrafter::render::LightingRendermode::createShade(mapcrafter::render::Image&, <brace-enclosed initializer list>) const’
render/rendermodes/lighting.cpp:139: note: candidates are: void mapcrafter::render::LightingRendermode::createShade(mapcrafter::render::Image&, const mapcrafter::render::CornerColors&) const

And I don't now the way to solve it.

@m0r13
Copy link
Member

m0r13 commented Jun 26, 2013

Which version of gcc do you use?

@mikilopez
Copy link
Author

Sorry, I forgot it.
It's 4.4.3. I see now it's a bit outdated. Too old to compile mapcrafter?

@m0r13
Copy link
Member

m0r13 commented Jun 28, 2013

A bit old, but not too old. I made the code a bit more compatible and tested it with a gcc 4.4. It should work now.

@m0r13
Copy link
Member

m0r13 commented Jul 30, 2013

By the way, do you know which Boost.Filesystem version do you have? This could be useful to include the fs::absolute to fs::complete patch.

@mikilopez
Copy link
Author

If you are asking about libboost-filesystem version, it's 1.40. I had other similar issues after you said "I made the code a bit more compatible", but I could not report them then (I've been busy this time). I will try to compile the most recent code, and see what happens.

@m0r13
Copy link
Member

m0r13 commented Jul 30, 2013

Sorry, but I made some bigger changes on the NBT code (for the Minecraft NBT file format) which require new C++ 11 features. At the moment I am trying to find some workarounds for older gcc versions.

mapcrafter already contains some workarounds for older Boost.Filesystem versions. Now I can also add the thing with fs::complete.

@mikilopez
Copy link
Author

Ok, no problem.
Soon I will change my distro so I will try to get the last version of GCC and Boost.

@m0r13
Copy link
Member

m0r13 commented Aug 4, 2013

You could try now the newest version with your gcc 4.4.

@mikilopez
Copy link
Author

Compiles perfectly :D
Only had 1 warning:
[ 9%] Building CXX object src/CMakeFiles/mapcraftercore.dir/util.cpp.o
/home/miki/Escritorio/mapcrafter/src/util.cpp:55: warning: integer constant is too large for ‘long’ type
/home/miki/Escritorio/mapcrafter/src/util.cpp:56: warning: integer constant is too large for ‘long’ type
/home/miki/Escritorio/mapcrafter/src/util.cpp:57: warning: integer constant is too large for ‘long’ type
/home/miki/Escritorio/mapcrafter/src/util.cpp:58: warning: integer constant is too large for ‘long’ type

@mikilopez
Copy link
Author

Ok, but if fails when running

    mapcrafter: /usr/include/boost/filesystem/operations.hpp:585: typename boost::enable_if<boost::filesystem::is_basic_path<Path>, Path>::type boost::filesystem::complete(const Path&, const Path&) [with Path = boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits>]: Assertion `base.is_complete() && (ph.is_complete() || !ph.has_root_name()) && "boost::filesystem::complete() precondition not met"' failed.

This was the cmake output (if relevant)

    -- The C compiler identification is GNU
    -- The CXX compiler identification is GNU
    -- Check for working C compiler: /usr/bin/gcc
    -- Check for working C compiler: /usr/bin/gcc -- 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
    -- Boost version: 1.40.0
    -- Found the following Boost libraries:
    --   iostreams
    --   system
    --   filesystem
    --   program_options
    -- Could NOT find Boost
    -- Performing Test HAVE_NULLPTR
    -- Performing Test HAVE_NULLPTR - Failed
    -- Looking for include files HAVE_ENDIAN_H
    -- Looking for include files HAVE_ENDIAN_H - found
    -- Looking for include files HAVE_SYS_ENDIAN_H
    -- Looking for include files HAVE_SYS_ENDIAN_H - not found.
    -- Performing Test HAVE_ENDIAN_CONVERSION
    -- Performing Test HAVE_ENDIAN_CONVERSION - Success
    Boost Unit Test Framework not found. Skipping the tests.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/****/mapcrafter

@m0r13
Copy link
Member

m0r13 commented Aug 5, 2013

The function should concatenate two paths to an absolute path. Looks like if boost has problems with these two paths. I have a patch for you:

diff --git a/src/config/config.cpp b/src/config/config.cpp
index f3fb418..312870f 100644
--- a/src/config/config.cpp
+++ b/src/config/config.cpp
@@ -80,6 +80,8 @@ void RenderWorldConfig::readFromConfig(const fs::path& dir, const ConfigFile& co
    if (config.has(section, "incremental_detection"))
        incremental_detection = config.get(section, "incremental_detection");

+   std::cout << "path: " << input_dir << " base: " << dir << std::endl;
+   std::cout << "path: " << textures_dir << " base: " << dir << std::endl;
    if (!input_dir.empty())
        input_dir = BOOST_FS_ABSOLUTE(input_dir, dir).string();
    if (!textures_dir.empty())
@@ -161,6 +163,8 @@ bool RenderConfigParser::loadFile(const std::string& filename) {
    output_dir = config.get("", "output_dir");
    template_dir = config.get("", "template_dir");

+   std::cout << "path: " << output_dir << " base: " << dir << std::endl;
+   std::cout << "path: " << template_dir << " base: " << dir << std::endl;
    if (!output_dir.empty())
        output_dir = BOOST_FS_ABSOLUTE(output_dir, dir).string();
    if (!template_dir.empty())

Can you apply this patch by copying it to the root (for example in file patch) path of the project and running git apply patch and show me the output when running mapcrafter?

@wastrel333
Copy link

As requested in #29, I ran the patch.

Received:
error: patch failed: src/config/config.cpp:80
error: src/config/config.cpp: patch does not apply

I pulled a fresh clone today, reran cmake/make with no issues, but ran into the same message when applying the patch.

@m0r13
Copy link
Member

m0r13 commented Aug 8, 2013

Sorry, looks like if there are problems with patches copied into the comments. Try the patch directly from here.

@wastrel333
Copy link

Got that one to apply, and it patched.

Still no luck when trying to render:

mapcrafter: /usr/include/boost/filesystem/operations.hpp:585: typename boost::enable_if<boost::filesystem::is_basic_path<Path>, Path>::type boost::filesystem::complete(const Path&, const Path&) [with Path = boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits>]: Assertion `base.is_complete() && (ph.is_complete() || !ph.has_root_name()) && "boost::filesystem::complete() precondition not met"' failed.
Aborted

@m0r13
Copy link
Member

m0r13 commented Aug 8, 2013

With this patch the renderer should make outputs when calling the problematic function. Are you sure you ran make after patching the program?

@wastrel333
Copy link

I did not re-run make previously. I did it, and received a bit more, but still the same error:

path: ../output base:
path: data/template base:
mapcrafter: /usr/include/boost/filesystem/operations.hpp:585: typename boost::enable_if<boost::filesystem::is_basic_path<Path>, Path>::type boost::filesystem::complete(const Path&, const Path&) [with Path = boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits>]: Assertion `base.is_complete() && (ph.is_complete() || !ph.has_root_name()) && "boost::filesystem::complete() precondition not met"' failed.
Aborted

I tried a fresh install, and ran the patch prior to cmake/make, but ran into the same issue.

@m0r13
Copy link
Member

m0r13 commented Aug 9, 2013

I just needed this extra output. Now I can hopefully fix this problem.

@m0r13
Copy link
Member

m0r13 commented Aug 9, 2013

I was able to fix the problem with your boost/gcc version. Just do a git checkout src/config/config.cpp, then update (git pull) your sources and recompile it. Then it should work. :D

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

3 participants