wjakob / nanogui

Minimalistic GUI library for OpenGL
Other
4.66k stars 608 forks source link

Build fails: no matching function for call to 'file_dialog' #291

Closed yurivict closed 6 years ago

yurivict commented 6 years ago
/usr/ports/x11-toolkits/nanogui/work/nanogui-3e0b2c8/src/common.cpp:206:19: error: no matching function for call to 'file_dialog'
    auto result = file_dialog(filetypes, save, false);
                  ^~~~~~~~~~~
/usr/ports/x11-toolkits/nanogui/work/nanogui-3e0b2c8/src/common.cpp:205:13: note: candidate function not viable: requires 2 arguments, but 3 were provided
std::string file_dialog(const std::vector<std::pair<std::string, std::string>> &filetypes, bool save) {
            ^

clang-4.0

svenevs commented 6 years ago

@yurivict what operating system?

@Tom94 this seems related to #256 ?

yurivict commented 6 years ago

FreeBSD 11.1

yurivict commented 6 years ago

Number of arguments mismatch must be pretty easy to fix. :-)

Tom94 commented 6 years ago

@svenevs I am not sure this is related. It looks like the function definition is not found, which makes me suspect that their FreeBSD OS is misclassified as macOS, thus skipping the (already pre-existing) #if !defined(__APPLE__) region and never actually defining the function. Unfortunately I do not have a FreeBSD environment to test this on. Does nanogui support FreeBSD?

@yurivict unfortunately this is not a number-of-arguments issue. :( Could you check whether __APPLE__ is defined when you try to compile?

yurivict commented 6 years ago

__APPLE__ isn't defined.

Tom94 commented 6 years ago

What happens when you call the function expecting only 2 arguments?

svenevs commented 6 years ago

Does nanogui support FreeBSD?

There's a bunch of BSD specific fixes in CMakeLists.txt, so it definitely used to at one point.

Yeah I took a closer look and it isn't really clear how this is happening. It doesn't look like you changed anything related to the preprocessor trajectory...

@yurivict you could try checking out the commit before the one @Tom94 added (git checkout 96648d0de901dd94b90750134602c2f419215d83) and see if it builds. If it does, then something small has changed. It's quite possible the file dialog has been broken on BSD for much longer.

Since commit 244db2d42cbc763ee2521f1f5a59ef487460ddab introduced the BSD CMake fixes, you could try going all the way back to there and just seeing if it builds as well. That's kind of the only reference point I know of where BSD should definitely be working...

yurivict commented 6 years ago

96648d0 has some other errors:

/usr/ports/x11-toolkits/nanogui/work/nanogui-96648d0de/ext/eigen/Eigen/src/Core/CoreEvaluators.h:137:77: warning: unused parameter 'outerStride' [-Wunused-parameter]
  EIGEN_DEVICE_FUNC plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr)
                                                                            ^
/usr/ports/x11-toolkits/nanogui/work/nanogui-96648d0de/src/checkbox.cpp:24:5: error: use of undeclared identifier 'mIconExtraScale'
    mIconExtraScale = 1.2f;// widget override
    ^
/usr/ports/x11-toolkits/nanogui/work/nanogui-96648d0de/src/checkbox.cpp:83:38: error: use of undeclared identifier 'icon_scale'
        nvgFontSize(ctx, mSize.y() * icon_scale());
                                     ^
yurivict commented 6 years ago

244db2d builds fine.

svenevs commented 6 years ago

/usr/ports/x11-toolkits/nanogui/work/nanogui-96648d0de/src/checkbox.cpp:24:5: error: use of undeclared identifier 'mIconExtraScale' mIconExtraScale = 1.2f;// widget override

Hmmmmm. This is really fishy, there's virtually no way that cannot be defined. I'm leaning toward your compiler being the problem. What are you using? Are there any other compilers you have available to try (e.g. if using gcc, try clang)?

yurivict commented 6 years ago

ca81bca01112e8f85e75c3ce2641be3b5d4ca86a is the last working revision. b51b19fcaaa0a9b216400e70c55999f1a11e72f8 breaks.

yurivict commented 6 years ago

Hmmmmm. This is really fishy

No, compiler is rock-solid. clang-40

yurivict commented 6 years ago

ping.

How can any progress be made on this?

valpackett commented 6 years ago

current master (3e0b2c8dae3a5) builds fine on FreeBSD 12-CURRENT with both cc (clang 5.0.1) and clang40 (clang 4.0.1)

@yurivict literally looks like somehow __APPLE__ is getting defined o_0

svenevs commented 6 years ago

@myfreeweb thanks for the info. @yurivict as a sanity check, this is a "full-grade" operating system (rather than docker or a virtual machine), yes?

yurivict commented 6 years ago

Yes, a standalone, full-grade OS.

svenevs commented 6 years ago

Harumph. I doubt it, but the only other thing I can think of is how were these directories being created? They follow the form /usr/ports/x11-toolkits/nanogui/work/nanogui-{shorthash}. Is it possible these are somehow part of a packaging system that isn't working correctly? E.g., if you do a manual git clone --recursive https://github.com/wjakob/nanogui.git under ~/Desktop or something, presumably you get the same results?

Have you tried using gcc?

I'm sorry to say, but the errors your posting all seem to point to some mysterious local configuration issue. E.g. icon_scale() not being defined. There's nothing platform specific about any of the icon scaling stuff :/

yurivict commented 6 years ago

file_dialog is declared in include/nanogui/common.h, but src/common.cpp doesn't have it included, so this line breaks auto result = file_dialog(filetypes, save, false);. Its definition is only after the first use.

It you use something from nanogui/common.h, you need to include it.

svenevs commented 6 years ago

It you use something from nanogui/common.h, you need to include it.

Are you saying that adding this at the top of the src/common.cpp file fixes things for you?

It should be getting included transitively. E.g. via #include <nanogui/screen.h> -> #include <nanogui/widget.h> -> #include <nanogui/object.h> -> #include <nanogui/common.h>.

If it weren't getting included, the initial NAMESPACE_BEGIN(nanogui) (which is defined in common.h) would have been the first error you got.

yurivict commented 6 years ago

Sorry, I had nanogui headers installed bundled with some other project. You pick pre-installed headers, instead of local ones.

Please fix this.

svenevs commented 6 years ago

You pick pre-installed headers, instead of local ones

Can you elaborate on what this means (so that it could be fixed)?

Edit oh I see this is what #295 is

yurivict commented 6 years ago

No, #295 is different!

When nanogui is already installed, the build picks headers from that installed version, not the local headers. This is wrong, because the pre-installed headers can be of different version.