[HELP] problem while using libgomp with i586-mingw32msvc-gcc

闫瑾 <[email protected]> Sun, 25 Aug 2013 16:10:01 +0800
Newsgroups gmane.comp.gnu.utils
Message-ID <CAKEW5NhaQ7jjeF-FaN-w4v-0p-JaJf0n5KDBNzDT9OFT=iFCPg@mail.gmail.com>
--001a11c37e30a296c204e4c12a7d
Content-Type: text/plain; charset=ISO-8859-1

HI

I am using i586-mingw32msvc-gcc to cross compile Windows program on Debian
7.1.0.

I test a very simple code:

int main(int argc, char* argv[])
 {
  #pragma omp parallel
   printf("Hello, world.\n");

   return 1;
 }

when I compile it with -fopenmp, I found an error:
$ i586-mingw32msvc-gcc -fopenmp /home/kinian/omp.c -o /home/kinian/omp.exe

i586-mingw32msvc-gcc: libgomp.spec: no such file or directory

then I copy *libgomp.spec* from /usr/lib/gcc/i486-linux-gnu/4.4/ to
/usr/lib/gcc/i586-mingw32msvc/4.4.4/

the error changed:
/usr/lib/gcc/i586-mingw32msvc/4.4.4/../../../../i586-mingw32msvc/bin/ld:
cannot find -lgomp
collect2: ld returned 1 exit status

so I also copy *libgomp.a* from /usr/lib/gcc/i486-linux-gnu/4.4/ to
/usr/lib/gcc/i586-mingw32msvc/4.4.4/
then the error is:
/tmp/ccS8r60e.o:omp.c:(.text+0x26): undefined reference to
`_GOMP_parallel_start'
/tmp/ccS8r60e.o:omp.c:(.text+0x37): undefined reference to
`_GOMP_parallel_end'
collect2: ld returned 1 exit status

I have noticed the version between i486-linux-gnu 4.4 and i586-mingw32msvc
4.4.4 is not matched.
And also the different between native compiler and cross compiler.
But I want to know how to get the correct matched file for i586-mingw32msvc.

Thanks for reply my question.

--001a11c37e30a296c204e4c12a7d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-family:arial,sans-serif;font-size:13px=
">HI=A0</span><div style=3D"font-family:arial,sans-serif;font-size:13px"><b=
r></div><div style=3D"font-family:arial,sans-serif;font-size:13px">I am usi=
ng=A0i586-mingw32msvc-gcc to cross compile Windows program on Debian 7.1.0.=
</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:13px">I test a very simple c=
ode:</div><div style=3D"font-family:arial,sans-serif;font-size:13px"><br></=
div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><div>int main(in=
t argc, char* argv[])<br></div><div>=A0{</div><div>=A0 #pragma omp parallel=
 =A0</div><div>=A0 =A0printf(&quot;Hello, world.\n&quot;);</div><div>=A0<br=
></div><div>
=A0 =A0return 1;</div><div>=A0}</div></div><div style=3D"font-family:arial,=
sans-serif;font-size:13px"><br></div><div style=3D"font-family:arial,sans-s=
erif;font-size:13px">when I compile it with -fopenmp, I found an error:</di=
v><div style=3D"font-family:arial,sans-serif;font-size:13px">
$ i586-mingw32msvc-gcc -fopenmp /home/kinian/omp.c -o /home/kinian/omp.exe<=
br></div><div style=3D"font-family:arial,sans-serif;font-size:13px"><br></d=
iv><div style=3D"font-family:arial,sans-serif;font-size:13px">i586-mingw32m=
svc-gcc: libgomp.spec: no such file or directory<br>
</div><div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div>=
<div style=3D"font-family:arial,sans-serif;font-size:13px">then I copy=A0<b=
>libgomp.spec</b>=A0from=A0/usr/lib/gcc/i486-linux-gnu/4.4/ to /usr/lib/gcc=
/i586-mingw32msvc/4.4.4/</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:13px">the error changed:</di=
v><div style=3D"font-family:arial,sans-serif;font-size:13px"><div>/usr/lib/=
gcc/i586-mingw32msvc/4.4.4/../../../../i586-mingw32msvc/bin/ld: cannot find=
 -lgomp</div>
<div>collect2: ld returned 1 exit status</div></div><div style=3D"font-fami=
ly:arial,sans-serif;font-size:13px"><br></div><div style=3D"font-family:ari=
al,sans-serif;font-size:13px">so I also copy=A0<b>libgomp.a</b>=A0from=A0/u=
sr/lib/gcc/i486-linux-gnu/4.4/ to /usr/lib/gcc/i586-mingw32msvc/4.4.4/</div=
>
<div style=3D"font-family:arial,sans-serif;font-size:13px">then the error i=
s:</div><div style=3D"font-family:arial,sans-serif;font-size:13px"><div>/tm=
p/ccS8r60e.o:omp.c:(.text+0x26): undefined reference to `_GOMP_parallel_sta=
rt&#39;</div>
<div>/tmp/ccS8r60e.o:omp.c:(.text+0x37): undefined reference to `_GOMP_para=
llel_end&#39;</div><div>collect2: ld returned 1 exit status</div></div><div=
 style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div style=
=3D"font-family:arial,sans-serif;font-size:13px">
I have noticed the version between i486-linux-gnu 4.4 and i586-mingw32msvc =
4.4.4 is not matched.</div><div style=3D"font-family:arial,sans-serif;font-=
size:13px">And also the different between native compiler and cross compile=
r.</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px">But I want to kn=
ow how to get the correct matched file for i586-mingw32msvc.</div><div styl=
e=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div style=3D"f=
ont-family:arial,sans-serif;font-size:13px">
Thanks for reply my question.</div></div>

--001a11c37e30a296c204e4c12a7d--