Error makeing from github source

Following the general install instructions I get an error while makeing. I had already install mxnet in a conda env for python and everything worked fine.

Here is the line of the first error. It complains of ‘sem_t’ not naming a type. Sorry if the formatting is wrong.

g++ -std=c++11 -c -DMSHADOW_FORCE_STREAM -Wall -Wsign-compare -O3 -DNDEBUG=1 -I/home/afrl/mxnet/mshadow/ -I/home/afrl/mxnet/dmlc-core/include -fPIC -I/home/afrl/mxnet/nnvm/include -I/home/afrl/mxnet/dlpack/include -I/home/afrl/mxnet/nnvm/tvm/include -Iinclude -funroll-loops -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-local-typedefs -msse3 -I/usr/local/cuda/include -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMSHADOW_RABIT_PS=0 -DMSHADOW_DIST_PS=0 -DMSHADOW_USE_PASCAL=0 -DMXNET_USE_OPENCV=1 -I/usr/include/opencv -fopenmp -DMXNET_USE_OPERATOR_TUNING=1 -DMXNET_USE_LAPACK -DMSHADOW_USE_CUDNN=1 -I/home/afrl/mxnet/3rdparty/cub -DMXNET_ENABLE_CUDA_RTC=1 -DMXNET_USE_NCCL=0 -DMXNET_USE_LIBJPEG_TURBO=0 -MMD -c src/profiler/aggregate_stats.cc -o build/src/profiler/aggregate_stats.o
In file included from /home/afrl/mxnet/dmlc-core/include/dmlc/thread_group.h:10:0,
from src/profiler/./profiler.h:29,
from src/profiler/profiler.cc:31:
/home/afrl/mxnet/dmlc-core/include/dmlc/blockingconcurrentqueue.h:180:4: error: ‘sem_t’ does not name a >type
sem_t m_sema;

Following this there are many more errors along similar lines.

Suppose I should provide details of my system.

Can you confirm that your submodules are all updated? Specifically, if you type git status, do you see any modified submodules? If the answer is yes, try running

git submodule update --init --recursive

what version of g++?

All submodules are up to date.

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

In dmlc-core/include/blockingconcurrentqueue.h should be on line 36:

#include <semaphore.h>

This should be /usr/include/semaphore.h

In /usr/include/semaphore.h, on line 29, there is:

#include <bits/semaphore.h>

That file shoud be: /usr/include/x86_64-linux-gnu/bits/semaphore.h

At the bottom of that short, file, there should be:

typedef union
{
  char __size[__SIZEOF_SEM_T];
  long int __align;
} sem_t;

Do you have all of this? I also have Ubuntu 16.04, and gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904

Yes I have all of those as well.

Can you tell why it still thinks that sem_t is undefined in that case? If you put #error “message” near the sem_t declaration, does it cause an error? If not, if it’s in semaphore.h?

If you try to redefine sem_t in blockingconcurrentqueue.h, does it complain about a redefinition? i.e. typedef int sem_t

Adding in #error “message”, did not seem to do anything.

Redeclaring sem_t in blockingconcur…h doesn’t complain about redefinition, only about __size[__SIZEOF_SEM_T] not being defined.

I see no indication of why sem_t is not declared in blockingconcur…h. There would be an error if g++ was unable to link/find semaphore.h correct?

It looks like I have another semaphore.h located in /usr/local/include which makes no reference to bits/semaphore.h or declaring semt_t. I am not sure what its use is, it may be a custom file created by the previous user(work comp) gaging by the leading comment.

I masked that file and everything compiled fine.

Thanks for all the quick advice,

is there another semaphore.h that it is finding on your computer?

Yes see above. Not sure where it came from but masking it worked fine.

I was installing from source in order to install for julia. At the end of the build process with no errors the libmxnet.so file seems to be too small. Julia is unable to load it to install the package. I copied over the .so file from the python install I did which is twice the size and it worked fine.