MantisBT - VCMI
View Issue Details
0001924VCMIOtherpublic2014-10-31 09:392022-04-12 09:17
josch 
Mixaill 
normalmajoralways
closedfixed 
Linux x86_64Debian8.0
 
0.97b 
0001924: vcmi in git fails to build from source on Linux
When I try to build vcmi from git (develop branch) on Debian Linux I run into:

[ 41%] Building CXX object AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/src/Console.cpp.o
In file included from /home/josch/vcmi/AI/FuzzyLite/fuzzylite/./fl/Console.h:28:0,
                 from /home/josch/vcmi/AI/FuzzyLite/fuzzylite/src/Console.cpp:25:
/home/josch/vcmi/AI/FuzzyLite/fuzzylite/./fl/fuzzylite.h:33:26: fatal error: ../../Global.h: No such file or directory
 #include "../../Global.h"
                          ^
compilation terminated.
AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/build.make:57: recipe for target 'AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/src/Console.cpp.o' failed
make[2]: *** [AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/src/Console.cpp.o] Error 1
CMakeFiles/Makefile2:494: recipe for target 'AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/all' failed
make[1]: *** [AI/FuzzyLite/fuzzylite/CMakeFiles/fl-static.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2

Why is the line '#include "../../Global.h"' even needed? It seems to build fine without it. If this line is needed for other platforms than linux (it was apparently included in a commit that added MSVS support) then maybe there is a way to let it build with MSVS through a different change? The problem with having this line is, that this change connot be forwarded to fuzzylite upstream. If the fuzzylite version embedded in vcmi could instead be changed such that the changes can be forwarded to fuzzylite upstream, then maybe vcmi can drop their embedded copy in the future.
No tags attached.
Issue History
2014-10-31 09:39joschNew Issue
2014-10-31 09:44joschNote Added: 0005043
2014-11-01 08:00WarmongerNote Added: 0005049
2014-11-01 08:26joschNote Added: 0005051
2014-11-01 18:19MixaillNote Added: 0005057
2014-11-01 18:19MixaillNote Edited: 0005057bug_revision_view_page.php?bugnote_id=5057#r2663
2014-11-01 21:25MixaillNote Edited: 0005057bug_revision_view_page.php?bugnote_id=5057#r2664
2014-11-02 10:15MixaillNote Added: 0005058
2014-11-02 10:16MixaillStatusnew => resolved
2014-11-02 10:16MixaillFixed in Version => 0.dev
2014-11-02 10:16MixaillResolutionopen => fixed
2014-11-02 10:16MixaillAssigned To => Mixaill
2014-12-25 13:34WarmongerStatusresolved => new
2014-12-25 13:34WarmongerStatusnew => resolved
2014-12-25 13:34WarmongerFixed in Version0.dev => 0.97b
2022-04-12 09:17PovelitelStatusresolved => closed

Notes
(0005043)
josch   
2014-10-31 09:44   
There is a second reason why vcmi in git currently fails to build from source. After having removed the #include line mentioned in my original report, I ran into the following second problem:

[ 94%] Building CXX object AI/VCAI/CMakeFiles/VCAI.dir/Fuzzy.cpp.o
Linking CXX shared library libVCAI.so
/usr/bin/ld.bfd.real: ../FuzzyLite/fuzzylite/bin/libfuzzylite-static.a(IntegralDefuzzifier.cpp.o): relocation R_X86_64_32S against `_ZTVN2fl19IntegralDefuzzifierE' can not be used when making a shared object; recompile with -fPIC
../FuzzyLite/fuzzylite/bin/libfuzzylite-static.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
AI/VCAI/CMakeFiles/VCAI.dir/build.make:247: recipe for target 'AI/VCAI/libVCAI.so' failed
make[2]: *** [AI/VCAI/libVCAI.so] Error 1
CMakeFiles/Makefile2:760: recipe for target 'AI/VCAI/CMakeFiles/VCAI.dir/all' failed
make[1]: *** [AI/VCAI/CMakeFiles/VCAI.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2

It seems that the same commit that introduced the #include also removed the lines that add -fPIC to the COMPILE_FLAGS if built on UNIX. But without -fPIC, fuzzylite does not build on linux. Why was this removed? Since it was a conditional, platform dependent statement in AI/FuzzyLite/fuzzylite/CMakeLists.txt, why did it have to be removed for MSVS support?
(0005049)
Warmonger   
2014-11-01 08:00   
If you are on Linux and it doesn't work for you, then you fix it. I didn't see or touch any flags.
(0005051)
josch   
2014-11-01 08:26   
Your commit c87f2cda with subject "Updated build for MSVS. Some compile fixes to FuzzyLite source." removed the conditional set_target_properties which set the COMPILE_FLAGS on unix in the file AI/FuzzyLite/fuzzylite/CMakeLists.txt.

I have no problem creating patches that fix the issues, but I first wanted to discuss this issue with you because otherwise my fixes for linux will not make it work on windows. Thus it would need to know the reason for your changes that made it fail to compile for me as I described above. Only then will it be possible to come up with a solution that works on both platforms at the same time.
(0005057)
Mixaill   
2014-11-01 18:19   
(edited on: 2014-11-01 21:25)
Should be fixed in Pull Request 49 https://github.com/vcmi/vcmi/pull/49 [^]

(0005058)
Mixaill   
2014-11-02 10:15   
Fixed in git