Render SVG To Display And Update Periodically
I have in mind a project to render instruments (speed, pressure, position) to a screen using SVG. I am able to produce the SVG easily enough. What I am looking for is a library/canvas/toolkit that I can use in D inside of a loop and update the instrument readouts. This whole project is a vehicle for me to expand my mechanical engineering abilities into instrumentation and control. I've decided that D is the language I want to learn to do this. I see things like Cairo and librsvg. Maybe a full blown GUI toolkit has the bits i need. The thing I have a hard time with is assessing whether or not these things are suitable for what I hope to do. Thanks in advance, Jason C. Wells
Visual Studio Linker Problem
I am working my way up to building NanoVG per my previous post. I am able to compile hello world using dmd2. I am running in cygwin because I understand bash way better than cmd.exe. I am unable to compile hello world using ldc2. I am interested in ldc because I am interested in compiling to different arch-es and I happen to be a FreeBSD guy which uses LLVM by default. I figure that what I learn in LDC under windows will be portable for me. I received this error: $ ldc2 hello.d Using Visual C++: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC LINK : fatal error LNK1104: cannot open file 'libucrt.lib' Error: `C:\Windows\system32\cmd.exe /s /c "C:\Users\jcw\Documents\Projects\Programming\dlang\ldc2-1.1.0-beta3-win64-msvc\bin\amd64.bat link.exe"` failed with status: 1104 The file "libucrt.lib" is found in several VS folders. I am sure that this is some path issue, but I'm not savvy on VisualStudio. I read some scary messages about this error in other parts of the forum from about a year ago. Hopefully the solution is easier than what I read in that thread. I see mention of a "vcvarsall.bat" file that might set my paths correctly, but this file is not found on my system. I see mention of a VCINSTALLDIR variable which is not set on my system. Regards, Jason C. Wells
Re: Visual Studio Linker Problem
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat did in fact exist. My search for the file must have been errant. ldc2.exe hello.d also failed in cmd.exe. I took Mike's advice to run cmd.exe from one of the environments provided in the VS start menu. I tried to compile hello world and failed with the same error. I then ran 'set > environment.txt'. The value of LIB included the path: C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\x64 which should have been: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10150.0\ucrt\x64. I reset environment variable LIB to include the path to libucrt.lib. I was able to compile hello.d Thanks all. Your advice set me on the right path. Regards, Jason C. Wells
Re: Visual Studio Linker Problem
On Tuesday, 18 October 2016 at 18:09:11 UTC, Johan Engelen wrote: So this was a VS installation issue? (Visual Studio set the LIB path wrong?) I'm not sure where LIB was set.
Re: Render SVG To Display And Update Periodically
This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question. When attempting to compile simpledisplay.d, I get the following: C:\...\dlang\arsd-master>dmd -Lgdi32.lib -L user32.lib simpledisplay.d color.d OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 9: Unknown Option : NOIGDI32.LIBUSER32.LIB simpledisplay.obj(simpledisplay) Error 42: Symbol Undefined _D9invariant12_d_invariantFC6ObjectZv simpledisplay.obj(simpledisplay) ** snip ** Interestingly enough, simpledisplay.obj and simpledisplay.exe are produced. Aren't errors fatal? The EXE is not a valid win32 application. I am used to makefiles. The author doesn't use dub for these programs. (dub ~=make?) gdi32.lib and user32.lib appear in multiple directories. I added "C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64" to %LIB% which seemed sensible to do. I still get the warning: OPTLINK : Warning 9: Unknown Option : NOIGDI32.LIBUSER32.LIB So, I'm still figuring out how to set up a compile. I presume that dmd is not finding gdi32.lib and user32.lib. What am I missing? Regards, Jason C. Wells
Re: Render SVG To Display And Update Periodically
I've tinkered with what you proposed. In the process I've worked through a variety of errors and ended up doing things I don't think are a good solution like duplication directories so that a library can be found. Let me see if I understand how to piece together a build. Some combination of three things need to be in agreement: 1 - the import statements need to point to a matching directory structure 2 - the directory structure needs to be arranged such that the imports can be found 3 - the compiler can be told directly on the command line where imports are I'm reading https://wiki.dlang.org/Compiling_and_linking_with_DMD_on_Windows which seems to be the document I need to sort through this. I'll close out with this last question and then go study up. Am I barking up the right tree?
Re: Render SVG To Display And Update Periodically
First, thank you for taking the time to help me with something that should be trivial. I've done the above listing of file on the command line but I'm still stuck. I'm starting to think that I might actually be tripping over bugs, but I'm not confident enough to believe that without some confirmation. I have the following directory structure from the zipfiles found in the repositories posted by ketmar. nanovg_demo - iv (was renamed from nanovg based on dmd error messages) -- arsd (was renamed from arsd-master based on dmd error messages) To proceed, I would attempt a compile. Then I would add the file that was producing an error to the command line and try again. I got this far. Via cmd.exe: nanovg_demo>dmd example.d iv\arsd\color.d iv\arsd\simpledisplay.d iv\perf.d iv\perf.d(41): Error: module iv.nanovg.nanovg from file iv\nanovg.d must be imported with 'import iv.nanovg.nanovg;' demo.d(6): Error: module iv.nanovg.nanovg from file iv\nanovg.d must be imported with 'import iv.nanovg.nanovg;' iv/nanovg/nanovg does not exist in the source code zip files. (I was reluctant to duplicate nanonvg into iv\nanovg because somewhere I learned that copy-pasting code is a bad idea.) demo.d(7): Error: module oui is in file 'iv\nanovg\oui.d' which cannot be read oui.d does not exist anywhere. There is, however, a oui directory. As a side note, I did have some success. I am able to compile nanovg.lib quite easily (from tips provided a few messages ago). It's when I try to compile the demo that I get stuck. Regards, Jason C. Wells
Re: Render SVG To Display And Update Periodically
Now I think I finally see where my hang up is. If B imports C, and A imports B and C, you still have to tell A where to find C. C doesn't go along for the ride with B. Stated another way, A doesn't look inside B to find C. Stated yet another way, B does not expose C to A. The statement above that I did not include nanovg.d on the command line finally clued me in. The statement that I was being "picky" about what to compile similarly helped. sh$> dmd $(find . -name "*.d") <== a joke, sort of. Eager to make the next try. Gotta run for a bit.
Re: Render SVG To Display And Update Periodically
On Saturday, 22 October 2016 at 06:18:13 UTC, Mike Parker wrote: I think I can confidently assure you that you aren't running into any bugs here. Thanks for the confirmation. It helps me to learn. You've dived right into a multi-module projects without a full understanding of imports and linking. I suggest you back up a bit and get familiar with the process before tackling ketmar and Adam's stuff. If they used dub, it would be a very easy process. Since they don't, and you have to manage it all manually, you need a solid understanding of how DMD handles this stuff and why you are getting the error messages you see. I'm used to compiling stuff in FreeBSD land. They have a group of people who take care to manage the build process (the dub part, i presume). What you say above is correct. I don't understand imports and linking. I can read the docs and they make sense, but I don't quite get it yet. Thanks for writing up that simple exercise. That's next. I was able to compile a working executable by specifying almost all *.d files on the command line. It didn't render an image, but it did pop up a window with an error message saying it couldn't load an image. I'm calling that victory. Regards, Jason
Module Name Resolution
I am reading through: https://dlang.org/spec/module.html. I'll soon be working through a previous example provided by Mike Parker. I am reading through Ketmar's iv.d/nanovg/package.d: module iv.nanovg; public import iv.nanovg.nanovg; This looks like three levels of hierarchy, but is it? Should I interpret that import as: iv --nanovg --nanovg Perhaps it really means: iv.nanovg --nanovg I'm a little confused because the corresponding directory in ketmar's source code is named "iv.d" rather than "iv" which is what I would have thought to find based on the import. I see mention of a subpackage in my previous thread. Is this how a subpackage is implemented? Thanks, Jason
Re: Module Name Resolution
Suddenly it occurs to me that the module namespace and the filesystem namespace do not necessarily have a one for one match, even though they do by default. When one specifies all the D source files on the command line, any differences between the module namespace and the filesystem namespace are handled automagically by dmd. The "module" declaration is the code by which the module namespace is manually defined. Hence the repeated advice to supply all the filenames on the command line.
Re: Module Name Resolution
On Wednesday, 26 October 2016 at 05:46:30 UTC, ketmar wrote: this is a repository name. it is supposed to be named just "iv", and git names main directory by repository name if you are doing a simple clone. my bad, i should have made that clear. Ok. That helps.
Unresolved Symbols in a nanovg Library
I've gone about building static libraries for nanovg and arsd. (I'm feeling pretty good about what I've learned in the last couple days, so I gave it a whirl.) arsd has ttf.d and stb_truetype.d. Comments in stb_truetype.d say use ttf.d instead. nanovg has a ttf.d also. There are three ttf.d's to choose from. nanovg has linker errors: ..\..\..\lib\libnanovg.lib(nanovg) Error 42: Symbol Undefined _D2iv3stb3ttf25stbtt_ScaleForPixelHeightFPxS2iv3stb3ttf14stbtt_fontinfofZf I'm not sure I fully understand name mangling, but it looks like nanovg wants to use iv\stb\ttf.d from it's own source tree. But Ketmar said "p.s. you will also need stb_ttf port, arsd repo has it under the name "ttf.d"." So which ttf.d should I use? Does it matter? I've gained enough confidence in the last couple days to go ahead and use trial and error to sort this out. I thought I'd let you guys chime in. Perhaps Ketmar intended to remove his copy of ttf.d from his repo? Regards, Jason C. Wells
Re: Unresolved Symbols in a nanovg Library
Adding iv\stb\ttf.d cleared up most of the remaining linker errors. While compiling iv\nanovg_demo\example.d I am left with: bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg3oui12__ModuleInfoZ bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg12__ModuleInfoZ ..\..\..\lib\libarsd.lib(jpeg) Error 42: Symbol Undefined _D2iv3vfs12__ModuleInfoZ I have no idea where this ModuleInfoZ thing is coming from. I searched the sources for the string "ModuleInfoZ" but that string appears only in obj/def files. I suppose that the compile/linker adds this symbol to object files. How do I fix the missing ModuleInfoZ symbol? I am quite surprised that arsd is looking for iv\vfs\_something_. I should mention that I have been "picky" about which files I included on the dmd command line.
Re: Unresolved Symbols in a nanovg Library
BTW, I am not ignoring you guys when I haven't used rdmd ( I tried briefly but got stuck) or specifying all *.d files on the command line (did that with some success). My learning process is very organic and trial and error. I appreciate what you are doing for me. Thanks for the invite to chat on irc. I don't have an urgent need so I'll post here. Maybe other noobs will make use of this.
Re: Unresolved Symbols in a nanovg Library
I have a nice screen shot of the nanovg demo running. The old xeyes is a nice touch. I was excited to post the photo here but it looks like I cannot. I can tell by the animations that this will be precisely what I need to animate svg based instrumentation. I ended up making one more static library for iv\vfs. I also ended up editing iv\vfs\package.d to comment out the reference to arcs. I was getting tired of following the missing symbols down the rabbit hole. The ModuleInfoZ missing symbols were due to the package.d files in every case. I'll have to read up on those a bit more. Oh and, as the end user, that demo has me all impressed. :) Regards, Jason C. Wells