Displaying 2 results from an estimated 2 matches for "_fopen".
Did you mean:
fopen
2019 Jun 07
2
ld.lld fails with "undefined symbol: _fopen" on macOS, while working as expected on Linux
...86-64.so.2
/usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o test.o
/usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/crtn.o
This works fine on Linux, but when I run the same command on macOS, I get
LLD 8.0.0 (compatible with GNU linkers)
ld.lld: error: undefined symbol: _fopen
>>> referenced by fopen.c
>>> test.o:(main)
I haven't set up --sysroot yet, I just copied all these files from the
Linux machine for now.
This only happens with fopen(). Using puts() or printf() is fine.
LLVM version is 8.0.0.
Thanks!
-------------- next part...
2019 Jun 07
2
ld.lld fails with "undefined symbol: _fopen" on macOS, while working as expected on Linux
...Jun 7, 2019 at 9:34 PM Tim Northover <t.p.northover at gmail.com>
wrote:
> Hi Ivan,
>
> On Fri, 7 Jun 2019 at 11:19, Ivan Medoedov via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > LLD 8.0.0 (compatible with GNU linkers)
> > ld.lld: error: undefined symbol: _fopen
> > >>> referenced by fopen.c
> > >>> test.o:(main)
>
> I suspect you're getting the macOS version of stdio.h, which makes
> fopen some kind of alias. You really should use a sysroot when
> cross-compiling, though you *might* get away with...