rcurtin_irc changed the topic of #mlpack to: mlpack: a scalable machine learning library (https://www.mlpack.org/) -- channel logs: https://libera.irclog.whitequark.org/mlpack -- NOTE: messages sent here might not be seen by bridged users on matrix, gitter, or slack
<TarekElsayed[m]> I actually get a linker error with both... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/b7cb1d41bdd755d519ee6f7b2f852997b3cd8a8b>)
<TarekElsayed[m]> I used this flag `-std=gnu++11` because I got a different error if I didn't... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/f40a7c5c4bc088af073e463ac06b4ba4b9e0108e>)
<zoq[m]> you installed armadillo with brew?
<zoq[m]> also should you use clang++ or is g++ just an alias?
<TarekElsayed[m]> g++ is an alias
<zoq[m]> LIke clang -std=c++11 -o test test.cpp -larmadillo
<TarekElsayed[m]> And Yes I installed armadillo with brew... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/33e3964a7b2e153256ee86e7879db9de430376f6>)
<TarekElsayed[m]> ld: library not found for -larmadillo
<TarekElsayed[m]> clang: error: linker command failed with exit code 1 (use -v to see invocation)
<TarekElsayed[m]> I get the same error when I add -framework Accelerate
<zoq[m]> you have /usr/lib/libarmadillo.dylib?
<TarekElsayed[m]> No
<zoq[m]> Can you search for libarmadillo.dylib sounds like it's not part of your library search path.
<rcurtin[m]> Shouldn't it be /opt/homebrew/lib/libarmadillo.dylib if it's installed through homebrew?
<zoq[m]> I think you are right.
<TarekElsayed[m]> yes it's in /opt/homebrew/lib/
<TarekElsayed[m]> would uninstalling the brew version and then building from source help?
<zoq[m]> so if you do g++ -std=c++11 -o test test.cp -L/opt/homebrew/lib/ -larmadillo it works?
<zoq[m]> ld: library not found for -larmadillo just says it can't find the armadillo lib.
<TarekElsayed[m]> Yes thanks
<TarekElsayed[m]> But I had to add -framework Accelerate
<rcurtin[m]> interesting that you needed -framework Accelerate... can you open /opt/homebrew/include/armadillo_bits/config.hpp and see if the line #define ARMA_USE_WRAPPER is commented or uncommented?
<TarekElsayed[m]> No it's not commented
<rcurtin[m]> okay... can you try one more thing... if you compile with -DARMA_USE_WRAPPER, but not -framework Accelerate, does it link successfully?
<TarekElsayed[m]> Yes it links successfully
<rcurtin[m]> it links successfully without -framework Accelerate? I just want to double check because that is not the result I expected 😃
<TarekElsayed[m]> Yes
<TarekElsayed[m]> ```tareknasser@Tareks-MacBook ml % g++ -std=c++11 -o test test.cpp -L/opt/homebrew/lib/ -larmadillo -DARMA_USE_WRAPPER
<TarekElsayed[m]> tareknasser@Tareks-MacBook ml % ```
<TarekElsayed[m]> It compiles
<rcurtin[m]> huh... okay... I am wondering if this is a homebrew packaging issue or something... why would ARMA_USE_WRAPPER not be enabled by default if it is uncommented in config.hpp?
<TarekElsayed[m]> I can test uninstalling brew version and then building from source later
<TarekElsayed[m]> Is this issue related to only m1 macs ?
<rcurtin[m]> wait, hang on... is it possible you have multiple installations of Armadillo on your system?
<TarekElsayed[m]> yes. I faced a similar issue before with a different project
<TarekElsayed[m]> By the way I have g++ itself installed from brew and sometimes I test with it
<TarekElsayed[m]> but in this situation I only used apple clang
<zoq[m]> I think you used the autodownloader as well?
<TarekElsayed[m]> What is the autodownloader?
<zoq[m]> I think it this case you ended-up with multiple armadillo versions as rcurtin pointed out.
<zoq[m]> -DDOWNLOAD_DEPENDENCIES=ON
<TarekElsayed[m]> Yes I used it
<rcurtin[m]> the autodownloader shouldn't download Armadillo if a version is already installed on the system, but yeah, the issue here is that there are multiple Armadillo versions that are configured differently
<rcurtin[m]> now that I look more closely through the error messages, you have a version in /usr/local/ where I bet /usr/local/include/armadillo_bits/config.hpp has ARMA_USE_WRAPPER commented out; then, you have a version in /opt/homebrew/ where ARMA_USE_WRAPPER is defined... this means that the Armadillo headers you are including by default have no use for the wrapper library /opt/homebrew/lib/libarmadillo.dylib, unless you manually define
<rcurtin[m]> ARMA_USE_WRAPPER
<rcurtin[m]> I'd suggest removing the version in /usr/local/ and this should fix your issues, and you won't need to append a special -framework Accelerate to your CMake command for mlpack
<TarekElsayed[m]> Yes this is exactly the issue
<TarekElsayed[m]> /usr/local/include/armadillo_bits/config.hpp has ARMA_USE_WRAPPER commented out