Skip to content

why cosmocc: fatal error: -march=native can't be used when building fat binaries #1374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
liudonghua123 opened this issue Feb 27, 2025 · 0 comments

Comments

@liudonghua123
Copy link

I just want to compile a portable binary which runable on linux, windows and macos. I download the toolchain and use CC=/root/code/cosmocc/bin/cosmocc make to compile it on linux.

But it failed with the following errors.

[root@ha-master-1 gguf-tools]# CC=/root/code/cosmocc/bin/cosmocc make 
/root/code/cosmocc/bin/cosmocc gguf-tools.c gguflib.c sds.c fp16.c \
	-march=native -ffast-math \
	-g -ggdb -Wall -W -pedantic -O3 -o gguf-tools
cosmocc: fatal error: -march=native can't be used when building fat binaries
compilation terminated.
make: *** [Makefile:4: gguf-tools] Error 1
[root@ha-master-1 gguf-tools]#

I have to use x86_64-unknown-cosmo-cc instead of cosmocc.

[root@ha-master-1 gguf-tools]# CC=/root/code/cosmocc/bin/x86_64-unknown-cosmo-cc make
/root/code/cosmocc/bin/x86_64-unknown-cosmo-cc gguf-tools.c gguflib.c sds.c fp16.c \
	-march=native -ffast-math \
	-g -ggdb -Wall -W -pedantic -O3 -o gguf-tools
In function 'sdsll2str',
    inlined from 'sdsfromlonglong' at sds.c:516:15:
sds.c:473:12: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  473 |         *s = *p;
      |         ~~~^~~~
......
[root@ha-master-1 gguf-tools]# /root/code/cosmocc/bin/x86_64-linux-cosmo-objcopy -SO binary gguf-tools gguf-tools.com
[root@ha-master-1 gguf-tools]# file gguf-tools gguf-tools.com
gguf-tools:     ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, with debug_info, not stripped
gguf-tools.com: DOS/MBR boot sector; partition 1 : ID=0x7f, active, start-CHS (0x0,0,1), end-CHS (0x3ff,255,63), startsector 0, 4294967295 sectors
[root@ha-master-1 gguf-tools]# ./gguf-tools.com -h
Usage: ./gguf-tools.com <subcommand> [arguments...] [options...]
Subcommands:
  show <filename> -- show GGUF model keys and tensors.
  inspect-tensor <filename> <tensor-name> [count] -- show tensor weights.
  compare <file1> <file2> -- avg weights diff for matching tensor names.
  split-mixtral <ids...> mixtral.gguf out.gguf -- extract expert.
Options:
  --verbose       :With 'show', print full arrays (e.g. token lists)
  --diffable      :Don't show tensor file offsets and sizes
Example:
  split-mixtral 65230776370407150546470161412165 mixtral.gguf out.gguf
[root@ha-master-1 gguf-tools]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant