jacob-carlborg / dstep

A tool for converting C and Objective-C headers to D modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dub run failure - ld cannot find @linker_flags.txt

JesseKPhillips opened this issue · comments

This is likely caused by the version of libclang, readme says 9 or 10 but Debian 10 only has 6 and 7 available.

Logging this so that the error is at least searchable for others.

dmd --version

DMD64 D Compiler v2.095.1

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

dub run dstep -- lctype.h -o lctype.di

## Warning for package dstep, configuration test-functional ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

debugMode: Call DUB with --build=debug
debugInfo: Call DUB with --build=debug
unittests: Call DUB with --build=unittest


## Warning for package dstep, configuration test-unit ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

debugMode: Call DUB with --build=debug
debugInfo: Call DUB with --build=debug
unittests: Call DUB with --build=unittest

Running pre-generate commands for dstep...
Performing "debug" build using /usr/bin/dmd for x86_64.
dstep 1.0.2: building configuration "default"...
Running pre-build commands...
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Enum.d(264,5): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/MacroDefinition.d(674,9): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Output.d(144,5): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Output.d(1203,13): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Output.d(1295,9): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Record.d(114,9): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
../../.dub/packages/dstep-1.0.2/dstep/dstep/translator/Record.d(146,5): Deprecation: opIn is deprecated.  Use opBinary(string op)(...) if (op == "in") instead.
Linking...
/usr/bin/ld: cannot find @linker_flags.txt: No such file or directory
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

This is likely caused by the version of libclang, readme says 9 or 10 but Debian 10 only has 6 and 7 available.

libclang 6 should work as well, it's even being tested [1]. It's just not something I want to officially support.

Here are a couple of things you can try:

  • Don't invoke DStep via dub run, I've never tried that. Instead, clone the repository, run dub build and then invoke the binary in the bin directory.
  • Manually invoke the configure script in the DStep project root. It will hopefully print any errors it encounters. This script is automatically run by Dub when building DStep.
  • Manually invoke the configure and specify the path to the root of the LLVM directory using the --llvm-path flag.

[1]

- LLVM_VERSION=6.0.0 # Used by Sociomantic

Utilizing Dstep via the first suggestion (dub build, bin/dstep) works. Failure is thus concluded to be due to using dub run.

Obviously close if this is not desired to be looked at further (I do not ask for such)

commented

Same issue on a new machine:

$ dub run dstep
Building package dstep in /home/xxx/.dub/packages/dstep-1.0.3/dstep/

## Warning for package dstep, configuration test-functional ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

debugMode: Call DUB with --build=debug
debugInfo: Call DUB with --build=debug
unittests: Call DUB with --build=unittest


## Warning for package dstep, configuration test-unit ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

debugMode: Call DUB with --build=debug
debugInfo: Call DUB with --build=debug
unittests: Call DUB with --build=unittest

Running pre-generate commands for dstep...
Performing "debug" build using /usr/bin/dmd for x86_64.
dstep 1.0.3: building configuration "default"...
Running pre-build commands...
Linking...
/usr/bin/ld: cannot find @linker_flags.txt: No such file or directory
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

@mw66 Running through Dub is currently not supported.