Try a VMWARE virtual machine.
Install a FreeBSD distro and as long as the hardware (CPU) is the same you
should be good.
Even targeting a different hardware platform might be easier inside a VM.

Inside the VM you can save temp files and capture compiler, assembler and
linker settings to
Chip away at it all. ABI, API, Libraries, magic numbers.. paths.
https://www.freebsd.org/doc/handbook/linuxemu-advanced.html
ABI and API updates are difficult.
https://www.cyberciti.biz/open-source/freebsd-12-released-here-is-how-to-upgrade-freebsd/

Look with care (including with a debugger) to see what FreeBSD thinks the
new binary is.
Simple things like CR/LF can confuse things.

I see in a FreeBSD (11.2)  to newer FreeBSD (12.0) version update notes.

Installed packages to be REINSTALLED:
        sudo-1.8.25p1 (ABI changed: 'freebsd:11:x86:64' -> 'freebsd:12:x86:64')
        sqlite3-3.25.1 (ABI changed: 'freebsd:11:x86:64' -> 'freebsd:12:x86:64')
        readline-7.0.3_1 (ABI changed: 'freebsd:11:x86:64' -> 
'freebsd:12:x86:64')


Strip nothing,
Minimum optimizations.



On Tue, Jun 11, 2019 at 6:07 PM B Carr <buc...@gmail.com> wrote:

> Newb here. I'm in over my head. Using a Win10/amd64 PowerShell with Go
> v1.12.6. Trying to cross-compile
> to FreeBSD/amd64. go env = GOARCH=amd64 & GOOS=freebsd. Source includes
> calls to SQLite3. Compiles
> without errors.
>
> Resulting binary fails on FreeBSD with: "Can't connect to the SQLite DB
> Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work."
>
> Added CGO_ENABLED=1 to the go env.  Recompile fails to build a binary and
> yields this error stream:
>
> "# runtime/cgo
> _cgo_export.c:1:0: error: -fPIC ignored for target (all code is position
> independent) [-Werror]
>  /* Code generated by cmd/cgo; DO NOT EDIT. */
>  ^
> cc1.exe: all warnings being treated as errors"
>
> I have no idea what that means.
>
> Same source compiled for the Win10 machine runs perfectly. If I copy the
> source code over to a
> FreeBSD box with Go installed there and compile, it works fine. It is the
> cross-compilation that
> doesn't seem to work.
>
> This isn't a Go problem, it is something I'm not understanding about
> cross-compiling
>
> Any thoughts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/ebe9fe0d-7727-40b9-bc53-a9d237faecf7%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/ebe9fe0d-7727-40b9-bc53-a9d237faecf7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
   T o m    M i t c h e l l

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAAMy4URXSgtj55VTNcRUagX4PAx4s30uT5coxuoJpFBS9t9FKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to