Conversation
|
Very nice, thanks for doing this.
I.e., it's the used D host compiler (LDMD 1.0) which on OSX is apparently linked dynamically against libconfig.
That's definitely not what's supposed to be happening. It's also the reason why the imports fail; no |
driver/configfile.cpp
Outdated
| bool readDataFromConfigFile ( const char * pathcstr, | ||
| const char * sectioncstr, | ||
| const char * bindircstr, | ||
| ConfigData & data); |
There was a problem hiding this comment.
Nitpick: please use clang-format for C++ sources.
driver/configfile.h
Outdated
|
|
||
| s_vector switches; | ||
| std::string pathstr; | ||
| ConfigData data; |
There was a problem hiding this comment.
How about getting rid of the ConfigData helper struct and implementing ConfigFile partially in D? Apparently all what would need to be done (besides having a D declaration of the (small) struct) is converting ConfigFile to a struct and storing pathstr as C string. readDataFromConfigFile() would become a private method implemented in D.
There was a problem hiding this comment.
Yes, that's what I wanted to do at the start. I've chosen a safer path that modifies as little code as possible, but I prefer your option.
Any clue on how to call exe_path::getBinDir() from D? (it returns a std::string)
There was a problem hiding this comment.
I'd let read() call it on the C++ side and forward its c_str() to the D method.
|
For OSX, I'll reintegrate the |
|
Background: On OS X, the binary packages are supposed to contain libconfig, with the rpath suitably adapted. We really need to fix this for 1.0 and the current release, even if it will be obsoleted by this PR. |
rationale: ldmd version used by travis links dynamically to libconfig
|
It should work now. |
|
I've retriggered AppVeyor. Unfortunately, |
| 3rdparty/libconfig-d/src/config/package.d | ||
| 3rdparty/libconfig-d/src/config/setting.d | ||
| 3rdparty/libconfig-d/src/config/util.d | ||
| ) |
There was a problem hiding this comment.
In case those are all modules anyway, I'd prefer something compact and resilient like:
file(GLOB_RECURSE 3RDPARTY_SRC_D
3rdparty/pegged/*.d
3rdparty/libconfig-d/src/*.d
)
Oh, I've just seen that you excluded libconfig-d's test.d in this list, but that's only enabled for unittest builds, so it doesn't really count. ;)
Edit: But pegged's pegged/test/tester.d contains a main(). Bad idea for library code; these testing helpers should be moved outside the regular library src tree IMO.
There was a problem hiding this comment.
So I don't change it?
Or I glob and explicit remove afterwards what is not needed?
Pegged has a lot of files that we don't need at all, so I would prefer keep it this way.
Another possibility is to make a 3rdparty[.lib][.a] in 3rdparty/CMakeLists.txt
driver/configfile.h
Outdated
| s_vector switches; | ||
| const char *pathcstr; | ||
| s_iterator switches_b; | ||
| s_iterator switches_e; |
There was a problem hiding this comment.
Please initialize them to nullptr here in the header and get rid of the explicit default ctor.
| module driver.configfile; | ||
|
|
||
|
|
||
| struct ConfigFile |
There was a problem hiding this comment.
Sorry it's a struct.extern (C++) - otherwise all fields are off by ptr size (monitor for D classes).
driver/configfile.d
Outdated
| extern(Windows) | ||
| HRESULT SHGetFolderPathA(HWND, int, HANDLE, DWORD, LPSTR); | ||
| extern(Windows) | ||
| HRESULT SHGetFolderPathW(HWND, int, HANDLE, DWORD, LPWSTR); |
There was a problem hiding this comment.
I'd prefer only declaring actually used stuff - no *W and only 3 of the enums below.
|
Are there any functional changes due to the C++ -> D transition of almost all of |
|
Behavior (and C++ interface) should be the same. |
Avoids a glue C++ func that returns a C string
|
Is there anything still preventing this from merging? |
|
I'd merge it if we agree that it should be part of 1.1, otherwise I'd wait (just to simplify bringing branch release-1.1 up to speed, i.e., one less commit to be reverted). If @klickverbot agrees that 1.1 should include all of master except for OSX (and the runtime functions type check, which depends on it). that is. If David is unsure whether other commits are responsible for the spurious Travis OSX failures, I'd tend to branch off a test branch (master with the 2 commits reverted) and trigger the OSX Travis jobs manually at least 20 times or so and see whether it's really just his OSX commit. |
|
I'm a bit late to the discussion, but there is one thing that bugs me: while it is good that we change the implementation of the config file reading to something we can actively fix in case of existing and maybe future problems, it's a bit unfortunate to replace one external dependency with another. |
|
For me the primary advantages are:
|
|
I agree, it's a good improvement. It was just a thought when I stumbled over some complaints that implementing an adhoc parser would be pretty simple, especially if we stretch the syntax slightly by reusing the D Lexer, e.g. for number parsing. But as I never got to do it, I must not complain about an alternative implementation ;-) |
Currently doing this for #1817 (LLVM 3.9). |
@JohanEngelen: I don't understand. That branch is 20 commits behind master and does contain David's OSX commit... |
|
@kinke Should have checked that it contains the OSX stuff... dumb, sorry. |
|
Let's move forward on this? |
|
Being on a constrained internet connection for some time made me more aware of the size of things. This PR pulls in 2 external submodules, and especially the Pegged repo is quite large and pulls in even more submodules. This will increase git clone time and download size and also our release source archive size, adding a lot of files that we don't need. |
|
How about we just use a simple JSON file and parse it via |
|
FWIW: |
|
Closing in favor of #2016. Thanks Remi for hanging in there! :) |
Hello
Pull-request according the project ideas page in order to remove dependency on libconfig.
Dependencies are managed by 2 submodules (
libconfig-dandPegged) in a3rdpartydirectory, and necessary files are directly compiled inldc2.oSo it should be transparent for users.
I setup Travis and AppVeyor to build this branch.
Travis reports error when building on OSX:
dyld: Library not loaded: /opt/local/lib/libconfig.9.dylibduring CMake configure step.This dylib is not needed anymore (that's quite the purpose, isn't it?) but I can't tell where cmake is pulling this dependency from. Please give me indications.
In AppVeyor ldc emits warning that it can't find
default.switchesin the config file. I don't know how the config file looks like under windows, but I can remove the warning if it is normal. Otherwise please give me indication of what is wrong. Finally, windows build stops at this error:Error: module md is in file 'std\digest\md.d' which cannot be read. I don't think this is related to this PR, but can be wrong of course.