I have a project with multiple targets release and test that is linked against a static library which may be compiled with a TEST macro.
Say I want my release target to be built without the TEST macro and the test target to be built with that macro defined but that macro has to propagate to the linked-against library.
In my main CMakeLists.txt I have created the targets and defined that macro using target_compile_definitions(mytest PUBLIC TEST) but obviously the library core is not recognizing it.
The project tree is as follows:
.
├── CMakeLists.txt
├── core
│ ├── CMakeLists.txt
│ ├── inc
│ │ ├── core_comp1.h
│ │ └── core_comp2.h
│ └── src
│ ├── core_comp1.c
│ └── core_comp2.c
├── lib
│ ├── CMakeLists.txt
│ ├── inc
│ │ ├── ext_comp1.h
│ │ └── ext_comp2.h
│ └── src
│ ├── ext_comp1.c
│ └── ext_comp2.c
├── main.c
├── README.md
└── test.c
The root ./CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 3.10)
# set the project name
project(cmake_test)
# add the subdirectories
add_subdirectory(core)
add_subdirectory(lib)
# define my targets
set(MY_TARGETS myexe mytest)
# create and link against the libs
foreach(target ${MY_TARGETS})
add_executable(${target})
target_link_libraries(${target} PRIVATE core ext)
endforeach(target ${MY_TARGETS})
# add target specific sources
target_sources(myexe PRIVATE main.c)
target_sources(mytest PRIVATE test.c)
# define the TEST macro for mytest
target_compile_definitions(mytest PUBLIC TEST)
The ./core/CMakeLists.txt library folder has:
add_library(core
${CMAKE_CURRENT_SOURCE_DIR}/src/core_comp1.c
${CMAKE_CURRENT_SOURCE_DIR}/src/core_comp2.c
)
target_include_directories(core PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/inc
)
target_link_libraries(core PRIVATE ext)
The output of myexe, the release target is correct:
Running the release executable
Original core_comp1_display
While that of mytest is not correct:
Running the test executable
Original core_comp1_display
It should be:
Running the test executable
Test core_comp1_display
I have pushed the project to GitLab at cmake-library-test
The compilation of the myexe target gives the follows:
[build] [9/12 8% :: 0.032] /usr/bin/gcc -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/myexe.dir/lib/src/ext_comp2.c.o -MF CMakeFiles/myexe.dir/lib/src/ext_comp2.c.o.d -o CMakeFiles/myexe.dir/lib/src/ext_comp2.c.o -c ../../lib/src/ext_comp2.c
[build] [9/12 16% :: 0.034] /usr/bin/gcc -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/myexe.dir/core/src/core_comp2.c.o -MF CMakeFiles/myexe.dir/core/src/core_comp2.c.o.d -o CMakeFiles/myexe.dir/core/src/core_comp2.c.o -c ../../core/src/core_comp2.c
[build] [9/12 25% :: 0.039] /usr/bin/gcc -I../../lib/inc -g -MD -MT lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o -MF lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o.d -o lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o -c ../../lib/src/ext_comp2.c
[build] [9/12 33% :: 0.041] /usr/bin/gcc -I../../lib/inc -g -MD -MT lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o -MF lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o.d -o lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o -c ../../lib/src/ext_comp1.c
[build] [10/12 41% :: 0.043] /usr/bin/gcc -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/myexe.dir/lib/src/ext_comp1.c.o -MF CMakeFiles/myexe.dir/lib/src/ext_comp1.c.o.d -o CMakeFiles/myexe.dir/lib/src/ext_comp1.c.o -c ../../lib/src/ext_comp1.c
[build] [10/12 50% :: 0.046] /usr/bin/gcc -I../../core/inc -g -MD -MT core/CMakeFiles/core.dir/src/core_comp2.c.o -MF core/CMakeFiles/core.dir/src/core_comp2.c.o.d -o core/CMakeFiles/core.dir/src/core_comp2.c.o -c ../../core/src/core_comp2.c
[build] [10/12 58% :: 0.049] /usr/bin/gcc -I../../core/inc -g -MD -MT core/CMakeFiles/core.dir/src/core_comp1.c.o -MF core/CMakeFiles/core.dir/src/core_comp1.c.o.d -o core/CMakeFiles/core.dir/src/core_comp1.c.o -c ../../core/src/core_comp1.c
[build] [11/12 66% :: 0.054] /usr/bin/gcc -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/myexe.dir/main.c.o -MF CMakeFiles/myexe.dir/main.c.o.d -o CMakeFiles/myexe.dir/main.c.o -c ../../main.c
[build] [11/12 75% :: 0.058] /usr/bin/gcc -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/myexe.dir/core/src/core_comp1.c.o -MF CMakeFiles/myexe.dir/core/src/core_comp1.c.o.d -o CMakeFiles/myexe.dir/core/src/core_comp1.c.o -c ../../core/src/core_comp1.c
[build] [11/12 83% :: 0.110] : && /usr/bin/cmake -E rm -f lib/libmylib.a && /usr/bin/ar qc lib/libmylib.a lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o && /usr/bin/ranlib lib/libmylib.a && :
[build] [11/12 91% :: 0.119] : && /usr/bin/cmake -E rm -f core/libcore.a && /usr/bin/ar qc core/libcore.a core/CMakeFiles/core.dir/src/core_comp1.c.o core/CMakeFiles/core.dir/src/core_comp2.c.o && /usr/bin/ranlib core/libcore.a && :
[build] [12/12 100% :: 0.147] : && /usr/bin/gcc -g CMakeFiles/myexe.dir/main.c.o CMakeFiles/myexe.dir/core/src/core_comp1.c.o CMakeFiles/myexe.dir/core/src/core_comp2.c.o CMakeFiles/myexe.dir/lib/src/ext_comp1.c.o CMakeFiles/myexe.dir/lib/src/ext_comp2.c.o -o myexe core/libcore.a lib/libmylib.a && :
[build] Build finished with exit code 0
Whereas the compilation of mytest give:
[build] [9/12 8% :: 0.035] /usr/bin/gcc -I../../core/inc -g -MD -MT core/CMakeFiles/core.dir/src/core_comp2.c.o -MF core/CMakeFiles/core.dir/src/core_comp2.c.o.d -o core/CMakeFiles/core.dir/src/core_comp2.c.o -c ../../core/src/core_comp2.c
[build] [9/12 16% :: 0.045] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o -MF CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o.d -o CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o -c ../../lib/src/ext_comp1.c
[build] [9/12 25% :: 0.047] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -MF CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o.d -o CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -c ../../lib/src/ext_comp2.c
[build] [9/12 33% :: 0.049] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/core/src/core_comp2.c.o -MF CMakeFiles/mytest.dir/core/src/core_comp2.c.o.d -o CMakeFiles/mytest.dir/core/src/core_comp2.c.o -c ../../core/src/core_comp2.c
[build] [9/12 41% :: 0.049] /usr/bin/gcc -I../../core/inc -g -MD -MT core/CMakeFiles/core.dir/src/core_comp1.c.o -MF core/CMakeFiles/core.dir/src/core_comp1.c.o.d -o core/CMakeFiles/core.dir/src/core_comp1.c.o -c ../../core/src/core_comp1.c
[build] [10/12 50% :: 0.052] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/test.c.o -MF CMakeFiles/mytest.dir/test.c.o.d -o CMakeFiles/mytest.dir/test.c.o -c ../../test.c
[build] [10/12 58% :: 0.056] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/core/src/core_comp1.c.o -MF CMakeFiles/mytest.dir/core/src/core_comp1.c.o.d -o CMakeFiles/mytest.dir/core/src/core_comp1.c.o -c ../../core/src/core_comp1.c
[build] [10/12 66% :: 0.065] /usr/bin/gcc -I../../lib/inc -g -MD -MT lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o -MF lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o.d -o lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o -c ../../lib/src/ext_comp2.c
[build] [10/12 75% :: 0.069] /usr/bin/gcc -I../../lib/inc -g -MD -MT lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o -MF lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o.d -o lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o -c ../../lib/src/ext_comp1.c
[build] [11/12 83% :: 0.127] : && /usr/bin/cmake -E rm -f core/libcore.a && /usr/bin/ar qc core/libcore.a core/CMakeFiles/core.dir/src/core_comp1.c.o core/CMakeFiles/core.dir/src/core_comp2.c.o && /usr/bin/ranlib core/libcore.a && :
[build] [11/12 91% :: 0.139] : && /usr/bin/cmake -E rm -f lib/libmylib.a && /usr/bin/ar qc lib/libmylib.a lib/CMakeFiles/mylib.dir/src/ext_comp1.c.o lib/CMakeFiles/mylib.dir/src/ext_comp2.c.o && /usr/bin/ranlib lib/libmylib.a && :
[build] [12/12 100% :: 0.168] : && /usr/bin/gcc -g CMakeFiles/mytest.dir/test.c.o CMakeFiles/mytest.dir/core/src/core_comp1.c.o CMakeFiles/mytest.dir/core/src/core_comp2.c.o CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -o mytest core/libcore.a lib/libmylib.a && :
[build] Build finished with exit code 0
It is clear that core_comp*.c and ext_comp*.c were compiled without -DTEST
Using the suggested INTERFACE keyword, the flag -DTEST is passed into all files and the compilation is as follows:
[build] [5/6 16% :: 0.024] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/core/src/core_comp2.c.o -MF CMakeFiles/mytest.dir/core/src/core_comp2.c.o.d -o CMakeFiles/mytest.dir/core/src/core_comp2.c.o -c ../../core/src/core_comp2.c
[build] [5/6 33% :: 0.025] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -MF CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o.d -o CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -c ../../lib/src/ext_comp2.c
[build] [5/6 50% :: 0.038] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o -MF CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o.d -o CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o -c ../../lib/src/ext_comp1.c
[build] [5/6 66% :: 0.041] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/core/src/core_comp1.c.o -MF CMakeFiles/mytest.dir/core/src/core_comp1.c.o.d -o CMakeFiles/mytest.dir/core/src/core_comp1.c.o -c ../../core/src/core_comp1.c
[build] [5/6 83% :: 0.058] /usr/bin/gcc -DTEST -I../../core/inc -I../../lib/inc -g -MD -MT CMakeFiles/mytest.dir/test.c.o -MF CMakeFiles/mytest.dir/test.c.o.d -o CMakeFiles/mytest.dir/test.c.o -c ../../test.c
[build] [6/6 100% :: 0.134] : && /usr/bin/gcc -g CMakeFiles/mytest.dir/test.c.o CMakeFiles/mytest.dir/core/src/core_comp1.c.o CMakeFiles/mytest.dir/core/src/core_comp2.c.o CMakeFiles/mytest.dir/lib/src/ext_comp1.c.o CMakeFiles/mytest.dir/lib/src/ext_comp2.c.o -o mytest && :
[build] Build finished with exit code 0
The libraries core and mylib are now transparent and the targets myexe and mytest are actually considering the libraries sources are 'their'
One way to achieve similar behavior is to use an interface library and add the source files to the interface library via target_sources().
This doesn't actually propagate the definition down to the library, instead it brings the sources up to the consuming targets. One would want to be sure and only depend on this library via PRIVATE or else the sources would get compiled for each subsequent dependent.
I wouldn't encourage this solution, but I've had need of it before, so thought I would share.
./CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(example)
add_subdirectory(lib)
add_executable(my_exe main.c)
target_link_libraries(my_exe PRIVATE my_lib)
add_executable(my_test main.c)
target_link_libraries(my_test PRIVATE my_lib)
target_compile_definitions(my_test PRIVATE TEST)
./main.c
#include <stdio.h>
const char * get_string();
int main(int argc, char *argv[]) {
printf("The message is \"%s\"\n", get_string());
return 0;
}
lib/CMakeLists.txt
add_library(my_lib INTERFACE)
target_sources(my_lib INTERFACE message.c)
lib/message.c
#ifdef TEST
const char * get_string(){
return "The test string";
}
#else
const char * get_string(){
return "The normal string";
}
#endif
Related
I'm trying to do a Yocto build of libstt.so from the Coqui project, with TFLite as the backend, for the Snapdragon 210 which has an armv7ahf processor. I've been using the meta-tensorflow OpenEmbedded layer as a starting point.
Getting Bazel compiled and working with the Yocto cross-compilation toolchain was heinously complicated, but that's happily behind me now, and my layer has progressed to building libstt.so itself.
However, towards the end of the build in the linking phase I get this R_ARM_TLS_LE32 relocation not permitted in shared object error:
ld: bazel-out/arm-opt/bin/tensorflow/lite/kernels/libeigen_support.pic.a(eigen_support.pic.o)(.text._ZNK6tflite13eigen_support12_GLOBAL__N_122EigenThreadPoolWrapper15CurrentThreadIdEv+0x2c): R_ARM_TLS_LE32 relocation not permitted in shared object
bazel-out/arm-opt/bin/tensorflow/lite/kernels/libeigen_support.pic.a(eigen_support.pic.o): In function `tflite::eigen_support::(anonymous namespace)::EigenThreadPoolWrapper::CurrentThreadId() const':
eigen_support.cc:(.text._ZNK6tflite13eigen_support12_GLOBAL__N_122EigenThreadPoolWrapper15CurrentThreadIdEv+0x2c): dangerous relocation: unsupported relocation
I gather that R_ARM_TLS_LE32 is an ELF static Thread Local Storage relocation code, and that eigen_support is incorrectly being compiled with static code that the linker won't accept? But I'm definitely out of my depth here.
The build is being initiated with:
bazel build \
--config=monolithic \
--verbose_explanations --verbose_failures \
--action_env ANDROID_NDK_API_LEVEL=21 \
--config=android \
--config=android_arm \
--define runtime=tflite \
--cxxopt="-fpermissive" \
--cxxopt="-std=c++14" \
--cpu="${BAZEL_TARGET_CPU}" \
-c opt \
--copt="-D_GLIBCXX_USE_CXX11_ABI=0" \
--copt=-fvisibility=hidden \
--copt=-O3 \
--copt=-D_GLIBCXX_USE_C99 \
--crosstool_top=#local_config_yocto_compiler//:toolchain \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--subcommands --explain=${T}/explain.log \
//native_client:libstt.so
}
eigen_support.pic.o itself is built with the following command (from the error log, formatted for ease of reading). Can you help me figure out why it's compiling wrong?
arm-oe-linux-gnueabi-gcc
-fstack-protector
-g0
-O2
-DNDEBUG
-ffunction-sections
-fdata-sections
-D_PYTHON_INCLUDE_TARGET
-MD
-MF bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.d
'-frandom-seed=bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.o'
-fPIC
-DEIGEN_MPL2_ONLY
'-DEIGEN_MAX_ALIGN_BYTES=64'
'-DEIGEN_HAS_TYPE_TRAITS=0'
-iquote .
-iquote bazel-out/arm-opt/bin
-iquote external/gemmlowp
-iquote bazel-out/arm-opt/bin/external/gemmlowp
-iquote external/eigen_archive
-iquote bazel-out/arm-opt/bin/external/eigen_archive
-iquote external/local_config_sycl
-iquote bazel-out/arm-opt/bin/external/local_config_sycl
-iquote external/ruy
-iquote bazel-out/arm-opt/bin/external/ruy
-iquote external/cpuinfo
-iquote bazel-out/arm-opt/bin/external/cpuinfo
-iquote external/clog
-iquote bazel-out/arm-opt/bin/external/clog
-Ibazel-out/arm-opt/bin/external/clog/_virtual_includes/clog
-isystem external/eigen_archive
-isystem bazel-out/arm-opt/bin/external/eigen_archive
-DTFLITE_WITH_RUY_GEMV
-w
-w
-fPIC
-D_GLIBCXX_USE_C99
-D_PYTHON_INCLUDE_TARGET
'-march=armv7-a'
'-mfpu=neon'
'-mfloat-abi=hard'
-Wl,-O1
'-Wl,--hash-style=gnu'
-Wl,--as-needed
-Wl,-z,relro,-z,now,-z,noexecstack
-fstack-protector-strong
-pie -fPIE '-D_FORTIFY_SOURCE=2'
-Wa,--noexecstack
-Wformat -Wformat-security '-Werror=format-security'
'--sysroot=/home/gbw/sc20_linux/poky/build/tmp-glibc/work/armv7ahf-neon-oe-linux-gnueabi/coqui/v0.10.0-alpha.9-r0/bazel/output_base/external/yocto_compiler/recipe-sysroot'
-O2
-Wa,--noexecstack
-fexpensive-optimizations
-frename-registers
-fomit-frame-pointer
-ftree-vectorize
-finline-functions
'-finline-limit=64'
'-Wno-error=maybe-uninitialized'
'-Wno-error=unused-result'
-fvisibility-inlines-hidden
'-std=c++14'
'-std=c++14' -fpermissive
'-std=c++14'
-DFARMHASH_NO_CXX_STRING
-Wno-sign-compare
-O3
-fno-exceptions
'-Wno-error=reorder'
-Wno-builtin-macro-redefined
'-D__DATE__="redacted"'
'-D__TIMESTAMP__="redacted"'
'-D__TIME__="redacted"'
-no-canonical-prefixes
-fno-canonical-system-headers
-c tensorflow/lite/kernels/eigen_support.cc
-o bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.o)
The issue was due to the -fPIE compiler flag being added by a bazelrc file that I didn't notice. Removing -fPIE fixed the error.
I have variable CC_OPTIONS has value set like below
-arch arm64 -mcpu=abc1 -c --debug -O2 -static -fstack-protector -ffreestanding -nostartfiles -std=c11
I wanted to extract -mcpu=abc1 from CC_OPTIONS
Tried below approach, but getting more than what i wanted.
string(REGEX REPLACE ".*mcpu=(.*)\ .*" "\\1" CPU_TYPE "${CC_OPTIONS}")
any suggestions?
If you use if(MATCHES) you can get character groups of the match using CMAKE_MATCH_<n>
set(MY_VAR "-arch arm64 -mcpu=abc1 -c --debug -O2 -static -fstack-protector -ffreestanding -nostartfiles -std=c11")
if (MY_VAR MATCHES "^([^ ]+ +)*(-mcpu=[^ ]+)( +[^ ]+)*$")
message(STATUS "Found match: ${CMAKE_MATCH_2}")
else()
message(FATAL_ERROR "mismatch")
endif()
Like that:
cmake_minimum_required (VERSION 2.8.11)
project (HELLO)
set(CC_OPTIONS "-arch arm64 -mcpu=abc1 -c --debug -O2 -static -fstack-protector -ffreestanding -nostartfiles -std=c11")
message(${CC_OPTIONS})
string(REGEX MATCH "\\-mcpu=[^ $]+" CPU_TYPE ${CC_OPTIONS})
message(${CPU_TYPE})
Example:
$ cmake .
-arch arm64 -mcpu=abc1 -c --debug -O2 -static -fstack-protector -ffreestanding -nostartfiles -std=c11
-mcpu=abc1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ja/cmake
I use R version 4.0.2 (2020-06-22) -- "Taking Off Again". My system is W10 enterprise 1909.
I assume I have correctly installed Rtools40, since:
install.packages("jsonlite", type = "source") terminates correctly
I used some code from devtools: has_rtools() and it returns TRUE.
install.packages("jsonlite", type = "source")
essai de l'URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.6.1.tar.gz'
Content type 'application/x-gzip' length 1057910 bytes (1.0 MB)
downloaded 1.0 MB
* installing *source* package 'jsonlite' ...
** package 'jsonlite' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw32/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw32/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/i386
*** arch - x64
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw64/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw64/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'jsonlite'
finding HTML links ... fini
base64 html
flatten html
fromJSON html
prettify html
rbind_pages html
read_json html
serializeJSON html
stream_in html
unbox html
validate html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (jsonlite)
The downloaded source packages are in
‘C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages’
One of my issue may come from the location of make:
Sys.which("make")
make
"C:\\WINDOWS\\SYSTEM32\\make.exe"
instead of the expected
Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"
I have asked my IT department to remove the system32 version from my laptop.
Nevertheless, I am not sure it is the root cause of my issues:
install.packages("Rcpp", type = 'source')
essai de l'URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.6.tar.gz'
Content type 'application/x-gzip' length 2751467 bytes (2.6 MB)
downloaded 2.6 MB
* installing *source* package 'Rcpp' ...
** package 'Rcpp' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c api.cpp -o api.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c attributes.cpp -o attributes.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c barrier.cpp -o barrier.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c date.cpp -o date.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c module.cpp -o module.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c rcpp_init.cpp -o rcpp_init.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o Rcpp.dll tmp.def api.o attributes.o barrier.o date.o module.o rcpp_init.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw32/bin/"g++ -std=gnu++11 : No such file or directory
aucune DLL n'a pas été créé
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp'
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
If I install the compiled version it works, but then I can't use Rcpp:
install.packages("Rcpp")
essai de l'URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rcpp_1.0.4.6.zip'
Content type 'application/zip' length 3167452 bytes (3.0 MB)
downloaded 3.0 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages
> Rcpp::evalCpp("2+2")
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I"C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp/include" -I"C:/Users/toto26/AppData/Local/Temp/RtmpQrssTP/sourceCpp-x86_64-w64-mingw32-1.0.4.6" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file477046ea4828.cpp -o file477046ea4828.o
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o sourceCpp_2.dll tmp.def file477046ea4828.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw64/bin/"g++ -std=gnu++11 : No such file or directory
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error occurred building shared library.
Any hints would be more than welcome.
Thanks a lot in advance.
Emmanuel
edit: here is my path:
> Sys.getenv('PATH')
[1] "C:\\rtools40\\usr\\bin;C:\\Users\\toto26\\Documents\\R\\R-4.0.2\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\RBuildTools\\bin;C:\\RBuildTools\\mingw_64\\bin;C:\\RBuildTools\\mingw_32\\bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MATLAB\\R2018a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2018a\\bin;C:\\Program Files (x86)\\PDFtk\\bin\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\rtools40\\usr\\bin;C:\\RBuildTools\\3.5\\mingw_64\\bin;C:\\RBuildTools\\3.5\\bin;C:\\Python\\Scripts\\;C:\\Python\\;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\atom\\bin;C:\\Users\\toto26\\AppData\\Local\\Programs\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\RBuildTools\\3.3\\mingw_64\\bin;C:\\MinGW\\bin;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\Pandoc\\;"
I want to build TensorFlow 1.3 (not 1.13) on Ubuntu 16.04, with support for MPI (instead of the default gRPC). I installed the package libopenmpi-dev from the Ubuntu repos. I have supplied /usr/lib/openmpi as the MPI toolkit directory when running the configure script.
I use this command to launch the build:
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
But there is a header inclusion problem:
The file tensorflow/contrib/mpi/mpi_utils.cc includes tensorflow/contrib/mpi/mpi_utils.h
This mpi_utils.h includes third_party/mpi/mpi.h
This mpi.h is a symlink to /usr/lib/openmpi/include/mpi.h
This actual mpi.h contains this line:
#include "openmpi/ompi/mpi/cxx/mpicxx.h"
And mpicxx.h is in the folder /usr/lib/openmpi/include/openmpi/ompi/mpi/cxx/, which is not in the include path.
I have "fixed" this by creating a symlink to the right folder:
$ ln -s /usr/lib/openmpi/include/openmpi third_party/mpi/openmpi
Now mpicxx.h is found, but it wants to include mpi.h, which fails since mpi.h is not in the same folder:
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
WARNING: /home/arno/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately.
WARNING: /home/arno/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately.
INFO: Found 1 target...
ERROR: /home/arno/tensorflow/tensorflow/contrib/mpi/BUILD:60:1: C++ compilation of rule '//tensorflow/contrib/mpi:mpi_rendezvous_mgr' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter ... (remaining 151 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from ./third_party/mpi/mpi.h:2673:0,
from ./tensorflow/contrib/mpi/mpi_utils.h:27,
from ./tensorflow/contrib/mpi/mpi_rendezvous_mgr.h:33,
from tensorflow/contrib/mpi/mpi_rendezvous_mgr.cc:18:
./third_party/mpi/openmpi/ompi/mpi/cxx/mpicxx.h:35:17: fatal error: mpi.h: No such file or directory
compilation terminated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/arno/tensorflow/tensorflow/tools/pip_package/BUILD:134:1 C++ compilation of rule '//tensorflow/contrib/mpi:mpi_rendezvous_mgr' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter ... (remaining 151 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
INFO: Elapsed time: 6.668s, Critical Path: 4.98s
I have tried to manually add the headers' path to GCC's include path with this command:
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package --copt='-I/usr/lib/openmpi/include'
...but then I get errors because the headers included from /usr/lib/openmpi/include/openmpi/ompi/mpi/cxx are not declared in Bazel's configuration files. And I can't declare them to Bazel since it doesn't accept absolute paths.
I can't find the right way to make this build work. I am new to Bazel, and from what I have read, the build directory should be "self-contained", that is, contain all the headers and source files necessary, but the TensorFlow repository violates this by adding symlinks to /usr/lib/... in third_party/mpi. Changing TensorFlow versions is not an option.
How can I build TensorFlow 1.3 with OpenMPI support?
Edit: adding the -s option to the Bazel build command, like suggested in the comments, gives a more detailed output, but I can't discern which compilator is used. I think these are the relevant lines:
>>>>> # //tensorflow/core/kernels:transpose_functor [action 'Compiling tensorflow/core/kernels/transpose_functor_cpu.cc']
(cd /home/arno/.cache/bazel/_bazel_arno/e7d941e3336cbc1a05a122432422a066/execroot/tensorflow && \
exec env - \
CUDA_TOOLKIT_PATH=/usr/local/cuda \
CUDNN_INSTALL_PATH=/usr/local/lib \
GCC_HOST_COMPILER_PATH=/usr/bin/gcc \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/arno/bin \
PYTHON_BIN_PATH=/usr/bin/python3 \
PYTHON_LIB_PATH=/usr/lib/python3/dist-packages \
TF_CUDA_CLANG=0 \
TF_CUDA_COMPUTE_CAPABILITIES=6.2 \
TF_CUDA_VERSION=8.0 \
TF_CUDNN_VERSION=6 \
TF_NEED_CUDA=1 \
TF_NEED_OPENCL=0 \
external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections '-march=native' '-std=c++11' '-march=native' -MD -MF bazel-out/local_linux-py3-opt/bin/tensorflow/core/kernels/_objs/transpose_functor/tensorflow/core/kernels/transpose_functor_cpu.pic.d '-frandom-seed=bazel-out/local_linux-py3-opt/bin/tensorflow/core/kernels/_objs/transpose_functor/tensorflow/core/kernels/transpose_functor_cpu.pic.o' -fPIC -DEIGEN_MPL2_ONLY -DTENSORFLOW_USE_JEMALLOC -DSNAPPY -DTENSORFLOW_USE_MPI -iquote . -iquote bazel-out/local_linux-py3-opt/genfiles -iquote external/jemalloc -iquote bazel-out/local_linux-py3-opt/genfiles/external/jemalloc -iquote external/bazel_tools -iquote bazel-out/local_linux-py3-opt/genfiles/external/bazel_tools -iquote external/protobuf -iquote bazel-out/local_linux-py3-opt/genfiles/external/protobuf -iquote external/eigen_archive -iquote bazel-out/local_linux-py3-opt/genfiles/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/local_linux-py3-opt/genfiles/external/local_config_sycl -iquote external/gif_archive -iquote bazel-out/local_linux-py3-opt/genfiles/external/gif_archive -iquote external/jpeg -iquote bazel-out/local_linux-py3-opt/genfiles/external/jpeg -iquote external/com_googlesource_code_re2 -iquote bazel-out/local_linux-py3-opt/genfiles/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/local_linux-py3-opt/genfiles/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/local_linux-py3-opt/genfiles/external/fft2d -iquote external/highwayhash -iquote bazel-out/local_linux-py3-opt/genfiles/external/highwayhash -iquote external/png_archive -iquote bazel-out/local_linux-py3-opt/genfiles/external/png_archive -iquote external/zlib_archive -iquote bazel-out/local_linux-py3-opt/genfiles/external/zlib_archive -iquote external/snappy -iquote bazel-out/local_linux-py3-opt/genfiles/external/snappy -iquote external/local_config_cuda -iquote bazel-out/local_linux-py3-opt/genfiles/external/local_config_cuda -isystem external/jemalloc/include -isystem bazel-out/local_linux-py3-opt/genfiles/external/jemalloc/include -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/protobuf/src -isystem bazel-out/local_linux-py3-opt/genfiles/external/protobuf/src -isystem external/eigen_archive -isystem bazel-out/local_linux-py3-opt/genfiles/external/eigen_archive -isystem external/gif_archive/lib -isystem bazel-out/local_linux-py3-opt/genfiles/external/gif_archive/lib -isystem external/farmhash_archive/src -isystem bazel-out/local_linux-py3-opt/genfiles/external/farmhash_archive/src -isystem external/png_archive -isystem bazel-out/local_linux-py3-opt/genfiles/external/png_archive -isystem external/zlib_archive -isystem bazel-out/local_linux-py3-opt/genfiles/external/zlib_archive -isystem external/local_config_cuda/cuda -isystem bazel-out/local_linux-py3-opt/genfiles/external/local_config_cuda/cuda -isystem external/local_config_cuda/cuda/cuda/include -isystem bazel-out/local_linux-py3-opt/genfiles/external/local_config_cuda/cuda/cuda/include -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare -fno-exceptions '-DGOOGLE_CUDA=1' -msse3 -pthread '-DGOOGLE_CUDA=1' -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -fno-canonical-system-headers -c tensorflow/core/kernels/transpose_functor_cpu.cc -o bazel-out/local_linux-py3-opt/bin/tensorflow/core/kernels/_objs/transpose_functor/tensorflow/core/kernels/transpose_functor_cpu.pic.o)
ERROR: /home/arno/tensorflow/tensorflow/contrib/mpi/BUILD:48:1: C++ compilation of rule '//tensorflow/contrib/mpi:mpi_utils' failed: crosstool_wrapper_driver_is_n
ot_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter ... (remaining 131 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from ./third_party/mpi/mpi.h:2673:0,
from ./tensorflow/contrib/mpi/mpi_utils.h:27,
from tensorflow/contrib/mpi/mpi_utils.cc:18:
./third_party/mpi/openmpi/ompi/mpi/cxx/mpicxx.h:35:17: fatal error: mpi.h: No such file or directory
compilation terminated.
A workaround is to build and install MVAPICH from source (the MPI toolkit path is then /usr/local). The problem exists only with OpenMPI.
I am building TensorFlow with bazel, CUDA supported, on AWS GPU instance. I got:
error: unknown warning option '-Wno-invalid-partial-specialization'
Build options:
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package --verbose_failures
Detailed error message:
ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/ad1e09741bb4109fbc70ef8216b59ee2/external/boringssl/BUILD:91:1: C++ compilation of rule '#boringssl//:crypto' failed: clang failed: error executing command
(cd /home/ubuntu/.cache/bazel/_bazel_ubuntu/ad1e09741bb4109fbc70ef8216b59ee2/execroot/tensorflow && \
exec env - \
CLANG_CUDA_COMPILER_PATH=/usr/bin/clang \
COMPUTECPP_TOOLKIT_PATH=/usr/local/computecpp \
CUDA_TOOLKIT_PATH=/usr/local/cuda \
CUDNN_INSTALL_PATH=/usr/local/cuda-8.0 \
HOST_CXX_COMPILER=/usr/bin/g++ \
HOST_C_COMPILER=/usr/bin/gcc \
PWD=/proc/self/cwd \
PYTHON_BIN_PATH=/usr/bin/python \
PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages \
TF_CUDA_CLANG=1 \
TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2 \
TF_CUDA_VERSION=8.0 \
TF_CUDNN_VERSION='' \
TF_NEED_CUDA=1 \
TF_NEED_OPENCL=1 \
/usr/bin/clang '-march=native' -MD -MF bazel-out/local_linux-opt/bin/external/boringssl/_objs/crypto/external/boringssl/src/crypto/sha/sha512.pic.d -iquote external/boringssl -iquote bazel-out/local_linux-opt/genfiles/external/boringssl -iquote external/bazel_tools -iquote bazel-out/local_linux-opt/genfiles/external/bazel_tools -isystem external/boringssl/src/include -isystem bazel-out/local_linux-opt/genfiles/external/boringssl/src/include -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -fPIC -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wno-invalid-partial-specialization -fno-omit-frame-pointer -no-canonical-prefixes -DNDEBUG -g0 -O2 -ffunction-sections -fdata-sections -Wa,--noexecstack '-D_XOPEN_SOURCE=700' -Wall -Werror '-Wformat=2' -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wshadow -fno-common '-std=c11' -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -c external/boringssl/src/crypto/sha/sha512.c -o bazel-out/local_linux-opt/bin/external/boringssl/_objs/crypto/external/boringssl/src/crypto/sha/sha512.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
error: unknown warning option '-Wno-invalid-partial-specialization' [-Werror,-Wunknown-warning-option]
Target //tensorflow/tools/pip_package:build_pip_package failed to build