Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1356152

Summary: undefined references to omp_* when building openblas
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: openblasAssignee: Susi Lehtola <susi.lehtola>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: dan, davejohansen, jakub, jwakely, law, mpolacek, susi.lehtola
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-13 22:32:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1071880, 1356189    

Description Dan Horák 2016-07-13 13:46:00 UTC
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

Comment 1 Jakub Jelinek 2016-07-13 14:13:48 UTC
Do you use -fopenmp on the link line?

Comment 2 Dan Horák 2016-07-13 14:29:01 UTC
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

Comment 3 Jakub Jelinek 2016-07-13 14:43:08 UTC
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.

Comment 4 Dan Horák 2016-07-13 14:53:53 UTC
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 ...

Comment 5 Dan Horák 2016-07-13 16:49:34 UTC
switching to openblas, because the root cause is there

Comment 6 Susi Lehtola 2016-07-13 19:32:13 UTC
Looks like a simple problem of the make flags not getting passed to the recursive processes.