Too close to another building rust фундамент

Обновлено: 25.04.2024

Rust implements its own userspace "stack guard", the purpose is to print a nice error message about "stack overflow" rather than segfault. This is applied to each new thread, as well as the main thread:

The start address of the stack is calculated effectively via pthread_attr_getstack (pthread_getattr_np (pthread_self))

This is where the problems occur. pthread_getattr_np is not defined by POSIX and the manual page does not specifically define what the exact behaviour is when getting the attributes of the main thread. It works fine for non-main threads because they are usually created with a fixed-sized stack which does not automatically expand. So the start address is pre-defined on those threads.

However on Linux (and other systems) the real size of the main stack is not determined in advance; it starts off small and then gets automatically expanded via the process described in great detail in recent articles on the stack-clash bug. In practise, with glibc the above series of function calls returns top-of-stack - stack-rlimit when called on the main thread. This is 8MB by default on most machines I've seen.

However, most of the space in between is not allocated at the start of the program. For example, a test "Hello World" Rust program has this (after init):

with ulimit -s unlimited it looks like this:

OTOH, the Linux stack guard is not a physical guard page but just extra logic that prevents the stack from growing too close to another mmap allocation. If I understand correctly: Contrary to the get_stack_start function, it does not work based on the stack rlimit, because this could be unlimited. Instead, it works based on the real size of the existing allocated stack. The guard then ensures that the next-highest mapped page remains more than stack_guard_gap below the lowest stack address, and if not then it will trigger a segfault.

On ppc64el Debian and other systems (Fedora aarch64, Fedora ppc64be, etc) the page size is 64KB. Previously, stack_guard_gap was equal to PAGESIZE. Now, it is 256 * PAGESIZE = 16MB, compared to the default stack size limit of 8MB. So now when Linux tries to expand the stack, it sees that the stack is only (8MB - $existing-size) away from the next-highest mmapped page (Rust's own stack guard) which is smaller than stack_guard_gap (16MB) and so it segfaults.

The logic only "didn't fail" before because the stack_guard_gap was much lower than the default stack rlimit. But even here, it would not have been able to perform its intended purpose of being able to detect a stack overflow, since the kernel's stack-guard logic would have caused a segfault before the real stack ever expanded into Rust's own stack guard.

In case my words aren't the best, here is a nice diagram instead:

[..] are mapped pages. Now, Linux's stack guard will segfault if there is anything between G and S. For Rust, its own stack guard page at A causes this. Previously, G-S was much smaller and A was lower than G.

AIUI, Linux developers are talking at the moment about the best way to "unbreak" programs that do this - they try not to break userspace. But it is nevertheless incorrect behaviour by Rust to do this anyways, and a better way of doing it should be found. Unfortunately I don't have any better ideas at the moment, since the very notion of "stack start address" for main threads is apparently not set in stone by POSIX or other standards, leading to this sort of misunderstanding between kernel vs userspace on where the "start" really is.

Вопрос по строительству в игре rust

Вообщем ставлю фундамент и не могу поставить опору по углам фундамента, она ставится только в центре ячейки фундамента, из-за этого я не могу поставить стены, почему так кто поможет ?

Голосование за лучший ответ

. Может потому-что стены больше не требуют Пилларов? Взять проверить? Нет Зачем, я лучше задам вопрос в интернете.

Смени АккаунтУченик (95) 5 лет назад

тоесть они не нужны? я просто первый день играю

Олег Мыслитель (5218) Да они не нужны. Опоры в данный момент используются чисто для того если хочешь сделать какой-нибудь тоннель без стен, чисто потолки. Если не будет опор каких-либо, тогда они просто обрушатся.

Давно не заходил наверное? Вообще-то давно уже обновили этот момент, что опоры теперь ставятся по центру блока для увеличения стабильности потолков/полов. А стены ты не можешь поставить, видимо, по каким-то другим причинам.

Too close to another building rust фундамент

Is it possible to override the test/check methods inside the Component.UpdatePlacement(. ) method (used for placement e.g.: foundations)? [maybe wrong section, sorry if thats the case]

What I want to achieve:
When a player has a certain permission (or some other conditions are allowing him to), he sould be able to "ignore" placement errors like "Placing through rock" or "Too close to another building". Unfortunately, I didn't find anything to allow such behaviour (if I just was completely blind, ignore the stuff below and please tell me how to do this ^^).

Looking through Rust using dnSpy, I found the method mentioned above . Could you add hooks to override the default behaviour? Something like this probably (I'm not exactly sure how the "hooks" should look like or if it is "easy" to implement):

If thats not possible (like if you "just insert IL code" when nescessary or at the beginning of a method), maybe this could be an alternative:

(for the other (not mentioned) methods called inside the "UpdatePlacement" method something like this would be also great)

Also I dont know how the client would behave if this logic was changed. But.. lets try?

Wulf uMod Admin Posted 1 year ago Last updated 1 year ago

Sorry for the delay in providing a reply. Some of those checks may be handled client-side as well, so I'm unsure if those particular ones would work how you'd like. I can try adding something to test with, but no guarantees.

Were you wanting just those two particular areas?

Rurido Original Poster
Posted 1 year ago Last updated 1 year ago

No problem, in these times we have all the time :)

All would be great, but I think not all are nescessary. I'll provide you a prioritized list down below (from high to low):

bool BuildingProximity . Check
bool DeployVolume . Check
bool Construction . TestPlacingCloseToRoad
bool BasePlayer . IsBuildingBlocked - there are multiple methods but the one used by construction is ( Vector3 , Quaternion , Bounds )
bool Construction . TestPlacingThroughRock
bool Construction . TestPlacingThroughWall

Wulf uMod Admin Posted 1 year ago

Would a single check suffice?


Rurido Original Poster
Posted 1 year ago Last updated 1 year ago

Technically yes, but then I wouldn't know which "error" would normally occur . unless I "copy/paste" the code from dnSpy.
It is definitely an option tho.

Hey Wulf, how can I get my hands on this - could you release a Test-Build?

Wulf uMod Admin Posted 1 year ago Rurido Hey Wulf, how can I get my hands on this - could you release a Test-Build?

It was in a build, but it was causing an issue that we haven't been able to fix yet.

Rurido Original Poster
Posted 1 year ago That's unlucky. Any way to assist you? [No pressure ;)] Wulf uMod Admin Posted 1 year ago Probably not. The hook location should have worked, but for some reason is causing an error. This hasa been an issue with the patcher before, so it may be something that needs to get fixed in the patcher, else possible settle for a different hook location. Rurido Original Poster
Posted 1 year ago Does the patching fail or is there an error when running the game/mod? Wulf uMod Admin Posted 1 year ago There's an error when running the server due to the IL. Rurido Original Poster
Posted 1 year ago Last updated 1 year ago

What would I need to patch, build and test oxide locally?

I found your injection code (removed) in commit 74aa59a7b821994be5cf3ff9588bf8ee1d5a2e8a. If I edit the Rust.obj, how would I patch the dlls? Also you mentioned that there may be an issue with the patcher - which script does the patching/how would I get it running?

If its too much to explain then nvm, but I think/hope I could help.

2 weeks after Rurido Original Poster
Posted 1 year ago

If the hook you created doesnt work on this position, could you try to add it before " ! target . valid " or after " common . FindMaleSockets ( target , list ); "?
If this still doesnt work, could you add the hook at the locations mentioned earlier?

Rurido

No problem, in these times we have all the time :)

All would be great, but I think not all are nescessary. I'll provide you a prioritized list down below (from high to low):

bool BuildingProximity . Check
bool DeployVolume . Check
bool Construction . TestPlacingCloseToRoad
bool BasePlayer . IsBuildingBlocked - there are multiple methods but the one used by construction is ( Vector3 , Quaternion , Bounds )
bool Construction . TestPlacingThroughRock
bool Construction . TestPlacingThroughWall

Building decaying Rust что делать

Раньше (пару лет назад) процесс гниения был необратим. Каждый день вы обязательно должны были заходить в игру, чтобы отремонтировать гниющие элементы своей базы. Это была абсолютно необходимая профилактика. Исключения составляли лишь те сервера с модами, где устанавливался плагин «Nodecay». Он существует и по сей день, но уже ни так популярен, потому что разработчики сами решили проблему.

Как вы знаете, в игре есть шкаф с инструментами. Это довольно большая деревянная коробка, похожая на холодильник, установка которой запрещает неавторизованным в ней игрокам строиться в радиусе пятидесяти метров. Раньше шкаф нужен был исключительно для блокировки строительства. То есть, банально для того, чтобы к вашему дому никто не смог подстроиться и начать рейдить с крыши или, что ещё хуже, чтобы рейдер просто не залез в окно на втором этаже.

Сегодня в шкаф можно складывать любую разновидность ресурсов, начиная от угля, заканчивая металлом высокого качества. Зачем это придумано? Чтобы предотвращать гниение! Вы складываете в шкаф те ресурсы, из которых построен ваш дом, и он прекращает разваливаться, а надпись «Building decaying» пропадает из поля зрения.

Если вы загляните внутрь шкафа, там вас сообщится, что именно и в каком количестве необходимо, чтобы предотвратить гниение на одни реальные сутки, то есть, на 24 часа. Чем больше ваше строение, тем оно прожорливее. Содержать огромные замки невыгодно.

Building decaying в Rust. Что делать?

Предположим, вы построили дом из камня, установили в нём железные двери и деревянные решётки на окнах. Если положить в шкаф только камень, забыв о дереве и железе, спустя час – полтора реального времени решётки с дверями сломаются. Случиться это может, кстати говоря, прямо на ваших глазах. Если будете внутри дома или поблизости, услышите характерный треск.

Рекомендую вам закидывать в шкаф ресурсы с запасом. Как только построили соломенный каркас, сразу ставьте на него шкаф и кладите тысячу дерева внутрь. На шкаф, как на дверь, можно прицепить замок. Сделать это стоит, хотя бы, потому что он разбивается ни так легко, как большие деревянные ящики для хранения ресурсов. Если рейдеры до него доберутся, то им проще будет его взорвать или расстрелять разрывными патронами. Соответственно, окупаемость рейда вы установкой замка на ящик хоть как-то понизите.

После улучшения постройки до уровня камня или железа, кладите в ящик запас соответствующего ресурса, которого хватит на месяц. Учтите, если захочется расшириться, лучше проверьте, как это повлияет на потребность в ресурсах. Возможно, вы сократите время жизни постройки с месяца до одного дня, если расширитесь кардинально.

Шкаф лучше прятать за дверями. Если вы играете на сервере без модов или без плагина «Remove», то за стенами его, понятное дело, лучше не прятать. Особенно, если планируется расширение или привлечение других игроков для создания команды. Без авторизации в ящике они ничего не смогут делать в вашем доме, даже поставить костёр будет невозможно.

На какую кнопку строить в Rust

Если вы не знаете, на какую кнопку строить в Rust, то, очевидно, вы совсем не в курсе, как система строительства устроена в этой игре. Пришло время научиться. Читайте гайд внимательно, от начала и до конца.

Первое, что нам понадобится для возведения построек, это «План строительства». Его можно скрафтить из меню быстрого доступа. Нажмите «Q» и оно будет в правом нижнем углу открывшегося окна. Картинка снизу поможет сориентироваться.

На какую кнопку строить в Rust

Нажимаем по этому синему свитку, ждём, когда он появится в инвентаре, перемещаем его в одно из нижних гнёзд инвентаря мышкой, как ярлык на рабочем столе

На какую кнопку строить в Rust

Как вы, возможно, уже догадались, гнёзда пронумерованы, потому что доступ к ним вы получаете, когда нажимаете на клавиатуре цифры от одного до шести. То есть, предмет, находящийся в гнезде под номером «1», после нажатия такой кнопки помещается персонажу в руки.

На какую кнопку строить в Rust

Я это пояснил, потому что дальше нужно взять план постройки в руки. Когда сделаете это, нажмите Правую клавишу мыши и не отпускайте. На экране появится меню, в котором выбираются элементы здания. Переключение между ними осуществляется путём движения мыши вправо, влево, вверх или вниз. Когда выберите то, что хотите построить, наведите мышь, и щелкните левой кнопкой.

На какую кнопку строить в Rust

Начинают с фундамента. Он выбран в плане по умолчанию. Найдите ровное место, где фундамент будет подсвечен синим цветом, и нажимайте ЛКМ. Поздравляю! Вы провели первую строительную работу в Rust.

Заключение

Создаём план, используем его как оружие. Меню доступных построек открывается на правую кнопку мыши, когда план в руках. Возведение постройки делает нажатие ЛКМ. Так же советую сразу после стройки скрафтить «шкаф с инструментами», поставить его в своём доме и поместить внутрь него ресурсы, из которых сделан дом. Так вы предотвратите гниение постройки.

Параллельно возведению соломенного каркаса улучшайте строение в дерево, камень или металл. Улучшение делается при помощи киянки. Её тоже можно скрафтить в меню быстрого доступа, как и план строительства. К слову, двери и замки делаются так же.

Чтобы прокачать здание, возьмите в руки киянку, подойдите, например, к стене, зажмите «E», наведите мышью на камень или дерево, щелкните ЛКМ. Произойдёт мгновенное преображение соломы в камень.

Остерегайтесь других игроков. Обычно для тех, у кого опыта в игре много, новички, занимающиеся стройкой – лишь лёгкая мишень. Я советую не хранить все добытые ресурсы в инвентаре во время стройки. Лучше киньте их в ближайший куст. Они долго не исчезнут. По крайней мере, их не заберёт кто-то другой, если вас убьёт. Пусть лучше ресурсы не достаются никому.


163


67

Описание ошибок и их решения

1 . Проблема:

  • Вылетает игра при запуске, на стадии Bootstrap Warmup
  • Вылетает игра при запуске, на стадии Bootstrap Systems
  • Вылетает игра при запуске, на стадии Running self check
  • Вылетает игра при вводе IP в консоль.
  • При вводе IP в консоль появляется ошибка No Token Data.

Решение:

2 . Проблема:

  • Вылетает игра при запуске, на стадии Bootstrap Shaders

Решение:

Обновите драйвера для видеокарты, также установите полный пакет Microsoft Visual C++ и Net framework 4.5.2 затем запускайте игру с максимальными настройками графики.

3 . Проблема:

  • При подключении к серверу Wrong connection protocol: Client update required!

Решение:

У вас старая версия, скачайте актуальную версию клиента.

4 . Проблема:

  • Загрузка карты зависла, ошибка Oops! "The game crashed" или в консоли Out of memory.

Решение:

Игре не хватило оперативной памяти. Для нормальной игры нужно, как рекомендуют разработчики 64-разрядную Windows и не менее 4-6 гб ОЗУ. Также возможны вылеты на рабочий стол без каких либо ошибкок ( возможно из-за нехватки оперативной памяти)

Фундамент в игре Rust (Experimental)

Фундамент в Rust

Фундамент в Rust

О том, как выбрать правильное и более безопасное место для дома мы поговорим в другой статье, а пока рассмотрим строительство дома в целом.

Примечание: выберите фундамент в строительном плане и нажмите правой кнопкой мыши, в появившемся меню вы увидите другие виды строительных объектов. Пользуйтесь на здоровье!

Как сделать фундамент в Rust Experimental

Сначала выбираете на поясе план фундамента и находите подходящее место для установки проекта.

Place Foundation Project

Установка проекта фундамента

Проект фундамента

Проекты можно устанавливать друг за другом, пристыковывать с любой стороны. Получая вот такие конструкции.

Foundation Labirinth

После того, как вы установили проект фундамента, вы можете либо уничтожить его для выбора другого места, для чего просто ударьте его любым оружием, либо построить фундамент специальным молотком (Hammer).

Foundation in Process

Создание фундамента в Rust Experimental

Готовый фундамент в Rust Experimental

Готовый фундамент в Rust Experimental

Важно обратить внимание, что строительство фундамента, как и всего остального стоит денег. О том, сколько чего необходимо для строительства фундамента, вы увидите в момент нахождения рядом со строящимся объектом в правом верхнем углу.

Build Cost

Стоимость строительства фундамента

Сколько ресурсов нужно для фундамента

Итак, теперь подведем итог. Сколько же чего нужно для того, чтобы мы смогли построить фундамент в игре Rust Experimental?

Rust: How To Save Your Buildings From Decay

Losing it to a raid is one thing, but to the elements? That's preventable. This guide will help you avoid losing your buildings to decay in Rust.

After somehow managing to drag yourself off the beach, cobble together some basic tools, and scrape together enough materials to build yourself a base in Rust, the last thing you want is to come back home and realize it has fallen apart. And no, we're not talking about other players finding your little abode and tearing it down just for the fun of it, although that is also likely to happen. Rust doesn't want you to get too comfortable at any point, which is where the decay mechanic comes in. Instead of spending your nights out in the cold, learn how to save your buildings from decay with our guide.

How To Save Your Buildings From Decay

Decay was added to the game initially to prevent players from building endlessly large and elaborate structures on the maps. Not only was this not in line with the whole survival aspect of the game, but also was a major strain on servers. This simple solution simply causes any player build structure to have a time limit on it that, once it expires, will slowly rot away a structure until it is destroyed. Depending on what part breaks, decay can cause an entire structure to fall apart if the decayed section was holding up other parts.

Decay works differently depending on what the structure is made of. The better materials you build with, the longer it will last. But that doesn't mean everything you build is doomed to fall necessarily. You do have options for keeping your base functional for as long as you can manage the upkeep. Just make sure you repair it before it fully collapses. Once a structure goes down, there's no bringing it back.

The first method is simple but time-consuming. If you craft yourself a hammer you can use that, along with enough raw resources, to repair individual parts of your base from decay and damage. For example, if you have a wooden shelter, hammering a wall will chew through your wood reserve, and a metal structure will require metal fragments. Simple, but you do need to keep an eye on all parts of your base, and it can be quite a chore.

The more efficient, and far easier, way to keep your buildings standing tall is to invest in a tool cupboard. These items cost a full 1,000 wood to craft but are worth far more than that. Not only does it prevent other players from building too close to your base, but it can also do all that repair work for you automatically.

All you have to do, after crafting and placing down your tool cupboard, is stock it full of whatever material your base is made of. Just like with your hammer, it will use those resources to hold off decay as long as you keep it stocked up. Fill it up with a big stack of wood, stone, or metal, and you can go about your business without worrying about coming home to a pile of rubble.

In config.toml , under [target.x86_64-unknown-linux-gnu] , one can set cc and cxx to configure the C/C++ compiler used for building LLVM.

My system uses LLVM 8.0.0 Release. ( clang version 8.0.0 (tags/RELEASE_800/final) | Target: x86_64-solus-linux )

Original Issue Text:

I am currently trying to build rust on a Solus 4 machine.

The error happens in stage 0 when building LLVM, where it complains about an incompatible version of libstdc++, even if use-libcxx = true is set under [llvm] .

Dependencies (g++ clang++ python make cmake curl git):

x.py build --stage 0 output:

The text was updated successfully, but these errors were encountered:

LunarLambda commented Aug 10, 2019

I did successfully* build a checkout of LLVM on my system

*: This ended up taking much much longer than I expected, it's at 97% and my machine is suffering immensely. But I think if I leave it overnight it'll finish.

I was however informed that Rust actually has its own fork of LLVM, so I will try building that tomorrow, as it's approaching midnight here.

I'll report back, but the bottom line is that unmodified LLVM does indeed build.

Mark-Simulacrum commented Aug 10, 2019

Hm, interesting. Presumably our detection and threading through of the C++ STL is wrong then.

I don't think I need to go through the entire build again, but it does appear to be working just fine.

I also tested the binaries produced by last night's LLVM build to make sure they actually work, and they do.

The error with x.py happens when configuring LLVM, not when actually compiling it, so I think this is issue is on our side.

