I'm getting undefined reference errors when building openblas (https://admin.fedoraproject.org/pkgdb/package/rpms/openblas/) for ppc64. If I'm correct they are from gcc's libgomp. ... make[1]: *** [cblat1] Error 1 ../libopenblaso_power8-r0.2.18.a(zaxpy.o): In function `num_cpu_avail': /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:141: undefined reference to `omp_in_parallel' /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:146: undefined reference to `omp_get_max_threads' ../libopenblaso_power8-r0.2.18.a(zswap.o): In function `num_cpu_avail': /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:141: undefined reference to `omp_in_parallel' /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:146: undefined reference to `omp_get_max_threads' ../libopenblaso_power8-r0.2.18.a(zscal.o): In function `num_cpu_avail': /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:141: undefined reference to `omp_in_parallel' /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:146: undefined reference to `omp_get_max_threads' ../libopenblaso_power8-r0.2.18.a(zdscal.o): In function `num_cpu_avail': /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:141: undefined reference to `omp_in_parallel' /home/sharkcz/openblas/openblas-0.2.18/openmp/interface/../common_thread.h:146: undefined reference to `omp_get_max_threads' ../libopenblaso_power8-r0.2.18.a(blas_server.o): In function `exec_blas._omp_fn.0': /home/sharkcz/openblas/openblas-0.2.18/openmp/driver/others/blas_server_omp.c:305: undefined reference to `omp_get_num_threads' /home/sharkcz/openblas/openblas-0.2.18/openmp/driver/others/blas_server_omp.c:305: undefined reference to `omp_get_thread_num' ../libopenblaso_power8-r0.2.18.a(blas_server.o): In function `exec_threads': /home/sharkcz/openblas/openblas-0.2.18/openmp/driver/others/blas_server_omp.c:225: undefined reference to `omp_get_thread_num' ../libopenblaso_power8-r0.2.18.a(blas_server.o): In function `goto_set_num_threads': /home/sharkcz/openblas/openblas-0.2.18/openmp/driver/others/blas_server_omp.c:68: undefined reference to `omp_set_num_threads' ../libopenblaso_power8-r0.2.18.a(blas_server.o): In function `exec_blas': /home/sharkcz/openblas/openblas-0.2.18/openmp/driver/others/blas_server_omp.c:305: undefined reference to `GOMP_parallel' collect2: error: ld returned 1 exit status Makefile:133: recipe for target 'zblat1' failed ... tested locally on F-24, but http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=3535680 is a rawhide scratch build Version-Release number of selected component (if applicable): gcc-6.1.1-3.fc24.ppc64 libgomp-6.1.1-3.fc24.ppc64
Do you use -fopenmp on the link line?
seems not, below should be the corresponding command line leading to the error, going to check the openblas buildsystem ... gfortran -frecursive -o zblat1 zblat1.o ../libopenblaso_power8-r0.2.18.a -lm -lpthread -lgfortran -lm -lpthread -lgfortran
If anything in ../libopenblaso_power8-r0.2.18.a or zblat1.o is compiled with -fopenmp, then that is the bug, -fopenmp should be used not just during compilation, but also during linking if there is any object compiled with -fopenmp.
yep, and I think I at least see where is the difference between ppc64 and other arches - the other arches don't build the tests (in our rpm builds), thus don't call the wrong link command ...
switching to openblas, because the root cause is there
Looks like a simple problem of the make flags not getting passed to the recursive processes.