<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:36:52 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[GODRIVER-1660] Cannot Cross Compiling from Windows to Linux Using Tags CSE</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1660</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Currently, I have successfully built an API server with MongoDB CSFLE on Windows Machine for &quot;Windows OS&quot; using this command:&lt;/p&gt;

&lt;p&gt;set &lt;b&gt;&lt;ins&gt;GOOS = windows&lt;/ins&gt;&lt;/b&gt;, GOARCH = amd64&lt;/p&gt;

&lt;p&gt;go build -tags cse github.com\user\example_app&lt;/p&gt;

&lt;p&gt;output: example_app.exe&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;And then, I try to cross compiling the application for linux with same command,&lt;/p&gt;

&lt;p&gt;set &lt;b&gt;&lt;ins&gt;GOOS=linux&lt;/ins&gt;&lt;/b&gt;, GOARCH = amd64&lt;/p&gt;

&lt;p&gt;go build -tags cse github.com\user\example_app&lt;/p&gt;

&lt;p&gt;output: build failed (screenshot attached)&lt;/p&gt;



&lt;p&gt;Please help me to solve this issue,&lt;/p&gt;

&lt;p&gt;Thanks in advance&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment>Windows amd64, go version go1.14.4 windows/amd64, mongo-go-driver version&amp;#xA0;v1.4.0+prerelease</environment>
        <key id="1384923">GODRIVER-1660</key>
            <summary>Cannot Cross Compiling from Windows to Linux Using Tags CSE</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="app.apartemenku@gmail.com">Apartemenku Ap</reporter>
                        <labels>
                    </labels>
                <created>Fri, 19 Jun 2020 19:00:57 +0000</created>
                <updated>Fri, 27 Oct 2023 13:16:27 +0000</updated>
                            <resolved>Thu, 25 Jun 2020 13:42:51 +0000</resolved>
                                    <version>1.4.0</version>
                                                    <component>Internal</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3223704" author="divjot.arora" created="Thu, 25 Jun 2020 13:42:43 +0000"  >&lt;p&gt;Thanks for your response! I agree that setting up a Linux environment is a much simpler solution than trying to cross-compile from Windows. Because this didn&apos;t end up being a driver bug, I&apos;m going to close out this ticket as &quot;Works as Designed&quot;. Feel free to leave more comments if you need any help building the driver with CSFLE on Linux, though, and we&apos;d be happy to help out.&lt;/p&gt;

&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                            <comment id="3223535" author="JIRAUSER1253521" created="Thu, 25 Jun 2020 12:06:37 +0000"  >&lt;p&gt;Hi Divjot Arora,&lt;/p&gt;

&lt;p&gt;Yes, I think so, it&apos;s about host environment issue and libmongocrypt need specific packages to compile in Linux OS. So I will try to set Linux environment for build this program.&lt;/p&gt;

&lt;p&gt;Thank you for your help, really appreciate it&#160;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/biggrin.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="3223016" author="divjot.arora" created="Wed, 24 Jun 2020 22:40:14 +0000"  >&lt;p&gt;The closest I found to that error was&#160;&lt;a href=&quot;https://stackoverflow.com/questions/48015645/unknown-type-when-compiling-xz-utils-on-mingw-msys2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/48015645/unknown-type-when-compiling-xz-utils-on-mingw-msys2&lt;/a&gt;, which talks about the mingw compiler.&lt;/p&gt;

&lt;p&gt;Overall, though, I don&apos;t think this is a driver bug. I don&apos;t have much experience with cross-compilation, but most of the tutorials I&apos;m seeing are for Linux systems, not Windows. My understanding is that you&apos;d have to at least get a Linux toolchain for compiling C. You may also have to set up pkg-config because the driver uses it on Linux and Darwin systems to find the headers and flags needed to compile libmongocrypt and you&apos;d probably have to install libmongocrypt so all of the pkg-config files are in the right place (see&#160;&lt;a href=&quot;https://github.com/mongodb/libmongocrypt#installing-libmongocrypt-from-distribution-packages&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libmongocrypt#installing-libmongocrypt-from-distribution-packages&lt;/a&gt;).&lt;/p&gt;</comment>
                            <comment id="3221508" author="JIRAUSER1253521" created="Wed, 24 Jun 2020 14:33:39 +0000"  >&lt;p&gt;Hi Divjot Arora,&lt;/p&gt;

&lt;p&gt;It seems correct after I set CGO_ENABLED = 1 and run build command:&lt;/p&gt;

&lt;p&gt;I got this error:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;runtime/cgo&lt;br/&gt;
gcc_linux_amd64.c: In function &apos;_cgo_sys_thread_start&apos;:&lt;br/&gt;
gcc_linux_amd64.c:61:2: error: unknown type name &apos;sigset_t&apos;; did you mean &apos;_sigset_t&apos;?&lt;br/&gt;
 61 | sigset_t ign, oset;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; ^~~~~~~~&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; _sigset_t&lt;br/&gt;
gcc_linux_amd64.c:66:2: error: implicit declaration of function &apos;sigfillset&apos; &lt;span class=&quot;error&quot;&gt;&amp;#91;-Werror=implicit-function-declaration&amp;#93;&lt;/span&gt;&lt;br/&gt;
 66 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; sigfillset(&amp;amp;ign);&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; ^~~~~~~~~~&lt;br/&gt;
gcc_linux_amd64.c:61:16: error: unused variable &apos;oset&apos; &lt;span class=&quot;error&quot;&gt;&amp;#91;-Werror=unused-variable&amp;#93;&lt;/span&gt;&lt;br/&gt;
 61 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; sigset_t ign, oset;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; ^~~~&lt;br/&gt;
cc1.exe: all warnings being treated as errors&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;I have searched this error in google, but can&apos;t find the solution.&lt;/p&gt;</comment>
                            <comment id="3220177" author="divjot.arora" created="Tue, 23 Jun 2020 17:38:12 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=app.apartemenku%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;app.apartemenku@gmail.com&quot;&gt;app.apartemenku@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;We don&apos;t test cross-compiling cgo-based features in our CI, but this paragraph from&#160;&lt;a href=&quot;https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command&lt;/a&gt;&#160;seems like a good start:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The cgo tool is enabled by default for native builds on systems where it is expected to work. It is disabled by default when cross-compiling. You can control this by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it. The go tool will set the build constraint &quot;cgo&quot; if cgo is enabled. The special import &quot;C&quot; implies the &quot;cgo&quot; build constraint, as though the file also said &quot;// +build cgo&quot;. Therefore, if cgo is disabled, files that import &quot;C&quot; will not be built by the go tool. (For more about build constraints see&#160;&lt;a href=&quot;https://golang.org/pkg/go/build/#hdr-Build_Constraints&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://golang.org/pkg/go/build/#hdr-Build_Constraints&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;When cross-compiling, you must specify a C cross-compiler for cgo to use. You can do this by setting the generic CC_FOR_TARGET or the more specific CC_FOR_${GOOS}_${GOARCH} (for example, CC_FOR_linux_arm) environment variable when building the toolchain using make.bash, or you can set the CC environment variable any time you run the go tool.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;My guess is that all of the undefined type errors are due to the fact that cgo is disabled when cross-compiling. So to start, you can try setting &lt;tt&gt;CGO_ENABLED=1&lt;/tt&gt;. Based on the second paragraph, you might also have to set &lt;tt&gt;CC&lt;/tt&gt; to specify which compiler you want to use (like gcc if your target GOOS is linux?). Can you try these suggestions and let us know if you still have issues? Hopefully doing these will at least provide better error messages.&lt;/p&gt;

&lt;p&gt;&#8211; Divjot&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="266600" name="error_mongo.png" size="20933" author="app.apartemenku@gmail.com" created="Fri, 19 Jun 2020 18:53:11 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxdos7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>