# ND4J on OS/X execution error and building concerns

**URL:** <https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681>\
**Category:** ND4J\
**Created:** [November 13, 2021, 2:35am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681 "2021-11-13T02:35:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 13, 2021, 2:35am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/1 "2021-11-13T02:35:43Z")

</div>

Short question. I have managed to get to this error a couple times trying to build ND4J and then run it standalone class path.

Exception in thread “main” java.lang.NoClassDefFoundError: org/bytedeco/javacpp/openblas  
at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.setMaxThreads(CpuBlas.java:120)

Where should this class be found?

I opened an incident on this…  
deeplearning4j/nd4j/issues/2947

Searching my machine or Google I have been unable to determine where a org.bytedeco/javacpp/openblas class might be. I did find javacpp-presets gives you a couple locations for the class but in different packages.

Generally on building OS/X as mentioned in the issue it appeared changing to this in the nd4j pom.xml  
seemed needed  
\<lombok.version\>1.18.20\</lombok.version\>

Today I tried it again first running into this error. (Nd4jbackend) NoAvailableBackendException with…  
Please see: [http://nd4j.org/getstarted.html](http://nd4j.org/getstarted.html)  
hardcoded directly in the exception. This is a busted link.

I tried to follow this for today’s attempt  
[https://github.com/eclipse/deeplearning4j/blob/master/libnd4j/macOSx10%20(CPU%20only).md](https://github.com/eclipse/deeplearning4j/blob/master/libnd4j/macOSx10%20%28CPU%20only%29.md)

The gcc-5 recommendation seems a little dated. Unfortunately I didn’t save all the output from my attempts but before getting gcc squared away to run buildnativeoperations.sh…  
I had errors that \_stdio.h couldn’t be found. I also had…

dyld: lazy symbol binding failed: Symbol not found: \_\_\_emutls\_get\_address  
Referenced from: /usr/local/opt/gcc@5/lib/gcc/5/libgomp.1.dylib  
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: \_\_\_emutls\_get\_address  
Referenced from: /usr/local/opt/gcc@5/lib/gcc/5/libgomp.1.dylib  
Expected in: /usr/lib/libSystem.B.dylib

I found this issues/8217 suggesting gcc-8 as more current so I tried changing to that. (I’m only allowed 3 links on my first post).  
I think for one doing  
gcc unlink gcc@5  
cmake still seemed sort of stuck expecting gcc-5 so I changed buildnativeoperations.sh to…  
eval $CMAKE\_COMMAND -D CMAKE\_C\_COMPILER=gcc-8 -D CMAKE\_CXX\_COMPILER=g+±8 “$BLAS\_ARG” “$ARCH\_ARG” “$NAME\_ARG” “$SHARED\_LIBS\_ARG” “$MINIFIER\_ARG” “$OPERATIONS\_ARG” “$BUILD\_TYPE” “$PACKAGING\_ARG” “$EXPERIMENTAL\_ARG” “$CUDA\_COMPUTE” -DDEV=FALSE -DMKL\_MULTI\_THREADED=TRUE …/…

maybe the OS/X directions should be changed to reflect that gcc-8 be preferred to start with?

But this got me back to the same error above I had gotten just throwing jars and dylibs at my test.

If anyone can tell me where the org/bytedeco/javacpp/openblas class should be found or what I should change so it doesn’t expect it I would appreciate ti.

Thanks.

---

<div class="post-metadata">

**Author:** ![saudet](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/saudet/32/69_2.png) [@saudet](https://community.konduit.ai/u/saudet)\
**Post date:** [November 13, 2021, 4:11am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/2 "2021-11-13T04:11:17Z")

</div>

Please try again with a more recent version.

---

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 13, 2021, 4:22am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/3 "2021-11-13T04:22:52Z")

</div>

A more recent version of what?

---

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 13, 2021, 4:29am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/4 "2021-11-13T04:29:19Z")

</div>

I thought this morning I tried pulling current versions of nd4j, libnd4j and javacpp from origin using GitHub desktop. I think only one showed an update. Current gcc seemed not to fix anything. So I’m not sure what should be more recent?

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [November 13, 2021, 8:32am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/5 "2021-11-13T08:32:49Z")

</div>

@mik3hall of note. Please use the proper repository. That repository has long been abandoned. The repository is actually under: [https://github.com/eclipse/deeplearning4j](https://github.com/eclipse/deeplearning4j). Could you please tell me where you found the link to that repository? It would be handy to make sure other folks don’t get distracted.

[nd4j.org/](http://nd4j.org/) is also not the proper site. It’s: [https://deeplearning4j.konduit.ai/](https://deeplearning4j.konduit.ai/) under the nd4j section.

Your concern about the missing link isn’t a problem with the new site.

So I’m going to ignore that here.

Your building from source docs are also wrong. You can find them here:

> **[Build From Source](https://deeplearning4j.konduit.ai/multi-project/how-to-guides/build-from-source)**
>
> Instructions to build all DL4J libraries from source.

The most recent version (as you can see in the docs) is 1.0.0-M1.1 you should be fine using that.

For mac osx, generally if you just follow the github action for mac you can find for example the brew commands:  
[https://github.com/eclipse/deeplearning4j/blob/master/.github/workflows/build-deploy-mac.yml#L164](https://github.com/eclipse/deeplearning4j/blob/master/.github/workflows/build-deploy-mac.yml#L164)

If you need any help navigating that let me know.

---

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 13, 2021, 10:39am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/6 "2021-11-13T10:39:42Z")

</div>

> Blockquote  
> Could you please tell me where you found the link to that repository? It would be handy to make sure other folks don’t get distracted.

That was a little time back. I remembered seeing this a while ago and at this point was interested in a current, maintained, matrix library so probably just searched on ND4J and went from there. If these are not the current sources for any of this it might be an idea to mark the pages as no longer valid. It would of saved me quite a few hours of distraction.

I will attempt to follow the information you have indicated. I see for OS/X it still seems to involve home-brew and cmake. I still have a bit of a concern there in having gone back to try gcc-5 and that being remembered somehow when I try cmake. I might have to figure that out yet to follow this process. Again eliminating or marking obsolete the page that says to use gcc-5 could sometime save someone considerable effort and potential problems.

I will let you know if I run into any issues in this process.

Thanks for the reply.

---

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 13, 2021, 8:22pm UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/7 "2021-11-13T20:22:12Z")

</div>

The libndj4 file “macOSx10 (CPU only).md” has the exact directions I tried to follow for that.  
Including the gcc-5 which had the issues previously mentioned. gcc-8 seeming to be what was successful for that part.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [November 13, 2021, 10:08pm UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/8 "2021-11-13T22:08:22Z")

</div>

> [@mik3hall](#):
>
> id. It would of saved me quite a few hours of distraction.

@mik3hall Unfortunately, when we moved the library to the eclipse foundation we lost access to some of those. We’re working on getting that resolved.

In the mean time, libnd4j is about as stock as it gets for a c++ library. You can use maven if you want for the build process. As long as the right tools (compilers etc) are installed, we auto configure many of the flags you need to set for building libnd4j and then invoke the exact same script you would use for the build process.

---

<div class="post-metadata">

**Author:** ![mik3hall](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mik3hall/32/669_2.png) [@mik3hall](https://community.konduit.ai/u/mik3hall)\
**Post date:** [November 15, 2021, 4:38am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/9 "2021-11-15T04:38:04Z")

</div>

[SOLVED]  
I got the full deeplearning4j and build nd4j from that. Got it working well enough to do a simple test. For libnd4j it switched back to clang so the gcc-5 wasn’t a concern.  
Now have to try getting beyond the simple test.  
Thanks again

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [November 15, 2021, 4:40am UTC](https://community.konduit.ai/t/nd4j-on-os-x-execution-error-and-building-concerns/1681/10 "2021-11-15T04:40:31Z")

</div>

@mik3hall thanks a lot for following up. Glad you got the build working!
