-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Complie error (not the mxnet itself. but cpp interface) #12543
Comments
Thanks for submitting the issue @s0302102 |
@s0302102
I tried above fixes and the code worked with the latest code in mxnet repository. I also had to correct the paths such as ../data/train-images.idx3-ubyte for my setup. You can also refer to "mlp_cpu.cpp" example in "https://github.com/apache/incubator-mxnet/tree/master/cpp-package/example" folder |
@leleamol Thanks very much for your comment.
/////// |
@s0302102 I was able to build latest version of mxnet and examples correctly. For reference: Here is an sample of compile command for compiling an example (test_example.cpp) in cpp-package/example directory.
The header file dependency for this example is
|
Description
compile with cpp-package ok but when use the libmxnet.so from cpp, some header files go wrong
Environment info (Required)
----------Python Info----------
('Version :', '2.7.12')
('Compiler :', 'GCC 5.4.0 20160609')
('Build :', ('default', 'Dec 4 2017 14:50:18'))
('Arch :', ('64bit', 'ELF'))
------------Pip Info-----------
('Version :', '10.0.1')
('Directory :', '/usr/local/lib/python2.7/dist-packages/pip')
----------MXNet Info-----------
('Version :', '1.2.0')
('Directory :', '/usr/local/lib/python2.7/dist-packages/mxnet')
('Commit Hash :', '73d879cf6439eb83b337fcbf6c743dbf385b9766')
----------System Info----------
('Platform :', 'Linux-4.15.0-34-generic-x86_64-with-Ubuntu-16.04-xenial')
('system :', 'Linux')
('node :', 'xyliu-B250M-D3H')
('release :', '4.15.0-34-generic')
('version :', '#37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018')
----------Hardware Info----------
('machine :', 'x86_64')
('processor :', 'x86_64')
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Stepping: 9
CPU MHz: 4099.257
CPU max MHz: 4200.0000
CPU min MHz: 800.0000
BogoMIPS: 7200.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0008 sec, LOAD: 1.2187 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0022 sec, LOAD: 3.9907 sec.
Error open FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, <urlopen error ('_ssl.c:574: The handshake operation timed out',)>, DNS finished in 0.261016130447 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0031 sec, LOAD: 0.9128 sec.
Error open Gluon Tutorial(en): http://gluon.mxnet.io, <urlopen error ('_ssl.c:574: The handshake operation timed out',)>, DNS finished in 0.618535995483 sec.
Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error ('_ssl.c:574: The handshake operation timed out',)>, DNS finished in 1.5422270298 sec.
Package used (Python/R/Scala/Julia):
(I'm using cpp-package)
For Scala user, please provide:
java -version
)mvn -version
)scala -version
)For R user, please provide R
sessionInfo()
:Build info (Required if built from source)
Compiler (gcc/clang/mingw/visual studio):
g++
MXNet commit hash:
(Paste the output of
git rev-parse HEAD
here.)597a637
Build config:
(Paste the content of config.mk, or the build command.)
compile OK
Error Message:
typical errors:
3rParty/dmlc-core/include/dmlc/base.h:245:1: error: template with C linkage template
3rParty/dmlc-core/include/dmlc/base.h:282:14: error: no match for 'operator []'(operand types are 'const string {aka const std::__cxx11::basic_string }' and 'int') return &str[0]
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:79:27:error:redeclaration of 'unsigned int wait::::__w_retcode' unsigned int __w_retcode:8;
and other similar errors.
Minimum reproducible example
cpp code example:
#include
#include "mxnet-cpp/MxNetCpp.h"
using namespace std;
using namespace mxnet::cpp;
Symbol mlp(const vector &layers)
{
auto x = Symbol::Variable("X");
auto label = Symbol::Variable("label");
}
int main(int argc, char** argv)
{
const int image_size = 28;
const vector layers{ 128, 64, 10 };
const int batch_size = 100;
const int max_epoch = 10;
const float learning_rate = 0.1;
const float weight_decay = 1e-2;
}
##CMakelists.txt
project(mxnet_cpp_test)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++11 -W")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../3rParty/mxnet/inc/
${CMAKE_CURRENT_SOURCE_DIR}/../3rParty/dmlc-core/include/dmlc
${CMAKE_CURRENT_SOURCE_DIR}/../3rParty/mxnet/inc/cpp-package/include
)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/mxnet/lib/)
add_executable(mxnet_cpp_test mxnet_cpp_test.cpp)
target_link_libraries(
mxnet_cpp_test
${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/mxnet/lib/libmxnet.so)
Whatever I use cmaklists.txt or write the makefile directly, the results are the same. I don't know how to fix this issue.
The text was updated successfully, but these errors were encountered: