BLAKE2 / libb2

C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
Creative Commons Zero v1.0 Universal
132 stars 47 forks source link

mingw msys errors, libgomp #8

Open lvecsey opened 7 years ago

lvecsey commented 7 years ago

I am getting errors at the linking stage, when compiling on mingw msys.

Do I need to compile with -fopenmp or something else, such as installing a libgomp library? What steps would I follow to do that exactly?

Thank you.

--

.libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0xc): undefined reference to omp_get_thread_num' .libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0x7c): undefined reference toomp_get_thread_num' .libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0x5ea): undefined reference to omp_set_num_threads' .libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0x626): undefined reference toGOMP_parallel' .libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0x9d8): undefined reference to omp_set_num_threads' .libs/libb2_la-blake2sp.o:blake2sp.c:(.text+0xa1d): undefined reference toGOMP_parallel' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0xc): undefined reference to omp_get_thread_num' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0x7c): undefined reference toomp_get_thread_num' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0x6ba): undefined reference to omp_set_num_threads' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0x6f2): undefined reference toGOMP_parallel' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0xabb): undefined reference to omp_set_num_threads' .libs/libb2_la-blake2bp.o:blake2bp.c:(.text+0xb0c): undefined reference toGOMP_parallel' collect2.exe: error: ld returned 1 exit status

sneves commented 7 years ago

-fopenmp should be the only required compiler flag, yes. libgomp must also be installed. That should be all that is needed.

lvecsey commented 7 years ago

I got it working by adding -lgomp however I also had to make sure I was using the correct compiler in my path, in my case TDM-GCC-64

I can also suggest adding a line to configure.ac

AC_SEARCH_LIBS([GOMP_parallel], [gomp])

Thanks.

noloader commented 4 years ago

@lvecsey,

I think the problem was due to AC_OPENMP and the way flags were setup/used. Flags include AM_CFLAGS and CFLAGS. And I think the biggest offender was AC_OPENMP. The macro did not behave well during my testing.

There's an upcoming PR that tests OK on MinGW at Noloader | Autotools. The Autotools changes removes AC_OPENMP, uses AX_OPENMP and properly manages AM_CFLAGS and CFLAGS. The Autotools changes do not require work-arounds like AC_SEARCH_LIBS.

The Autotools changes also test OK on Cygwin.

What I am not sure of is, do we have similar environments. I'm testing on Windows 7. I don't know which MinGW version I have. Searching for "mingw get version" is turning up irrelevant noise.


For completeness, here are the commands I ran:

./autogen.sh
./configure --enable-openmp
make
Biswa96 commented 2 years ago

Any progress on this issue?

vtorri commented 11 months ago

@Biswa96 i've just compiled git, and not problem with mingw-w64 on msys2