openmom
openmom copied to clipboard
Compilation issue
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 ?
gcc 6.3.0, clang 3.8.1-24, Debian GNU/Linux stretch: openmom_build.log
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
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 :)
Right now i've fixed or workarounded some of compilation issues on my system (PULL: https://github.com/Jakz/openmom/pull/4). But that isn't all.
Thanks,
I'll try with new updates and will upgrade my clang version !
Regards
Le sam. 24 nov. 2018 à 08:07, rtentser [email protected] a écrit :
Right now i've fixed or workarounded some of compilation issues on my system (PULL: #4 https://github.com/Jakz/openmom/pull/4). But that isn't all.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jakz/openmom/issues/3#issuecomment-441348703, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPTAQVXTDv0SqwEc44477OyhpX9So_Zks5uyPAWgaJpZM4YcjkF .
-- Michael Bonfils ( http://www.murlock.org )
@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.
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?
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: https://github.com/Jakz/openmom/pull/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.
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!).
/home/rtentser/Sources/openmom/src/save/YAML.cpp:5:27: fatal error: yaml-cpp/yaml.h: No such file or directory
Fixes: https://github.com/Jakz/openmom/pull/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?
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
I've tried to build openmom without my changes after i've installed the package and get some other errors:
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).
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 "")
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.
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.
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.
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.
But github version of yaml-cpp (this one? https://github.com/jbeder/yaml-cpp/) won't have your changes, will it?
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.
Build with github version fully successful. Thanks!
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?
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?
Just compilation.
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.
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.
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.
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.
assuming you are copying data correctly
Which data i need to copy? And where? Maybe this is my problem.