# Add flags when cross-compile Linux from Windows

**URL:** <https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264>\
**Category:** Platform & Builds\
**Tags:** windows, Linux, unreal-engine, Plugins, UE4, question\
**Created:** [August 22, 2019, 7:21pm UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264 "2019-08-22T19:21:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juaxix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/juaxix/32/980565_2.png) [@juaxix](https://forums.unrealengine.com/u/juaxix)\
**Post date:** [August 22, 2019, 7:21pm UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264/1 "2019-08-22T19:21:36Z")

</div>

I’m trying to compile Photon for Linux using crosscompile, but I got this errors

> **[photon unreal cross compilation error - Pastebin.com](https://pastebin.com/bmn88fak)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

The major problem is that photon is compiled with gcc but the compiler used by Unreal is clang++, so the error showed a lot of times is:

```
undefined symbol: std::ios_base::Init::Init()

```

More info:

> **[Linux Linking Issue: undefined reference to symbol...](https://forum.photonengine.com/discussion/13669/linux-linking-issue-undefined-reference-to-symbol-znst8ios-base4initd1ev-glibcxx-3-4)**
>
> Hi, I'm trying to compile our projects' linux version with the Photon SDK but I'm getting the following error : /usr/bin/ld:

So in theory I have to add the flags: “-Wl,–copy-dt-needed-entries” to the build line but I don’t know how to add flags to the compiler, maybe it’s in the xml config?

> **[Build Configuration](https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/BuildConfiguration/)**
>
> Configure how the engine is built.

this is the compiler used :

> **[Cross-Compiling for Linux](https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/Linux/GettingStarted/)**
>
> Download the Linux cross-compile toolchain.

version 4.22 → v13 clang-7.0.1-based

what’s the correct place to do this to compile a linux plugin from windows?

thanks.

---

<div class="post-metadata">

**Author:** ![Brandon.Schaefer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brandon.Schaefer](https://forums.unrealengine.com/u/Brandon.Schaefer)\
**Post date:** [August 22, 2019, 7:55pm UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264/2 "2019-08-22T19:55:51Z")

</div>

Hello,

Yes theres no great way to add custom linker arg, the only way would be to change this file:

```
Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs

```

And in this function:

```
protected virtual string GetLinkArguments(LinkEnvironment LinkEnvironment)

```

Add this somewhere along with the other linker flags:

```
results += " -Wl,--copy-dt-needed-entries";
```

---

<div class="post-metadata">

**Author:** ![juaxix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/juaxix/32/980565_2.png) [@juaxix](https://forums.unrealengine.com/u/juaxix)\
**Post date:** [August 22, 2019, 8:03pm UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264/3 "2019-08-22T20:03:37Z")

</div>

Thanks @Brandon, do I need to recompile the engine to do that?

---

<div class="post-metadata">

**Author:** ![Brandon.Schaefer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brandon.Schaefer](https://forums.unrealengine.com/u/Brandon.Schaefer)\
**Post date:** [August 23, 2019, 1:57pm UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264/4 "2019-08-23T13:57:17Z")

</div>

Nope just need to rebuild UBT with GenerateProjectFiles

---

<div class="post-metadata">

**Author:** ![juaxix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/juaxix/32/980565_2.png) [@juaxix](https://forums.unrealengine.com/u/juaxix)\
**Post date:** [August 25, 2019, 11:04am UTC](https://forums.unrealengine.com/t/add-flags-when-cross-compile-linux-from-windows/454264/5 "2019-08-25T11:04:54Z")

</div>

Yes, I mean, you have to download the whole engine and compile it to test this?  
I would like to do it with vanila (launcher) version of the engine…