Mark-Simulacrum commented Aug 11, 2019

Lines 427 to 436 in 2b78e10

let mut cxxflags = builder. cflags (target, GitRepo :: Llvm). join ( " " );
if builder.config.llvm_static_stdcpp &&
! target. contains ( "windows" ) &&
! target. contains ( "netbsd" )
cxxflags. push_str ( " -static-libstdc++" );
>
if let Some ( ref s) = builder.config.llvm_cxxflags
cxxflags. push_str ( & format! ( " <>" , s));
>
Hmm, I can take a look but I'm not sure I'll be able to find anything. This is/was my first time trying to build Rust from source (my original plan was to submit a pr to the stdlib, actually. ) All I can say is that cmake is looking for libstdc++ 4.8 or up, but doesn't recognize my installed libstdc++ 6.0 for some reason. I'll see if I can find anything tonight. How can I trigger a rebuild when modifying that file? Does x.py handle it?

Mark-Simulacrum commented Aug 11, 2019

Since LLVM isn't building presumably it'll just work, otherwise, rm -r build/x86_64-unknown-linux-gnu/llvm should work.

LunarLambda commented Aug 11, 2019

I can't really find anything wrong with the snippet you linked

FWIW I ran it again with backtrace enabled:

I don't really know how to approach this issue right now

Which files are responsible for running CheckCompilerVersion, which is mentioned in the CMake error? ( CMake Error at cmake/modules/CheckCompilerVersion.cmake:83 )

Mark-Simulacrum commented Aug 11, 2019

Yeah, I'm also at a loss. AFAICT, the check is happening as a normal part of the LLVM build.

LunarLambda commented Aug 11, 2019

The test that fails in particular is LLVM_LIBSTDCXX_MIN

The particular test says:
Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.

The bizarre thing is that

I ran nm -D /usr/lib64/libstdc++.so | grep _ZNKSt17bad_function_call4whatEv

And it matches!
00000000000c8510 T _ZNKSt17bad_function_call4whatEv

And that test is behind a elseif(NOT LLVM_ENABLE_LIBCXX) gate

And my config.toml has

So this flag in particular seems to not get passed correctly.

And looking around the same file, this test is only ever run to begin with if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") .

So I guess I'll make a fresh checkout and set everything to compile with gcc/g++ instead?

And it is building. So for some reason

I'm at a loss, but it's compiling now, so. hooray?

I think this should still be looked into, as there is almost definitely some kind of bug here. Although it may be an upstream bug, I'm not sure anymore.

LunarLambda changed the title Cannot build on system with libstdc++ 6 Aug 11, 2019 Contributor

mati865 commented Aug 11, 2019

Just making sure, does it work when use-libcxx = true is commented out or set to false?
To use libc++ on Solus you need llvm-devel package among the others.

Clang has few tricks to detect system libstdc++ and that should work just fine but CMake sometimes get confused when compilation options are changed and mixes old config with the new one.

Aw shucks, I think I missed that package. Though, the value of `use-libcxx` didn't seem to matter, as it was setting cc/cxx to clang/clang++ on the first build (prior to setting `use-libcxx`) that caused the issue. So, I'm guessing Clang looks for the libc++ headers regardless if it's actually linking to it or not? Which would seem odd to me, but that might be the case. I'll give it another go tomorrow, maybe this was all a big goof on my part, in which case I'm very sorry for the confusion caused. Also yes, as I said above I did a clean checkout earlier and compiled strictly with gcc/g++/libstdc++ and it worked fine. It's likely I fudged up with the missing header package, will try tomorrow. My only defense is that the error message was wildly misleading in what the actual issue was. I had seen the include error but given I had a working set of headers that Clang was happy to use in test programs I wrote I marked it off as CMake being weird, not making the connection that the test failed because it didn't compile.

Scratch most of that, I do have llvm-devel installed.

Unfortunately rebuilding LLVM also requires throwing out the entire stage 0 artifacts, which take

30 minutes to download / build on my system

It seems to be some kind of issue with clang's command line options. specifically, I'm not sure if -stdlib=libc++ is being passed correctly.

Читайте также: