Comments (7)
Thanks for you answer,
When I add message(STATUS "STB_IMAGE_FOUND is set and pre-processor flag HAS_STB has been added")
after line 322, I correctly see it displayed when running cmake ..
. The mlpack CLI apps seems to be compiled correctly with the -DHAS_STB
flag.
I'm not much familiar with cmake, so maybe I just don't understand what it is supposed to do, but I would expect the #define HAS_STB
to be included by cmake in the mlpack headers installed in my /usr/local/include/mlpack
folder, so that when I include mlpack in my c++ programs, the version that supports STB is loaded. For now, it doesn't seem the case. I managed however to make it work by manually adding the #define HAS_STB
before the #include <mlpack.hpp>
in the test program above.
Is that what we are supposed to do (defining HAS_STB manually in our programs before including mlpack) ?
If yes, I think the install instructions and the Image Utilities Tutorial should mention this. I guess another solution would be for cmake to add -DHAS_STB
in the cflags
of the pkg-config file it generates.
from mlpack.
Thanks for the report. This is actually a leftover from before mlpack changed to be a header-only library. You are right that the workaround for now is just to add -DHAS_STB
to your compilation command, but you are also right that this should be automatically defined at install time whenever STB is detected.
It may be a couple days before I get to it, but I'll open a PR that handles this, likely by generating a file with HAS_STB
set or unset based on what is found at configuration/build time.
(I'll also probably rename it MLPACK_USE_STB
or similar, so it doesn't interfere with any other symbols. Originally, when mlpack was not header-only, the macro was only used inside of libmlpack.so and thus never needed to be encountered by the user. However, this was not properly adapted when mlpack was changed to be header-only, like I alluded to earlier.)
from mlpack.
I opened a fix in #3529. I think the description of the fix may be longer than the fix itself, but I'm not sure. The tl;dr is that mlpack's next release will have a file mlpack/config.hpp
that automatically defines MLPACK_HAS_STB
depending on whether STB was found when mlpack was configured and installed. (Also, the macro was renamed to avoid conflicts.)
Thank you for the report! This was a tricky thing to fix with lots of details, but I'm glad to have a solution on the way.
from mlpack.
Update: I also tried to install mlpack on a different computer, running Ubuntu 22.04 LTS. On this computer, the package libmlpack-dev
is available but is a really old version (3.4.2), so I tried to compile mlpack using cmake --> make instead. I get the same error message as on my other computer, "mlpack was not compiled with STB support", even though cmake finds STB correctly.
from mlpack.
- Since you are building from source code, you can do some debugging to find any potential problems.
- The log message that you get is from "src/mlpack/core/data/load_image_impl.hpp" line 177 (at least in mlpack 4.2.0)
- The message gets printed when the pre-processor flag
HAS_STB
isn't set. - This pre-processor flag is set in "CMakeLists.txt" line 322. You can add a line after line 322:
message(STATUS "STB_IMAGE_FOUND is set and pre-processor flag HAS_STB has been added")
. - Note that
STB_IMAGE_FOUND
is set duringfind_package(StbImage)
which should be above that line in the same file. find_package
will call "CMake/FindStbImage.cmake". You can put similar debug messages in this file to find any problems.
from mlpack.
Sounds good, thanks !
from mlpack.
Okay, with #3529 merged, I think that this issue is fixed. Feel free to try on the current master branch and report back if there are still issues, or wait until the next stable release (should be soon). Thanks again for the report!
from mlpack.
Related Issues (20)
- Negative loss in vae HOT 5
- getting loss value periodically [NoobQuestion#1] HOT 10
- Data structure for DBSCAN HOT 1
- [Question] Can mlpack's random forest library complete the function of missing values filling? HOT 3
- Custom distance function HOT 2
- [R binding] - Should the R pkg supply an inline plugin helper? HOT 3
- Refactor mlpack header to be similar to ensmallen. HOT 1
- which is the right way to setup number of epochs? [NoobQuestion#2] HOT 2
- Build failing for no apparent reason (Visual Studio/C++ 17/Windows 11) HOT 19
- Video Walkthrough for compiling MLPACK
- Add a devcontainer.json HOT 1
- [R] Patch release for R bindings HOT 1
- No module named 'mlpack.image_converter' during import in python at Mac. HOT 6
- Simplify Reinforcement Learning Agent Creation HOT 5
- Try upgrading your stb implementation (macOS) HOT 1
- Crashes with valid test data HOT 8
- Fatal error occurred when calling mlpack.bayesian_linear_regression() HOT 2
- Move the Wiki developer section to the new docs developer page
- stb_image_write warning while compiling HOT 1
- Benchmark to replace the transform functions HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlpack.