| |
| Posted by Steven Schveighoffer in reply to Carsten Schlote | PermalinkReply |
|
Steven Schveighoffer
Posted in reply to Carsten Schlote
| On 10/28/22 2:43 PM, Carsten Schlote wrote:
> On Friday, 28 October 2022 at 18:31:25 UTC, Steven Schveighoffer wrote:
> Are you passing the c file to the compiler? Also, you must be using dmd for ImportC currently.
What is your build line?
$ cat dub.json
{
"authors": [
"Carsten Schlote"
],
"copyright": "Copyright © 2022, Carsten Schlote",
"description": "A minimal D application.",
"license": "proprietary",
"name": "importc-app",
"lflags": [ "-lzstd", "zstd_binding.o" ],
"preBuildCommands": [ "gcc -g -O0 -c -o zstd_binding.o source/zstd_binding.c"]
$ dub build --compiler=dmd-beta -v
Using dub registry url 'https://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 /home/cschlote/.dub/packages/local-packages.json
Looking for local package map at /home2/cschlote/build/dlang/importc-tests/dubbed/.dub/packages/local-packages.json
Note: Failed to determine version of package importc-app at .. Assuming ~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 /home/cschlote/.dub/packages/local-packages.json
Looking for local package map at /home2/cschlote/build/dlang/importc-tests/dubbed/.dub/packages/local-packages.json
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 /home/cschlote/.dub/packages/local-packages.json
Looking for local package map at /home2/cschlote/build/dlang/importc-tests/dubbed/.dub/packages/local-packages.json
Generating using build
Configuring dependent importc-app, deps:
Performing "debug" build using dmd-beta for x86_64.
Target '/home2/cschlote/build/dlang/importc-tests/dubbed/.dub/build/application-debug-linux.posix-x86_64-dmd_v2.101.0-beta.1-36-ga2865d74fb-9DB8925B9A720899BDD003C68BC85F85/importc-app' doesn't exist, need rebuild.
importc-app ~master: building configuration "application"...
Running pre-build commands...
Running gcc -g -O0 -c -o zstd_binding.o source/zstd_binding.c
dmd-beta -c -of.dub/build/application-debug-linux.posix-x86_64-dmd_v2.101.0-beta.1-36-ga2865d74fb-9DB8925B9A720899BDD003C68BC85F85/importc-app.o -debug -g -w -version=Have_importc_app -Isource/ source/app.d -vcolumns
Linking...
dmd-beta -of.dub/build/application-debug-linux.posix-x86_64-dmd_v2.101.0-beta.1-36-ga2865d74fb-9DB8925B9A720899BDD003C68BC85F85/importc-app .dub/build/application-debug-linux.posix-x86_64-dmd_v2.101.0-beta.1-36-ga2865d74fb-9DB8925B9A720899BDD003C68BC85F85/importc-app.o -L--no-as-needed -L-lzstd -Lzstd_binding.o -g
Copying target from /home2/cschlote/build/dlang/importc-tests/dubbed/.dub/build/application-debug-linux.posix-x86_64-dmd_v2.101.0-beta.1-36-ga2865d74fb-9DB8925B9A720899BDD003C68BC85F85/importc-app to /home2/cschlote/build/dlang/importc-tests/dubbed
Without the preBuildCommands and without passing the resulting object file to the linker, the relatedCode() doesn't exist. And linking is failing.
By default dub does not build C files (as evidenced by your command line). It may not even let you I don't know, but try:
"sourceFiles" : ["source/zstdc_binding.c"]
-Steve
|