dlang-community / drepl

A REPL for D
Boost Software License 1.0
77 stars 22 forks source link

drepl linker error on loadLibrary #39

Open MartinNowak opened 8 years ago

MartinNowak commented 8 years ago

Issue by carljv Wednesday May 25, 2016 at 23:58 GMT Originally opened as https://github.com/drepl/drepl-old/issues/2


I'm unable to get drepl to compile. I'm getting the following error:

Undefined symbols for architecture x86_64:
  "_rt_loadLibrary", referenced from:
      _D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv in drepl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

That's with dmd. ldc thinks the problem is in engines.dmd.o (which does call loadLibrary).

Undefined symbols for architecture x86_64:
  "_rt_loadLibrary", referenced from:
      __D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv in dawg.drepl.engines.dmd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: /usr/bin/gcc failed with status: 1
ldc2 failed with exit code 1.

I'm on OS X 10.11.5 running: dmd v2.071 ldc v0.17.0 clang/llvm v7.3.0

MartinNowak commented 8 years ago

Comment by wilzbach Thursday May 26, 2016 at 00:01 GMT


Looks like linenoise isn't available and you get a terrible error message.

MartinNowak commented 8 years ago

Comment by carljv Thursday May 26, 2016 at 00:06 GMT


I don't think it's linenoise. I compiled it to a .so and was able to compile and run a test C program that used it. I'll check some more, but I've seen errors from not having linenoise and they don't look like this... The fact that loadLibrary is a D function also makes me think it's something else.

MartinNowak commented 8 years ago

Comment by wilzbach Thursday May 26, 2016 at 00:09 GMT


Do you compile with dub or manually? Maybe it helps to increase the verbosity of dub with dub --verbose?

MartinNowak commented 8 years ago

Comment by carljv Thursday May 26, 2016 at 00:47 GMT


Here's the full output from dub build --vverbose. I don't see anything more informative than the linker error from above. Are you compiling in a similar environment (OS X, dmd version, etc.)? (Thanks for the help!)

wpa4161:drepl carl.vogel$ dub build --vverbose
Using dub registry url 'http://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/carl.vogel/.dub/packages/local-packages.json
iterating dir /Users/carl.vogel/.dub/packages/
iterating dir /Users/carl.vogel/.dub/packages/ entry experimental_allocator-2.70.0-b1
iterating dir /Users/carl.vogel/.dub/packages/ entry libdparse-master
iterating dir /Users/carl.vogel/.dub/packages/ entry linenoise-master
iterating dir /Users/carl.vogel/.dub/packages/ entry pegged-master
Determined package version using GIT: drepl 0.1.0+commit.45.gabd5810
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/carl.vogel/.dub/packages/local-packages.json
iterating dir /Users/carl.vogel/.dub/packages/
iterating dir /Users/carl.vogel/.dub/packages/ entry experimental_allocator-2.70.0-b1
iterating dir /Users/carl.vogel/.dub/packages/ entry libdparse-master
iterating dir /Users/carl.vogel/.dub/packages/ entry linenoise-master
iterating dir /Users/carl.vogel/.dub/packages/ entry pegged-master
Collecting dependencies for drepl
  Found dependency libdparse ~master
  Collecting dependencies for libdparse
    Found dependency experimental_allocator 2.70.0-b1
    Collecting dependencies for experimental_allocator
  Found dependency linenoise ~master
  Collecting dependencies for linenoise
Checking for missing dependencies.
Downloading metadata for libev
Getting from http://code.dlang.org/packages/libev.json
Getting http://code.dlang.org/packages/libev.json...
Downloading metadata for libevent
Getting from http://code.dlang.org/packages/libevent.json
Getting http://code.dlang.org/packages/libevent.json...
Downloading metadata for openssl
Getting from http://code.dlang.org/packages/openssl.json
Getting http://code.dlang.org/packages/openssl.json...
Downloading metadata for vibe-d
Getting from http://code.dlang.org/packages/vibe-d.json
Getting http://code.dlang.org/packages/vibe-d.json...
Using fixed selection libdparse ~master
Using fixed selection experimental_allocator 2.70.0-b1
Using fixed selection linenoise ~master
Configurations used for dependency resolution:
  linenoise (2, required): [~master]
  experimental_allocator (1, required): [2.70.0-b1]
  libdparse (0, required): [~master]
Interation (ci=-1) libdparse ~master, experimental_allocator 2.70.0-b1, linenoise ~master
Resolved dependencies before optional-purge: ["linenoise ~master", "experimental_allocator 2.70.0-b1", "libdparse ~master"]
Resolved dependencies after optional-purge: ["linenoise ~master", "experimental_allocator 2.70.0-b1", "libdparse ~master"]
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/carl.vogel/.dub/packages/local-packages.json
iterating dir /Users/carl.vogel/.dub/packages/
iterating dir /Users/carl.vogel/.dub/packages/ entry experimental_allocator-2.70.0-b1
iterating dir /Users/carl.vogel/.dub/packages/ entry libdparse-master
iterating dir /Users/carl.vogel/.dub/packages/ entry linenoise-master
iterating dir /Users/carl.vogel/.dub/packages/ entry pegged-master
Collecting dependencies for drepl
  Found dependency libdparse ~master
  Collecting dependencies for libdparse
    Found dependency experimental_allocator 2.70.0-b1
    Collecting dependencies for experimental_allocator
  Found dependency linenoise ~master
  Collecting dependencies for linenoise
Checking for upgrades.
Using cached upgrade results...
WARNING: A deprecated branch based version specification is used for the dependency linenoise. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
Add config experimental_allocator library
Add config libdparse library
Including libdparse library -> experimental_allocator library
Add config linenoise lib
Add config drepl console
Including drepl console -> libdparse library
Including drepl console -> linenoise lib
Add config drepl library
Including drepl library -> libdparse library
Including drepl library -> linenoise lib
NON-PRIMARY:
Eliminating config library for drepl
    libdparse library -> experimental_allocator library
    drepl console -> libdparse library
    drepl console -> linenoise lib
Using configuration 'library' for experimental_allocator
Using configuration 'library' for libdparse
Using configuration 'lib' for linenoise
Using configuration 'console' for drepl
Generating using build
Creating build generator.
Add config drepl console
Add config experimental_allocator library
Add config libdparse library
Including libdparse library -> experimental_allocator library
Add config linenoise lib
Including drepl console -> libdparse library
Including drepl console -> linenoise lib
Add config drepl library
Including drepl library -> libdparse library
Including drepl library -> linenoise lib
NON-PRIMARY:
Eliminating config library for drepl
    libdparse library -> experimental_allocator library
    drepl console -> libdparse library
    drepl console -> linenoise lib
Using configuration 'console' for drepl
Using configuration 'library' for experimental_allocator
Using configuration 'library' for libdparse
Using configuration 'lib' for linenoise
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/affix_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/allocator_list.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/bitmapped_block.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/bucketizer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/fallback_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/free_list.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/free_tree.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/null_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/package.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/quantizer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/region.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/scoped_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/segregator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/stats_collector.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/common.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/gc_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/mallocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/mmap_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/package.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/showcase.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/typed.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ .
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/ast.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/entities.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/formatter.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/lexer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/parser.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/rollback_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/stack_buffer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/std/experimental/lexer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ .
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ deimos/linenoise.di
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ examples/D/example.d
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ .
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ .
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/dmd.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/echo.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/package.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/interpreter.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/package.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/drepl.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ .
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/drepl.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/dmd.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/echo.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/engines/package.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/interpreter.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/dawg/drepl/package.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/drepl.d
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ .
Fixing relative path: /Users/carl.vogel/Desktop/drepl/ ~ src/drepl.d
Generate target drepl (executable /Users/carl.vogel/Desktop/drepl drepl)
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/ast.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/entities.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/formatter.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/lexer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/parser.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/rollback_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/dparse/stack_buffer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/std/experimental/lexer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ src/
Fixing relative path: /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/ ~ .
Generate target libdparse (staticLibrary /Users/carl.vogel/.dub/packages/libdparse-master/libdparse dparse)
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/affix_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/allocator_list.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/bitmapped_block.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/bucketizer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/fallback_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/free_list.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/free_tree.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/null_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/package.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/quantizer.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/region.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/scoped_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/segregator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/building_blocks/stats_collector.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/common.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/gc_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/mallocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/mmap_allocator.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/package.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/showcase.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src/std/experimental/allocator/typed.d
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ src
Fixing relative path: /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/ ~ .
Generate target experimental_allocator (staticLibrary /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator experimental_allocator)
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ deimos/linenoise.di
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ examples/D/example.d
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ .
Fixing relative path: /Users/carl.vogel/.dub/packages/linenoise-master/ ~ .
Generate target linenoise (sourceLibrary /Users/carl.vogel/.dub/packages/linenoise-master linenoise)
experimental_allocator: ["experimental_allocator"]
libdparse: ["libdparse", "experimental_allocator"]
drepl: ["drepl", "linenoise", "libdparse", "experimental_allocator"]
Using custom build type 'debug'.
Using custom build type 'debug'.
Using custom build type 'debug'.
Performing "debug" build using dmd for x86_64.
experimental_allocator 2.70.0-b1: target for configuration "library" is up to date.
Using existing build in /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/.dub/build/library-debug-posix.osx-x86_64-dmd_2071-BA0A8E551421BB24283D16BC57BCB575/.
Copying target from /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/.dub/build/library-debug-posix.osx-x86_64-dmd_2071-BA0A8E551421BB24283D16BC57BCB575/libexperimental_allocator.a to /Users/carl.vogel/.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator
libdparse ~master: target for configuration "library" is up to date.
Using existing build in /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/.dub/build/library-debug-posix.osx-x86_64-dmd_2071-4B69C29F57FBDA6E86E430A0135C0F63/.
Copying target from /Users/carl.vogel/.dub/packages/libdparse-master/libdparse/.dub/build/library-debug-posix.osx-x86_64-dmd_2071-4B69C29F57FBDA6E86E430A0135C0F63/libdparse.a to /Users/carl.vogel/.dub/packages/libdparse-master/libdparse
Target '/Users/carl.vogel/Desktop/drepl/.dub/build/console-debug-posix.osx-x86_64-dmd_2071-6875F18CFC556A227173A97BAEBC1173/drepl' doesn't exist, need rebuild.
drepl 0.1.0+commit.45.gabd5810: building configuration "console"...
Using direct -l... flags for linenoise.
dmd -c -of.dub/build/console-debug-posix.osx-x86_64-dmd_2071-6875F18CFC556A227173A97BAEBC1173/drepl.o -release -g -wi -version=Have_drepl -version=Have_linenoise -version=Have_libdparse -version=Have_experimental_allocator -Isrc/ -I../../.dub/packages/libdparse-master/libdparse/src/ -I../../.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/src -I../../.dub/packages/linenoise-master src/dawg/drepl/engines/dmd.d src/dawg/drepl/engines/echo.d src/dawg/drepl/engines/package.d src/dawg/drepl/interpreter.d src/dawg/drepl/package.d src/drepl.d -vcolumns
Linking...
dmd -of.dub/build/console-debug-posix.osx-x86_64-dmd_2071-6875F18CFC556A227173A97BAEBC1173/drepl .dub/build/console-debug-posix.osx-x86_64-dmd_2071-6875F18CFC556A227173A97BAEBC1173/drepl.o ../../.dub/packages/libdparse-master/libdparse/libdparse.a ../../.dub/packages/experimental_allocator-2.70.0-b1/experimental_allocator/libexperimental_allocator.a -L-llinenoise -g
Undefined symbols for architecture x86_64:
  "_rt_loadLibrary", referenced from:
      _D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv in drepl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
FAIL .dub/build/console-debug-posix.osx-x86_64-dmd_2071-6875F18CFC556A227173A97BAEBC1173/ drepl executable
dmd failed with exit code 1.
Full exception: object.Exception@source/dub/compilers/compiler.d(112): dmd failed with exit code 1.
----------------
4   dub                                 0x00000001049d6de7 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, const(char[])) + 123
5   dub                                 0x00000001049d6ec0 pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) + 100
6   dub                                 0x00000001049ee977 void dub.compilers.compiler.Compiler.invokeTool(immutable(char)[][], void delegate(int, immutable(char)[])) + 739
7   dub                                 0x00000001049efffb void dub.compilers.dmd.DMDCompiler.invokeLinker(const(dub.compilers.buildsettings.BuildSettings), const(dub.platform.BuildPlatform), immutable(char)[][], void delegate(int, immutable(char)[])) + 919
8   dub                                 0x00000001049ffef2 void dub.generators.build.BuildGenerator.buildWithCompiler(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings) + 1974
9   dub                                 0x00000001049fd336 bool dub.generators.build.BuildGenerator.performCachedBuild(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings, const(dub.package_.Package), immutable(char)[], immutable(char)[], const(dub.package_.Package[]), const(dub.internal.vibecompat.inet.path.Path[])) + 1282
10  dub                                 0x00000001049fcc74 bool dub.generators.build.BuildGenerator.buildTarget(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings, const(dub.package_.Package), immutable(char)[], const(dub.package_.Package[]), const(dub.internal.vibecompat.inet.path.Path[])) + 728
11  dub                                 0x00000001049fc7ac D3dub10generators5build14BuildGenerator15generateTargetsMFS3dub10generators9generator17GeneratorSettingsxHAyaS3dub10generators9generator16ProjectGenerator10TargetInfoZ14buildTargetRecMFAyaZv + 1136
12  dub                                 0x00000001049fc2a2 void dub.generators.build.BuildGenerator.generateTargets(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])) + 494
13  dub                                 0x0000000104a0504f void dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings) + 899
14  dub                                 0x000000010496bb4f void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) + 155
15  dub                                 0x00000001049506df int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 1507
16  dub                                 0x0000000104950a61 int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 125
17  dub                                 0x000000010494d0de int dub.commandline.runDubCommandLine(immutable(char)[][]) + 2970
18  dub                                 0x000000010494826f _Dmain + 31
19  dub                                 0x0000000104af69b3 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39
20  dub                                 0x0000000104af68e7 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35
21  dub                                 0x0000000104af6958 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 44
22  dub                                 0x0000000104af68e7 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35
23  dub                                 0x0000000104af684d _d_run_main + 497
24  dub                                 0x0000000104948307 main + 15
25  libdyld.dylib                       0x00007fff8d74c5ac start + 0
26  ???                                 0x0000000000000002 0x0 + 2
MartinNowak commented 8 years ago

Comment by carljv Thursday May 26, 2016 at 00:54 GMT


I wonder if the last comment on this thread is still operative: http://forum.dlang.org/post/jdxffzcnvdkpuwcpsmzv@forum.dlang.org

"Does your code call Runtime.loadLibrary anywhere?

It looks like rt_loadLibrary is only implemented when on Windows or with version(Shared)."

(I'm not sure what version(Shared) is.)

MartinNowak commented 8 years ago

Comment by wilzbach Thursday May 26, 2016 at 21:51 GMT


I wonder if the last comment on this thread is still operative:

https://github.com/drepl/drepl/blob/5319ae5587f36c3f7669a114315a1bdaee0cd8c6/src/dawg/drepl/engines/dmd.d#L214

Have you tried to remove that and see whether it compiles?

MartinNowak commented 8 years ago

Comment by carljv Thursday May 26, 2016 at 22:12 GMT


Yeah, that loadLibrary call is definitely the problem. I replaced that w/ void* lib; and got it to compile and run. The REPL takes inputs but doesn't seem to give output.

Running ./drepl
Welcome to D REPL.
D> import std.stdio;
D> writeln(10);
D> auto x = 42;
D> x
D>

I'm not 100% sure what expected behavior is, or what the workaround for loadLibrary is...

MartinNowak commented 8 years ago

Comment by wilzbach Thursday May 26, 2016 at 22:13 GMT


I'm not 100% sure what expected behavior is, or what the workaround for loadLibrary is...

Nope it's not. Can you try 1) a simple 1+1 2) Just declarations (no importing)

MartinNowak commented 8 years ago

Comment by MartinNowak Friday May 27, 2016 at 12:18 GMT


There is no shared library support on OSX yet.

MartinNowak commented 8 years ago

Comment by MartinNowak Friday May 27, 2016 at 12:19 GMT


Maybe w/ ldc? Not sure what the problem there is.

MartinNowak commented 8 years ago

Comment by MartinNowak Friday May 27, 2016 at 12:21 GMT


I'm not 100% sure what expected behavior is, or what the workaround for loadLibrary is...

There is no workaround, compiling and loading new code as shared libraries is how this REPL works.

chances commented 3 years ago

I'm experiencing this today running dub run drepl using ldc.

drepl ran normally a couple weeks ago.

Ubuntu 18.04 LTS LDC: 1.24.0 based on DMD v2.094.1 and LLVM 11.0.0 Default target: x86_64-unknown-linux-gnu Host CPU: skylake

Details ``` $ dub run drepl Building package drepl in /home/chances/.dub/packages/drepl-0.2.1/drepl/ Performing "debug" build using /home/chances/dlang/ldc-1.24.0/bin/ldc2 for x86_64. colorize 1.0.5: target for configuration "library" is up to date. stdx-allocator 2.77.2: target for configuration "library" is up to date. libdparse 0.8.7: target for configuration "library" is up to date. drepl 0.2.1: building configuration "console"... Running pre-build commands... Linking... /home/chances/GitHub/teraflop-d/../../.dub/packages/drepl-0.2.1/drepl/src/drepl/engines/dmd.d:255: error: undefined reference to 'rt_loadLibrary' collect2: error: ld returned 1 exit status Error: /usr/bin/cc failed with status: 1 /home/chances/dlang/ldc-1.24.0/bin/ldc2 failed with exit code 1. ```