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

Cross compile wrong binary name and extension #1523

Closed
rracariu opened this issue Aug 9, 2018 · 2 comments
Closed

Cross compile wrong binary name and extension #1523

rracariu opened this issue Aug 9, 2018 · 2 comments

Comments

@rracariu
Copy link

rracariu commented Aug 9, 2018

System information

  • dub version: dub 1.8.1
  • OS Platform and distribution: Linux
  • compiler version : ldc 1.10.0

Bug Description

When cross-compiling from a Linux host to a Windows target the library name is following the host naming convention. For example, a library project foo when compiled will generate a library named libfoo.a. This is wrong, because if you use that project as a dependency then linking will fail as the linker will be using the library that has a wrong extension. The error in this case is:

Error: unrecognized file extension a

How to reproduce?

Make sure you have the VC and Platform libraries from a Visual Studio setup, then use

DFLAGS="-mtriple=x86_64-pc-windows-msvc -link-internally" dub --compiler=ldc2

Expected Behavior

A way to specify the target platform, similar to --arch, an option --platform, to force dub to use a specific platform. For example:

DFLAGS="-mtriple=x86_64-pc-windows-msvc -link-internally" dub --compiler=ldc2 --platform=windows
@gedaiu
Copy link
Contributor

gedaiu commented Aug 10, 2018

I think dub should know how to add the compiler flags if you just provide the platform argument. This feature will not work with dmd...

@kinke
Copy link
Contributor

kinke commented Aug 25, 2019

Resolved by #1755; the switch is --arch.

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