Tried to built on apple ARM

27 views
Skip to first unread message

Daniel Ebenhöch

unread,
Feb 13, 2021, 6:23:32 PM2/13/21
to libDAI
Hello dear libDAI Developers,

I tried to built the sources for the new apple ARM architecture. As I am not quite experienced my first step is still struggling to get the makefile on the starting point, so that I can see where to replace the i386 by arm statements.

What I did so far

1) copied the Makefile.MACOSX into a Makefile.conf
2) replaced 'i386' by 'arm64' in Makefile.conf
3) run make

Output:         

include/dai/util.h:37:14: fatal error: 'boost/tr1/unordered_map.hpp' file not found

    #include <boost/tr1/unordered_map.hpp> // only present in boost 1.37 and higher

----

It seems that this boost library is not available in contemporary boost (which I installed with Mac port just now).

Would you have an idea to kindly help me out here?

Best regards

Daniel

Joris Mooij

unread,
Feb 14, 2021, 8:13:24 AM2/14/21
to Daniel Ebenhöch, libDAI
Hi Daniel,

you could try removing the '/tr1', this is probably obsoleted.
(Not sure if that helps, but you can give it a try; if not, maybe
you can locate the file unordered_map.hpp yourself in the
corresponding boost include directory?)

Best, Joris
> --
> You received this message because you are subscribed to the Google Groups
> "libDAI" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to libdai+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/
> libdai/919f3146-2afe-4289-ba2c-8d2eb7513b14n%40googlegroups.com.

Daniel Ebenhöch

unread,
Feb 14, 2021, 9:28:37 AM2/14/21
to libDAI
Hi Joris,

thank you for your idea about removing /tr1. I tried to add the old tr1 headers manually but started a never ending add - and miss story.

But removing /tr1 from the source code allowed me to compile!

What I did so far

1) In include/dai/util.h 
I uncommented this block

/*
#if defined(WINDOWS)
    #include <boost/tr1/unordered_map.hpp> // only present in boost 1.37 and higher
#elif defined(CYGWIN)
    #include <boost/tr1/unordered_map.hpp> // only present in boost 1.37 and higher
#elif defined(MACOSX)
    #include <boost/tr1/unordered_map.hpp> // only present in boost 1.37 and higher
#else
    #include <tr1/unordered_map> // only present in modern GCC distributions
#endif
*/

and added simply

#include <boost/unordered/unordered_map.hpp>

2) then I run 

daniel@MBP-von-Daniel libdai % make doinference

g++ -Iinclude -I/opt/local/include -Wno-deprecated -Wall -W -Wextra -fPIC -DMACOSX -arch arm64 -O3 -g -DDAI_DEBUG  -DDAI_WITH_BP -DDAI_WITH_FBP -DDAI_WITH_TRWBP -DDAI_WITH_MF -DDAI_WITH_HAK -DDAI_WITH_LC -DDAI_WITH_TREEEP -DDAI_WITH_JTREE -DDAI_WITH_MR -DDAI_WITH_GIBBS -DDAI_WITH_CBP -DDAI_WITH_DECMAP -Llib -L/opt/local/lib -o examples/doinference examples/doinference.cpp -ldai -lgmpxx -lgmp -arch arm64

And besides some major(?) warnings (*see below as the thread is quite long)

I found in the examples folder created from built process a doinference executable which I tested in 3

3) I tested it with 

./doinference ../../../factors.fg map 

where my factors.fg I have attached on this post

and received this error message

libc++abi.dylib: terminating with uncaught exception of type dai::Exception: Assertion failed: Assertion "vs.size() == N" failed [File include/dai/index.h, line 171, function: dai::Permute::Permute(const std::vector<Var> &, bool)]

zsh: abort      ./doinference ../../../factors.fg map

Could you further assist me in an assessment what could be the reason?

Kind thank you for your help!

Best,

Daniel

---

*warnings of make do inference

In file included from examples/doinference.cpp:12:

In file included from include/dai/alldai.h:23:

In file included from include/dai/daialg.h:21:

In file included from include/dai/regiongraph.h:20:

In file included from include/dai/weightedgraph.h:27:

In file included from /opt/local/include/boost/graph/prim_minimum_spanning_tree.hpp:15:

/opt/local/include/boost/graph/dijkstra_shortest_paths.hpp:99:25: warning: 

      unused parameter 'u' [-Wunused-parameter]

    void tree_edge(Edge u, Graph& g) { }

                        ^

/opt/local/include/boost/graph/dijkstra_shortest_paths.hpp:99:35: warning: 

      unused parameter 'g' [-Wunused-parameter]

    void tree_edge(Edge u, Graph& g) { }

                                  ^

