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

Building on Linux #974

Open
FewerToWhom opened this issue Jan 16, 2024 · 11 comments
Open

Building on Linux #974

FewerToWhom opened this issue Jan 16, 2024 · 11 comments

Comments

@FewerToWhom
Copy link

Greetings!

I have tried building the code on Manjaro Linux using gcc 13.2.1. However, when the compilation process gets to main.cpp
it uses all my available RAM until the compilation itself crashes. Upon looking into main.cpp itself, I have noticed that it is
quite massive, and seems to include most(?) cpp files within the project.

I tried breaking it into different files with only some of the includes, but it would either not work due to some definition not
being found, or would also use all available RAM. It seems that the dependencies amongst the files are quite non-trivial.

It'd probably help development and testing if we could break the compilation into smaller parts.

@yrrrmmbl
Copy link
Contributor

main.cpp is very scuffed indeed. maybe you can try building the IncrementalAlice target as that already has some of the source files as seperate translation units. i dont think that it will help alot since most of the code is still in 2-3 big translation units. you can maybe use a swap file to prevent it from crashing.

@FewerToWhom
Copy link
Author

After quite some time and using a swap file, it compiled. However, running either Alice or AliceIncremental results in a segmentation fault after about 30s, with no screen or anything being displayed...

@schombert
Copy link
Owner

are you on an older cpu? You might want to try targeting an older cpu architecture combined with the changes leaf made today

@FewerToWhom
Copy link
Author

I'm on a Core i7-10750H -- not too old, I hope

@schombert
Copy link
Owner

Well, if you can isolate where the crash is occurring, maybe we can give you more help based on that

@FewerToWhom
Copy link
Author

Other than using GDB, which I'm a bit scared to do here, given the size of the project, how else could I isolate it?

@schombert
Copy link
Owner

I know of no easier way than using a debugger. At least on windows, I haven't seen debuggers have more trouble with larger projects.

@FewerToWhom
Copy link
Author

Ok, I hadn't realised the code was already built with debug symbols by default.

#0  0x0000555556329fb1 in _mm256_store_ps(float*, float __vector(8)) (__A=..., __P=0x555558ce4000) at /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include/avxintrin.h:887
#1  ve::store<dcon::province_id> (values=..., dest=0x555558b44e00, e=...) at /home/grilo/tmp/Project-Alice/build/_deps/datacontainer-src/CommonIncludes/ve_avx2.hpp:1391
#2  dcon::data_container::province_set_demographics (values=..., n=..., id=..., this=0x55555694f8c0 <game_state>) at /home/grilo/tmp/Project-Alice/src/gamestate/dcon_generated.hpp:61036
#3  demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1}::operator()<ve::contiguous_tags<dcon::province_id> >(ve::contiguous_tags<dcon::province_id>) const (pi=..., __closure=0x7fffffffc120) at /home/grilo/tmp/Project-Alice/src/economy/demographics.cpp:77
#4  ve::execute_serial_fast<dcon::province_id, demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1} const&>(unsigned int, demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1} const&) (functor=..., count=4294967288) at /home/grilo/tmp/Project-Alice/build/_deps/datacontainer-src/CommonIncludes/ve.hpp:127
#5  ve::execute_serial<dcon::province_id, demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1} const&>(unsigned int, demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1} const&) (functor=..., count=<optimized out>) at /home/grilo/tmp/Project-Alice/build/_deps/datacontainer-src/CommonIncludes/ve.hpp:149
#6  province::ve_for_each_land_province<demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1}>(sys::state&, demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&)::{lambda(auto:1)#1} const&) (state=..., func=...) at /home/grilo/tmp/Project-Alice/src/provinces/province_templates.hpp:26
#7  0x000055555632a1fe in demographics::sum_over_demographics<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1}>(sys::state&, dcon::demographics_key, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const::{lambda(sys::state const&, dcon::pop_id)#1} const&) (state=..., key=key@entry=..., source=...) at /home/grilo/tmp/Project-Alice/src/economy/demographics.cpp:77
#8  0x0000555556504348 in demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}::operator()(unsigned int) const (__closure=<optimized out>, base_index=0)
    at /home/grilo/tmp/Project-Alice/src/economy/demographics.cpp:156
#9  tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>::operator()(tbb::detail::d1::blocked_range<unsigned int> const&) const (r=..., this=0x555558cd47d0) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:208
#10 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>::run_body(tbb::detail::d1::blocked_range<unsigned int>&) (r=..., this=0x555558cd4780)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:119
#11 tbb::detail::d1::dynamic_grainsize_mode<tbb::detail::d1::adaptive_mode<tbb::detail::d1::auto_partition_type> >::work_balance<tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>, tbb::detail::d1::blocked_range<unsigned int> >(tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>&, tbb::detail::d1::blocked_range<unsigned int>&, tbb::detail::d1::execution_data&) (this=this@entry=0x555558cd47e8, start=..., range=..., ed=...)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/include/oneapi/tbb/partitioner.h:447
#12 0x0000555556504502 in tbb::detail::d1::partition_type_base<tbb::detail::d1::auto_partition_type>::execute<tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>, tbb::detail::d1::blocked_range<unsigned int> >(tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>&, tbb::detail::d1::blocked_range<unsigned int>&, tbb::detail::d1::execution_data&) (ed=..., range=..., start=..., this=0x555558cd47e8)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/include/oneapi/tbb/partitioner.h:288
#13 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>::execute(tbb::detail::d1::execution_data&) (this=0x555558cd4780, ed=...)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:172
#14 0x00005555565946db in tbb::detail::r1::task_dispatcher::local_wait_for_all<false, tbb::detail::r1::external_waiter> (waiter=..., t=0x555558cd4780, this=0x555558a9d700)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/task_dispatcher.h:322
#15 tbb::detail::r1::task_dispatcher::local_wait_for_all<tbb::detail::r1::external_waiter> (waiter=..., t=<optimized out>, this=0x555558a9d700)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/task_dispatcher.h:463
#16 tbb::detail::r1::task_dispatcher::execute_and_wait (t=<optimized out>, wait_ctx=..., w_ctx=...) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/task_dispatcher.cpp:168
#17 0x0000555556594ac2 in tbb::detail::r1::execute_and_wait (t=..., t_ctx=..., wait_ctx=..., w_ctx=...) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/task_dispatcher.cpp:121
#18 0x00005555560e3c52 in tbb::detail::d1::execute_and_wait (w_ctx=..., wait_ctx=..., t_ctx=..., t=...) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/include/oneapi/tbb/detail/_task.h:191
#19 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>::run(tbb::detail::d1::blocked_range<unsigned int> const&, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int> const&, tbb::detail::d1::auto_partitioner const&, tbb::detail::d1::task_group_context&) (context=..., partitioner=..., body=<synthetic pointer>..., 
    range=<synthetic pointer>...) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:114
#20 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>::run(tbb::detail::d1::blocked_range<unsigned int> const&, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int> const&, tbb::detail::d1::auto_partitioner const&, tbb::detail::d1::task_group_context&) (context=..., partitioner=..., body=<synthetic pointer>..., 
    range=<synthetic pointer>...) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:106
#21 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int>, tbb::detail::d1::auto_partitioner const>::run(tbb::detail::d1::blocked_range<unsigned int> const&, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int> const&, tbb::detail::d1::auto_partitioner const&) (partitioner=..., body=<synthetic pointer>..., range=<synthetic pointer>...)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:103
#22 tbb::detail::d1::parallel_for<tbb::detail::d1::blocked_range<unsigned int>, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int> >(tbb::detail::d1::blocked_range<unsigned int> const&, tbb::detail::d1::parallel_for_body_wrapper<demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, unsigned int> const&, tbb::detail::d1::auto_partitioner const&) (partitioner=..., body=<synthetic pointer>..., range=<synthetic pointer>...)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:247
#23 tbb::detail::d1::parallel_for_impl<unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, tbb::detail::d1::auto_partitioner const>(unsigned int, unsigned int, unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1} const&, tbb::detail::d1::auto_partitioner const&) (first=0, step=1, partitioner=..., f=..., last=23)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:316
#24 tbb::detail::d1::parallel_for_impl<unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}, tbb::detail::d1::auto_partitioner const>(unsigned int, unsigned int, unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1} const&, tbb::detail::d1::auto_partitioner const&) (partitioner=..., f=..., step=1, last=23, first=0)
    at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:308
#25 tbb::detail::d1::parallel_for<unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1}>(unsigned int, unsigned int, demographics::regenerate_from_pop_data<true>(sys::state&)::{lambda(unsigned int)#1} const&) (f=..., last=23, first=0) at /home/grilo/tmp/Project-Alice/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/parallel_for.h:355
#26 demographics::regenerate_from_pop_data<true> (state=...) at /home/grilo/tmp/Project-Alice/src/economy/demographics.cpp:143
#27 0x0000555555c14bea in demographics::regenerate_from_pop_data_full (state=...) at /home/grilo/tmp/Project-Alice/src/economy/demographics.cpp:709
#28 sys::state::fill_unsaved_data (this=this@entry=0x55555694f8c0 <game_state>) at /home/grilo/tmp/Project-Alice/src/gamestate/system_state.cpp:3615
#29 0x0000555555d4ad8c in sys::state::load_scenario_data (this=this@entry=0x55555694f8c0 <game_state>, err=...) at /home/grilo/tmp/Project-Alice/src/gamestate/system_state.cpp:3417
#30 0x00005555557ce742 in main (argc=1, argv=0x7fffffffdb18) at /home/grilo/tmp/Project-Alice/src/entry_point_nix.cpp:68

Well, it seems the issue is storing a packed float. Perhaps the memory alignment is not correct?

@wxwisiasdf
Copy link
Contributor

You need a scenario that matches the Alice version you're building
Try using latest commit, and using a scenario made with launch_alice(on windows)

vanilla scenario below (with 1.0.6):

CBAB7B56-0.zip

@wxwisiasdf
Copy link
Contributor

Don't forget to copy over the assets folder too

@yrrrmmbl
Copy link
Contributor

yrrrmmbl commented Feb 3, 2024

@FewerToWhom did you follow the building instructions ? i think the issue is that there is no victoria 2 folder at GAME_DIR. you need to create a local_user_settings.hpp with content specified in the building guide. or if you are building release the binary needs to be in the vic2 folder.

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