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 issue #3

Open
murlock opened this issue Nov 13, 2018 · 43 comments
Open

Compilation issue #3

murlock opened this issue Nov 13, 2018 · 43 comments

Comments

@murlock
Copy link

murlock commented Nov 13, 2018

Hi,

I've tried to compile openmom on my Ubuntu:

  • with GCC 7.3, I've met few issues with invalid compilation flags, missing headers but also some method seen as constructor !
  • with clang 4.0, some errors are raised related to SkillSet::iterator with invalid operands.

Can you describe which version of clang on Mac is used to compile ?
Regarding your cmake, I suppose you are using Mac and/or Windows ?

@rtentser
Copy link
Contributor

gcc 6.3.0, clang 3.8.1-24, Debian GNU/Linux stretch:
openmom_build.log

@rtentser
Copy link
Contributor

I've fixed some errors by including some headers (https://github.com/rtentser/openmom/tree/compilationFixes) and using -fpermissive flag lets gcc to ignore some other issues (it's temporary solution, but i don't want to look into them right now). And now i stuck with another problem. I've attached the log. I'll try to fix it too but it's been a while since i wrote in C++ and i wasn't good, so i need time to refresh my skills. Any help will be appreciated.
openmom_build2.log

@Jakz
Copy link
Owner

Jakz commented Nov 23, 2018

So far I'm mainly working with XCode, I created the cmake project so that someone could help in configuring it for additional platforms but I haven't personally tested it too much on other operating systems.

My main machine has this clang/LLVM version:

Apple LLVM version 8.0.0 (clang-800.0.42.1)

XCode has some predefined headers which indeed must be added to allow compilation through a different build system, I'd be glad if you are able to provide a pull request which fixes compilation under your version of linux as it's really welcome :)

@rtentser
Copy link
Contributor

Right now i've fixed or workarounded some of compilation issues on my system (PULL: #4). But that isn't all.

@murlock
Copy link
Author

murlock commented Nov 24, 2018 via email

@Jakz
Copy link
Owner

Jakz commented Nov 24, 2018

@rtentser: It's not clear if now it compiles with -fpermissive on your machine or if it still requires fixes, I merged the PR meanwhile, in case it wasn't complete please specify it directly in the text of the PR so that I'll avoid merging it.

If another PR is needed then feel free to open it. I'll try to setup a bare Linux environment to test compilation too.

@Jakz
Copy link
Owner

Jakz commented Nov 24, 2018

Ok, I prepared the environment and tested compilation on clang-3.8. Added some fixes that I already integrated into master branch, now it should reach linking phase, could @rtentser please confirm this?

@rtentser
Copy link
Contributor

It wasn't finished: there was a problem with operator- for iterator and you've fixed it. Thanks a lot (and for other fixes too)!

There was some filenames issues still, i've fixed them: #7

Now it's 100%, "Linking CXX executable openmom" and many errors.

I've fixed -fpermissive issues earlier, so we don't need this flag anymore.

@Jakz
Copy link
Owner

Jakz commented Nov 24, 2018

I added some more fixes which should solve linking problems on Linux, now the executable should be correctly created but it crashes at startup (another story!).

@rtentser
Copy link
Contributor

/home/rtentser/Sources/openmom/src/save/YAML.cpp:5:27: fatal error: yaml-cpp/yaml.h: No such file or directory

@rtentser
Copy link
Contributor

Fixes: #8

But linking doesn't starts:

make[2]: *** No rule to make target '/yaml/lib/linux/libyaml-cpp.a', needed by 'openmom'.  Stop.
CMakeFiles/Makefile2:86: recipe for target 'CMakeFiles/openmom.dir/all' failed
make[1]: *** [CMakeFiles/openmom.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Also, Debian and Ubuntu have libyaml-cpp-dev package: https://packages.debian.org/stretch/libyaml-cpp-dev. Can you use it?

@rtentser
Copy link
Contributor

Here is content of a package in Debian Stretch i386:
/usr/include/yaml-cpp/anchor.h
/usr/include/yaml-cpp/binary.h
/usr/include/yaml-cpp/contrib/anchordict.h
/usr/include/yaml-cpp/contrib/graphbuilder.h
/usr/include/yaml-cpp/dll.h
/usr/include/yaml-cpp/emitfromevents.h
/usr/include/yaml-cpp/emitter.h
/usr/include/yaml-cpp/emitterdef.h
/usr/include/yaml-cpp/emittermanip.h
/usr/include/yaml-cpp/emitterstyle.h
/usr/include/yaml-cpp/eventhandler.h
/usr/include/yaml-cpp/exceptions.h
/usr/include/yaml-cpp/mark.h
/usr/include/yaml-cpp/node/convert.h
/usr/include/yaml-cpp/node/detail/bool_type.h
/usr/include/yaml-cpp/node/detail/impl.h
/usr/include/yaml-cpp/node/detail/iterator.h
/usr/include/yaml-cpp/node/detail/iterator_fwd.h
/usr/include/yaml-cpp/node/detail/memory.h
/usr/include/yaml-cpp/node/detail/node.h
/usr/include/yaml-cpp/node/detail/node_data.h
/usr/include/yaml-cpp/node/detail/node_iterator.h
/usr/include/yaml-cpp/node/detail/node_ref.h
/usr/include/yaml-cpp/node/emit.h
/usr/include/yaml-cpp/node/impl.h
/usr/include/yaml-cpp/node/iterator.h
/usr/include/yaml-cpp/node/node.h
/usr/include/yaml-cpp/node/parse.h
/usr/include/yaml-cpp/node/ptr.h
/usr/include/yaml-cpp/node/type.h
/usr/include/yaml-cpp/noncopyable.h
/usr/include/yaml-cpp/null.h
/usr/include/yaml-cpp/ostream_wrapper.h
/usr/include/yaml-cpp/parser.h
/usr/include/yaml-cpp/stlemitter.h
/usr/include/yaml-cpp/traits.h
/usr/include/yaml-cpp/yaml.h
/usr/lib/i386-linux-gnu/cmake/yaml-cpp/yaml-cpp-config-version.cmake
/usr/lib/i386-linux-gnu/cmake/yaml-cpp/yaml-cpp-config.cmake
/usr/lib/i386-linux-gnu/cmake/yaml-cpp/yaml-cpp-targets-release.cmake
/usr/lib/i386-linux-gnu/cmake/yaml-cpp/yaml-cpp-targets.cmake
/usr/lib/i386-linux-gnu/libyaml-cpp.a
/usr/lib/i386-linux-gnu/libyaml-cpp.so
/usr/lib/i386-linux-gnu/pkgconfig/yaml-cpp.pc
/usr/share/doc/libyaml-cpp-dev/changelog.Debian.gz
/usr/share/doc/libyaml-cpp-dev/copyright

@rtentser
Copy link
Contributor

I've tried to build openmom without my changes after i've installed the package and get some other errors:

openmom.log

@Jakz
Copy link
Owner

Jakz commented Nov 25, 2018

I did some local enhancements to the library so that's why I would prefer avoiding using the package (and I'm not even sure all distributions have it), I think the problem you get is related to

set(LIBRARY_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/libs)

in root CMakeFiles.txt which is not propagated to the CMakeFiles.txt in the subfolders so that it's empty, and subsequent

set(YAML_INCLUDE_DIR ${LIBRARY_FOLDER}/yaml/include)

fails. If you fix it you don't need to change all includes (which should be kept with yaml-cpp since this is required on macOS).

@Jakz
Copy link
Owner

Jakz commented Nov 25, 2018

Are you actually launching cmake on root of the project and not src folder? Otherwise you could try by caching the variable, eg

set(LIBRARY_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/libs CACHE INTERNAL "")

@rtentser
Copy link
Contributor

With root of the project as a source directory it successfully compiles. Thanks!

But linking still fails. You use x86-64 version of libyaml-cpp? My system is x86.

openmom.log

@Jakz
Copy link
Owner

Jakz commented Nov 25, 2018

Yes, I just prebuilt x64 version, you can try replacing it to see if works, then we need to update cmake script to choose the correct one accordingly.

@rtentser
Copy link
Contributor

rtentser commented Nov 26, 2018

I've tried with libyaml-cpp.a from Debian repository and your headers and get this:

/home/rtentser/Sources/openmom/libs/yaml/lib/linux/libyaml-cpp.a(node_data.cpp.o):(.bss+0x0): multiple definition of `YAML::detail::node_data::empty_scalar[abi:cxx11]'
save/libSAVE_LIB.a(YAML.cpp.o):(.bss+0x0): first defined here
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::BadConversion::BadConversion(YAML::Mark const&)':
YAML.cpp:(.text._ZN4YAML13BadConversionC2ERKNS_4MarkE[_ZN4YAML13BadConversionC5ERKNS_4MarkE]+0x7b): undefined reference to `vtable for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<int>::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionIiED2Ev[_ZN4YAML18TypedBadConversionIiED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<short>::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionIsED2Ev[_ZN4YAML18TypedBadConversionIsED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<unsigned short>::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionItED2Ev[_ZN4YAML18TypedBadConversionItED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<float>::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionIfED2Ev[_ZN4YAML18TypedBadConversionIfED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<bool>::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionIbED2Ev[_ZN4YAML18TypedBadConversionIbED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o): In function `.L6154':
YAML.cpp:(.text._ZN4YAML6detail9node_data3getINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERNS0_4nodeERKT_St10shared_ptrINS0_13memory_holderEE[_ZN4YAML6detail9node_data3getINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERNS0_4nodeERKT_St10shared_ptrINS0_13memory_holderEE]+0xa5): undefined reference to `YAML::detail::node_data::convert_to_map(std::shared_ptr<YAML::detail::memory_holder>)'
save/libSAVE_LIB.a(YAML.cpp.o): In function `YAML::TypedBadConversion<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::~TypedBadConversion()':
YAML.cpp:(.text._ZN4YAML18TypedBadConversionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev[_ZN4YAML18TypedBadConversionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED5Ev]+0x26): undefined reference to `YAML::BadConversion::~BadConversion()'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionIbEE[_ZTIN4YAML18TypedBadConversionIbEE]+0x8): undefined reference to `typeinfo for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionIfEE[_ZTIN4YAML18TypedBadConversionIfEE]+0x8): undefined reference to `typeinfo for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionItEE[_ZTIN4YAML18TypedBadConversionItEE]+0x8): undefined reference to `typeinfo for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionIsEE[_ZTIN4YAML18TypedBadConversionIsEE]+0x8): undefined reference to `typeinfo for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionIiEE[_ZTIN4YAML18TypedBadConversionIiEE]+0x8): undefined reference to `typeinfo for YAML::BadConversion'
save/libSAVE_LIB.a(YAML.cpp.o):(.data.rel.ro._ZTIN4YAML18TypedBadConversionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTIN4YAML18TypedBadConversionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x8): more undefined references to `typeinfo for YAML::BadConversion' follow
collect2: error: ld returned 1 exit status
src/CMakeFiles/openmom.dir/build.make:121: ошибка выполнения рецепта для цели «src/openmom»
make[2]: *** [src/openmom] Ошибка 1
CMakeFiles/Makefile2:124: ошибка выполнения рецепта для цели «src/CMakeFiles/openmom.dir/all»
make[1]: *** [src/CMakeFiles/openmom.dir/all] Ошибка 2
Makefile:83: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

I've deleted libs/yaml so the build uses system headers and lib (from yaml-cpp-dev). And get this:
openmom.log
I haven't compared it with earlier try (when cmake used src as source directory) so it can be the same (or not).

Can i try your version of the library?

and I'm not even sure all distributions have it

I think you can add a check for it in configuration so it'll be a user's problem, not yours.

@Jakz
Copy link
Owner

Jakz commented Nov 26, 2018

The errors you get by using the headers from package library from Debian are given by the fact that I modified the library and enhanced some functionalities that I needed (which is a reason why I prefer to include it into the repository).

My version of the library has been compiled directly from the github source so that's the one you should try to use.

@rtentser
Copy link
Contributor

rtentser commented Nov 26, 2018

But github version of yaml-cpp (this one? https://github.com/jbeder/yaml-cpp/) won't have your changes, will it?

@Jakz
Copy link
Owner

Jakz commented Nov 26, 2018

My changes are currently header only, so you should be able to compile the default library and use it with my headers. Unfortunately I can't totally factorize out my modifications on the headers because yaml-cpp requires exceptions enabled but I don't want to enable them unless really necessary so I had to remove the relevant code.

@rtentser
Copy link
Contributor

Build with github version fully successful. Thanks!

@rtentser
Copy link
Contributor

I've remembered: yaml-cpp 0.5.2 is broken so you're right with providing the library.

Do i need to make a pull request with libyaml-cpp.a compiled for x86?

@Jakz
Copy link
Owner

Jakz commented Dec 14, 2018

It could be a good idea to solve the issue for the moment, but does the game start also after copying the LBX files or just compilation is going through?

@rtentser
Copy link
Contributor

Just compilation.

@Jakz
Copy link
Owner

Jakz commented Jan 10, 2019

Ok, so I'd like to know what's going on. I fixed some issues which were probably causing UB but went fine on Clang and failed on MSVS2017 so possibly now it could also run (assuming you are copying data correctly) but I should debug the engine on Linux to have more clues.

I also like to get rid of yaml-cpp library since it's overdone for the needs and it gave more problems than anything but this would require a bare yaml parser which is enough to parse data.

@rtentser
Copy link
Contributor

rtentser commented Jan 14, 2019

Now i get this:

[  1%] Building CXX object src/ui/animations/CMakeFiles/UI_ANIMATIONS_LIB.dir/Animations.cpp.o
c++: error: unrecognized command line option ‘-fstandalone-debug’; did you mean ‘-fcompare-debug’?
c++: error: unrecognized command line option ‘-stdlib=libstdc++’; did you mean ‘-static-libstdc++’?

gcc 6.3.0, clang 3.8.1.

@Jakz
Copy link
Owner

Jakz commented Jan 14, 2019

that's strange since Apple Clang has both of them, maybe on Linux it's different, feel free to modify CMakeLists.txt with if cases for UNIX and remove non working flags.

@rtentser
Copy link
Contributor

rtentser commented Jan 14, 2019

Workaround: #9.

The engine still doesn't compiles with gcc and i consider it's a bug (i will not fix it any time soon. If i will).

The engine isn't runnable still. I get "Floating point exception" when try to start it. No further details in terminal.

@rtentser
Copy link
Contributor

rtentser commented Jan 14, 2019

assuming you are copying data correctly

Which data i need to copy? And where? Maybe this is my problem.

@Jakz
Copy link
Owner

Jakz commented Jan 14, 2019

The game requires all the .LBX files inside /data/lbx. Now the problem is that each platform is different with respect to the working directory. If you see here you can see that getResourcePath returns a relative path to pwd to the data subdirectory (which contains yaml, lbx and so on).

You can modify it to match the structure you want to make it work on Linux, unfortunately I don't have any ready virtual machine to test it on (my SSD broke recently) so you are on your own for this but since it works on macOS it should work easily on Linux too.

Mind that I discovered some issues with yaml-cpp library on release on Windows so I'm not sure that the library is working nicely on Linux, I really should write a bare parser and forget about it.

@rtentser
Copy link
Contributor

With fresh commits:

/home/rtentser/Sources/openmom/src/ui/parts/CommonDraw.h:23:75: error: no type named 'string_view' in namespace 'std'
  static void drawUnitPropValue(Property property, const Unit* unit, std::string_view prefix, coord_t x, coord_t y);
                                                                     ~~~~~^
/home/rtentser/Sources/openmom/src/ui/parts/CommonDraw.cpp:133:78: error: no type named 'string_view' in namespace 'std'
void CommonDraw::drawUnitPropValue(Property property, const Unit* unit, std::string_view prefix, coord_t x, coord_t y)

And i've fixed another include, pushed it to PR.

@rtentser
Copy link
Contributor

rtentser commented Jan 15, 2019

I think the issue with string_view can be fixed by "-std=c++17" and upgrade of my clang, because this feature is a part of C++17 standard and was implemented in clang 4.0.

@rtentser
Copy link
Contributor

And i need to upgrade my gcc too — cmake uses libstdc++ which didn't supports string_view until 7.

@Jakz
Copy link
Owner

Jakz commented Jan 15, 2019

I started using some C++17 features because they're quite useful and ubiquitous with respect to compiler support at this point.

But I just added a check for availability with a forced override through -DOM_CONFIG_DONT_USE_STRING_VIEW=true. Now that shouldn't be an issue anymore, it should fallback to const std::string& when compiler doesn't support it.

I'd be glad to be able to see it running on Linux, I've been able to run it properly on Windows so it's the only basic platform missing!

@rtentser
Copy link
Contributor

rtentser commented Jan 15, 2019

And now i have linking problems.

CMakeFiles/openmom.dir/main.cpp.o: In function `unsigned int fmt::v5::internal::parse_nonnegative_int<fmt::v5::internal::null_terminating_iterator<char>, fmt::v5::internal::error_handler&>(fmt::v5::internal::null_terminating_iterator<char>&, fmt::v5::internal::error_handler&)':
/home/rtentser/Sources/openmom/src/common/fmt/printf.h:139: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'
CMakeFiles/openmom.dir/main.cpp.o: In function `fmt::v5::basic_parse_context<char, fmt::v5::internal::error_handler>::on_error(char const*)':
/home/rtentser/Sources/openmom/src/common/fmt/core.h:919: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'
CMakeFiles/openmom.dir/main.cpp.o: In function `fmt::v5::internal::count_digits(unsigned int)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:901: undefined reference to `fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_32'
CMakeFiles/openmom.dir/main.cpp.o: In function `char* fmt::v5::internal::format_decimal<unsigned int, char, fmt::v5::internal::no_thousands_sep>(char*, unsigned int, int, fmt::v5::internal::no_thousands_sep)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:969: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:971: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:979: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:981: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
CMakeFiles/openmom.dir/main.cpp.o: In function `char fmt::v5::internal::thousands_sep<char>(fmt::v5::internal::locale_ref)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:946: undefined reference to `char fmt::v5::internal::thousands_sep_impl<char>(fmt::v5::internal::locale_ref)'
CMakeFiles/openmom.dir/main.cpp.o: In function `char* fmt::v5::internal::format_decimal<unsigned int, char, fmt::v5::internal::add_thousands_sep<char> >(char*, unsigned int, int, fmt::v5::internal::add_thousands_sep<char>)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:969: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:971: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:979: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:981: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
CMakeFiles/openmom.dir/main.cpp.o: In function `fmt::v5::internal::count_digits(unsigned long long)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:773: undefined reference to `fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_64'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:773: undefined reference to `fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_64'
CMakeFiles/openmom.dir/main.cpp.o: In function `char* fmt::v5::internal::format_decimal<unsigned long long, char, fmt::v5::internal::no_thousands_sep>(char*, unsigned long long, int, fmt::v5::internal::no_thousands_sep)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:969: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:971: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:979: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:981: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
CMakeFiles/openmom.dir/main.cpp.o: In function `char* fmt::v5::internal::format_decimal<unsigned long long, char, fmt::v5::internal::add_thousands_sep<char> >(char*, unsigned long long, int, fmt::v5::internal::add_thousands_sep<char>)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:969: undefined reference to `fmt::v5::internal::basic_data<void>::DIGITS'
CMakeFiles/openmom.dir/main.cpp.o:/home/rtentser/Sources/openmom/src/./common/fmt/format.h:971: more undefined references to `fmt::v5::internal::basic_data<void>::DIGITS' follow
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::internal::handle_char_specs<char, fmt::v5::internal::arg_formatter_base<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::char_spec_handler>(fmt::v5::basic_format_specs<char> const*, fmt::v5::internal::arg_formatter_base<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::char_spec_handler&&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:1189: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::write_double<double>(double, fmt::v5::basic_format_specs<char> const&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:2736: undefined reference to `void fmt::v5::internal::sprintf_format<double>(double, fmt::v5::internal::basic_buffer<char>&, fmt::v5::core_format_specs)'
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::write_double<long double>(long double, fmt::v5::basic_format_specs<char> const&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:2736: undefined reference to `void fmt::v5::internal::sprintf_format<long double>(long double, fmt::v5::internal::basic_buffer<char>&, fmt::v5::core_format_specs)'
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::internal::handle_cstring_type_spec<char, fmt::v5::internal::arg_formatter_base<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::cstring_spec_handler>(char, fmt::v5::internal::arg_formatter_base<fmt::v5::back_insert_range<fmt::v5::internal::basic_buffer<char> > >::cstring_spec_handler&&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:1200: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::internal::check_string_type_spec<char, fmt::v5::internal::error_handler>(char, fmt::v5::internal::error_handler&&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:1206: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'
CMakeFiles/openmom.dir/main.cpp.o: In function `void fmt::v5::internal::check_pointer_type_spec<char, fmt::v5::internal::error_handler>(char, fmt::v5::internal::error_handler&&)':
/home/rtentser/Sources/openmom/src/./common/fmt/format.h:1212: undefined reference to `fmt::v5::internal::error_handler::on_error(char const*)'

I'd be glad to be able to see it running on Linux

I'll be glad too. I love Master of Magic and want to play it without dosbox. Thank you for your work!

@Jakz
Copy link
Owner

Jakz commented Jan 15, 2019

That's because now text formatting library source file is inside common/fmt subfolder, I added the source to CMakeLists.txt and added common/fmt to include directories. Now it should work again!

Yes Master of Magic is really a masterpiece but the engine is so complex to reproduce, I hope that one day this port will be fully playable but it still requires a lot of work!

@Jakz
Copy link
Owner

Jakz commented Jan 16, 2019

Ok I pushed some changed that made that map local static, which should force initialization correctly when localization is loaded from english.yaml

@rtentser
Copy link
Contributor

[  4%] Building CXX object src/common/CMakeFiles/COMMON_LIB.dir/mystrings.cpp.o
/home/rtentser/Sources/openmom/src/common/mystrings.cpp:18:8: error: no member named 'transform' in namespace 'std'
  std::transform(text.begin(), text.end(), lname.begin(), ::tolower);
  ~~~~~^
/home/rtentser/Sources/openmom/src/common/mystrings.cpp:26:8: error: no member named 'transform' in namespace 'std'
  std::transform(text.begin(), text.end(), lname.begin(), ::toupper);
  ~~~~~^
/home/rtentser/Sources/openmom/src/common/mystrings.cpp:37:3: error: use of undeclared identifier 'assert'
  assert(str.length() > 0);
  ^
/home/rtentser/Sources/openmom/src/common/mystrings.cpp:52:3: error: use of undeclared identifier 'assert'
  assert(e <= tokens.size() - 1 && s >= 0 && s <= e);
  ^
4 errors generated.

@Jakz
Copy link
Owner

Jakz commented Jan 19, 2019

Yes, caused by removing an include from mystrings.h, unfortunately on macOS some includes are predefined so I didn't catch them

@rtentser
Copy link
Contributor

[ 54%] Building CXX object src/platform/CMakeFiles/PLATFORM_LIB.dir/unix.cpp.o
/home/rtentser/Sources/openmom/src/platform/unix.cpp:37:13: error: use of undeclared identifier 'strings'; did you mean 'std::string'?
        if (strings::compareInsensitive(name, ent->d_name))
            ^~~~~~~
            std::string
/usr/bin/../lib/gcc/i686-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stringfwd.h:74:33: note: 'std::string' declared here
  typedef basic_string<char>    string;   
                                ^
/home/rtentser/Sources/openmom/src/platform/unix.cpp:37:22: error: no member named 'compareInsensitive' in
      'std::__cxx11::basic_string<char>'
        if (strings::compareInsensitive(name, ent->d_name))
            ~~~~~~~~~^
2 errors generated.

@Jakz
Copy link
Owner

Jakz commented Jan 19, 2019

This should be fixed, I should really setup my Linux VM environment again 👍

@kazzmir
Copy link

kazzmir commented Oct 19, 2024

I tried compiling the current state of the project on ubuntu 22.04 with clang 14. There are a few compile errors that I fixed, but yaml-cpp seems too far out of date to compile properly. Perhaps you can update yaml-cpp with the latest version. This is my patch so far

iff --git a/CMakeLists.txt b/CMakeLists.txt
index 389b7af..5f3b19d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,8 @@ if(APPLE)
   set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
   set(CMAKE_C_COMPILER "/usr/bin/clang")
 elseif(UNIX)
+  set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
+  set(CMAKE_C_COMPILER "/usr/bin/clang")
 
 elseif(WIN32)
 #set(SDL2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/sdl2)
@@ -24,7 +26,8 @@ set(LIBRARY_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/libs)
 if(APPLE)
   set(BASE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-inconsistent-missing-override -std=c++14 -stdlib=libc++ -fdiagnostics-show-option") # -Wall
 elseif(UNIX)
-  set(BASE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-inconsistent-missing-override -std=c++14 -stdlib=libstdc++ -fdiagnostics-show-option") # -Wall
+    set(BASE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-inconsistent-missing-override -std=c++17 -stdlib=libstdc++ -fdiagnostics-show-option") # -Wall
+  # set(BASE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-inconsistent-missing-override -std=c++14 -fdiagnostics-show-option") # -Wall
 elseif(WIN32)
   add_compile_options(/wd4068) # unknown pragma
   add_compile_options(/wd4244) # conversion from T to U, possible loss of data
@@ -50,7 +53,8 @@ endif()
 if (WIN32)
 set(DEBUG_FLAGS "-DDEBUG:FULL")
 else()
-set(DEBUG_FLAGS "-O0 -g -fstandalone-debug")
+    set(DEBUG_FLAGS "-O0 -g -fstandalone-debug")
+    #set(DEBUG_FLAGS "-O0 -g")
 endif()
 
 
diff --git a/src/game/units/Items.h b/src/game/units/Items.h
index b1f48ef..4e85486 100644
--- a/src/game/units/Items.h
+++ b/src/game/units/Items.h
@@ -9,6 +9,7 @@
 #include <numeric>
 #include <array>
 #include <string>
+#include <memory>
 
 class Spell;
 class Skill;
diff --git a/src/game/world/Pathfind.cpp b/src/game/world/Pathfind.cpp
index 411e9c4..cf492bd 100644
--- a/src/game/world/Pathfind.cpp
+++ b/src/game/world/Pathfind.cpp
@@ -6,6 +6,8 @@
 #include "Player.h"
 #include "Game.h"
 
+#include <optional>
+
 #if DEBUG >= 2
 #include <sstream>
 #endif
diff --git a/src/ui/Buttons.h b/src/ui/Buttons.h
index 620f895..63ff5ee 100644
--- a/src/ui/Buttons.h
+++ b/src/ui/Buttons.h
@@ -17,6 +17,7 @@
 #include <functional>
 #include <vector>
 #include <memory>
+#include <optional>
 
 class FontSpriteSheet;

The yaml-cpp error is

In file included from /home/jon/svn/master-of-magic/tmp/openmom/src/save/YAML.cpp:5:
In file included from /home/jon/svn/master-of-magic/tmp/openmom/libs/yaml/include/yaml-cpp/yaml.h:17:
In file included from /home/jon/svn/master-of-magic/tmp/openmom/libs/yaml/include/yaml-cpp/node/impl.h:22:
In file included from /home/jon/svn/master-of-magic/tmp/openmom/libs/yaml/include/yaml-cpp/node/iterator.h:13:
/home/jon/svn/master-of-magic/tmp/openmom/libs/yaml/include/yaml-cpp/node/detail/iterator.h:74:46: error: no viable conversion from returned value of type 'pair<typename __decay_and_strip<node *>::__type, typename __decay_and_strip<node *>::__type>' to function return type 'const pair<YAML::Node, YAML::Node>'
  std::pair<Node,Node> const pair() { return std::make_pair((*m_iterator).first, (*m_iterator).second); }

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

No branches or pull requests

4 participants