/opt/local/include/boost/graph/dijkstra_shortest_paths.hpp:226:38: warning: 

      unused parameter 'g' [-Wunused-parameter]

      static type build(const Graph& g, const IndexMap& index, boost::sc...

                                     ^

/opt/local/include/boost/graph/dijkstra_shortest_paths.hpp:226:92: warning: 

      unused parameter 'array_holder' [-Wunused-parameter]

  ...Graph& g, const IndexMap& index, boost::scoped_array<Value>& array_holde...

                                                                  ^

/opt/local/include/boost/graph/dijkstra_shortest_paths.hpp:261:38: warning: 

      unused parameter 'g' [-Wunused-parameter]

      static type build(const Graph& g, const IndexMap& index) {

                                     ^

In file included from examples/doinference.cpp:12:

In file included from include/dai/alldai.h:23:

include/dai/daialg.h:239:14: warning: 

      'dai::DAIAlg<dai::FactorGraph>::backupFactors' hides overloaded virtual

      function [-Woverloaded-virtual]

        void backupFactors( const VarSet &vs ) { GRM::backupFactors( vs ); }

             ^

include/dai/exactinf.h:32:25: note: in instantiation of template class

      'dai::DAIAlg<dai::FactorGraph>' requested here

class ExactInf : public DAIAlgFG {

                        ^

include/dai/factorgraph.h:266:22: note: hidden overloaded virtual function

      'dai::FactorGraph::backupFactors' declared here: type mismatch at 1st

      parameter ('const std::set<size_t> &' (aka 'const set<unsigned long> &')

      vs 'const dai::VarSet &')

        virtual void backupFactors( const std::set<size_t>& facs );

                     ^

In file included from examples/doinference.cpp:12:

In file included from include/dai/alldai.h:23:

include/dai/daialg.h:244:14: warning: 

      'dai::DAIAlg<dai::FactorGraph>::restoreFactors' hides overloaded virtual

      function [-Woverloaded-virtual]

        void restoreFactors( const VarSet &vs ) { GRM::restoreFactors( vs ); }

             ^

include/dai/factorgraph.h:269:22: note: hidden overloaded virtual function

      'dai::FactorGraph::restoreFactors' declared here: different number of

      parameters (0 vs 1)

        virtual void restoreFactors();

                     ^

In file included from examples/doinference.cpp:12:

In file included from include/dai/alldai.h:23:

include/dai/daialg.h:239:14: warning: 

      'dai::DAIAlg<dai::RegionGraph>::backupFactors' hides overloaded virtual

      function [-Woverloaded-virtual]

        void backupFactors( const VarSet &vs ) { GRM::backupFactors( vs ); }

             ^

include/dai/hak.h:32:20: note: in instantiation of template class

      'dai::DAIAlg<dai::RegionGraph>' requested here

class HAK : public DAIAlgRG {

                   ^

include/dai/factorgraph.h:266:22: note: hidden overloaded virtual function

      'dai::FactorGraph::backupFactors' declared here: type mismatch at 1st

      parameter ('const std::set<size_t> &' (aka 'const set<unsigned long> &')

      vs 'const dai::VarSet &')

        virtual void backupFactors( const std::set<size_t>& facs );

                     ^

In file included from examples/doinference.cpp:12:

In file included from include/dai/alldai.h:23:

include/dai/daialg.h:244:14: warning: 

      'dai::DAIAlg<dai::RegionGraph>::restoreFactors' hides overloaded virtual

      function [-Woverloaded-virtual]

        void restoreFactors( const VarSet &vs ) { GRM::restoreFactors( vs ); }

             ^

include/dai/factorgraph.h:269:22: note: hidden overloaded virtual function

      'dai::FactorGraph::restoreFactors' declared here: different number of

      parameters (0 vs 1)

        virtual void restoreFactors();

                     ^

9 warnings generated.


Daniel Ebenhöch

unread,
Feb 14, 2021, 6:21:01 PM2/14/21
to libDAI
Update

The executable created like mentioned above actually works fine. There was a problem with my fg-File containing a character symbol for variables instead of only numeric names. After fixing this issue it works fine! :-)

There is just a minor issue, which doesn't block my work, but would be nice to have it all on its place. When I do the exclusive make instead of make doinference, then I receive a error about a missing boost lib: 

ld: library not found for -lboost_program_options
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [tests/testdai] Error 1

As a quick google survey couldn't solve the problem, maybe you would have a kind hint for me on that as well.

Best, Daniel
Reply all
Reply to author
Forward
0 new messages