Skip to content
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

mips64el-linux-musl #3

Closed
andrewrk opened this issue Mar 28, 2020 · 3 comments · Fixed by #185
Closed

mips64el-linux-musl #3

andrewrk opened this issue Mar 28, 2020 · 3 comments · Fixed by #185

Comments

@andrewrk
Copy link
Member

[  8%] Linking CXX shared module ../../LLVMHello.so
warning: unsupported linker arg: -O3
warning: unsupported linker arg: --gc-sections
warning: unsupported linker arg: --version-script
warning: unsupported linker arg: /home/andy/dev/bootstrap-zig/out/build-llvm-mips64el-linux-musl/lib/Transforms/Hello/LLVMHello.exports
warning: unsupported linker arg: -z
warning: unsupported linker arg: nodelete
lld: error: can't create dynamic relocation R_MIPS_64 against symbol: DW.ref.__gxx_personality_v0 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /home/andy/.cache/zig/stage1/o/uaPpjWXXLVoQKEib-ER81h5jQb-cdtJxGrifvrRbSFJoyWDeOxO78ob0GfF_F8Pv/libc++.a(/home/andy/.cache/zig/stage1/o/_-0XcBUeTnuXpdMG0KAoTyXYgRxrDkE-C_cNC6OTx3RxxbOBFeYN_V0UIQy3BdOq/new.o)
>>> referenced by new.cpp
>>>               /home/andy/.cache/zig/stage1/o/_-0XcBUeTnuXpdMG0KAoTyXYgRxrDkE-C_cNC6OTx3RxxbOBFeYN_V0UIQy3BdOq/new.o:(.eh_frame+0x3AA3) in archive /home/andy/.cache/zig/stage1/o/uaPpjWXXLVoQKEib-ER81h5jQb-cdtJxGrifvrRbSFJoyWDeOxO78ob0GfF_F8Pv/libc++.a
@andrewrk
Copy link
Member Author

andrewrk commented Apr 3, 2020

This looks like the 64-bit version of ziglang/zig#4925

@LinuxUserGD
Copy link
Contributor

CMake output is currently different with x86_64-gentoo-linux-musl as host:

-- Found ccache /usr/bin/ccache
-- Configuring zig version 0.10.0-dev.2931+bdf3fa12f
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/zig-bootstrap/out/build-zig-host
[  1%] Built target opt_c_util
[ 82%] Built target embedded_softfloat
[ 86%] Built target zigcpp
[ 98%] Built target zigstage1
[ 99%] Built target zig0
[100%] Built target zig
Install the project...
-- Install configuration: "Release"
-- Installing: /home/user/zig-bootstrap/out/host/bin/zig
-- Set runtime path of "/home/user/zig-bootstrap/out/host/bin/zig" to ""
-- Installing: /home/user/zig-bootstrap/out/host/lib
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is Clang 14.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/user/zig-bootstrap/out/host/bin/zig
-- Check for working C compiler: /home/user/zig-bootstrap/out/host/bin/zig - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/home/user/zig-bootstrap/out/host/bin/zig"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2da91/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_2da91.dir/build.make CMakeFiles/cmTC_2da91.dir/build
    gmake[1]: Entering directory '/home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_2da91.dir/testCCompiler.c.o
    /home/user/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target mips64el-linux-musl -mcpu=baseline    -MD -MT CMakeFiles/cmTC_2da91.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_2da91.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_2da91.dir/testCCompiler.c.o -c /home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_2da91
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2da91.dir/link.txt --verbose=1
    /home/user/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target mips64el-linux-musl -mcpu=baseline -rdynamic CMakeFiles/cmTC_2da91.dir/testCCompiler.c.o -o cmTC_2da91
    /home/user/zig-bootstrap/out/host/lib/zig/std/os/linux.zig:50:34: error: container 'arch_bits' has no member called 'syscall3'
    pub const syscall3 = syscall_bits.syscall3;
                                     ^
    gmake[1]: *** [CMakeFiles/cmTC_2da91.dir/build.make:100: cmTC_2da91] Error 1
    gmake[1]: Leaving directory '/home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:127: cmTC_2da91/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:4 (project)


-- Configuring incomplete, errors occurred!
See also "/home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeOutput.log".
See also "/home/user/zig-bootstrap/out/build-zlib-mips64el-linux-musl-baseline/CMakeFiles/CMakeError.log".

@xdqi
Copy link

xdqi commented Aug 9, 2024

Tried with current version on x86_64 Ubuntu 22.04.

It compiles.

Cross-compiled zig can compile *-linux-musl target, but when compiling *-linux-gnu, it fails with Bus Error.

$ uname -a
Linux loongson 4.19.0-12-loongson-3 #1 SMP Sat Jun 19 03:09:24 UTC 2021 mips64 GNU/Linux
$ file ~/zig-mips64el-linux-musl-baseline/zig
/home/xd/zig-mips64el-linux-musl-baseline/zig: ELF 64-bit LSB executable, MIPS, MIPS64 version 1 (SYSV), statically linked, stripped
$ gdb -q --args ~/zig-mips64el-linux-musl-baseline/zig cc --target=mips64el-linux-gnuabi64 -std=gnu89 a.c -v
Reading symbols from /home/xd/zig-mips64el-linux-musl-baseline/zig...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/xd/zig-mips64el-linux-musl-baseline/zig cc --target=mips64el-linux-gnuabi64 -std=gnu89 a.c -v
[New LWP 4311]
[New LWP 4312]
[New LWP 4313]
[New LWP 4314]
[New LWP 4315]
[Detaching after fork from child process 4316]

Thread 1 "zig" received signal SIGBUS, Bus error.
clang version 18.1.7 (https://github.com/ziglang/zig-bootstrap.git e3fe3904af3801454499e3a54c8f8a8c444d3a12)
Target: mips64el-unknown-linux-gnuabi64
Thread model: posix
InstalledDir: /tmp/gdb-mips
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/7
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/7.4.0
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/8
Selected GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/8
Candidate multilib: .;
Selected multilib: .;
 (in-process)
 "/home/xd/zig-mips64el-linux-musl-baseline/zig" -cc1 -triple mips64el-unknown-linux-gnuabi64 -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name a.c -mrelocation-model pic -pic-level 1 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu mips64r2 -target-feature -noabicalls -target-abi n64 -mfloat-abi hard -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -gdwarf32 -fdebug-compilation-dir=/tmp/gdb-mips -v -fcoverage-compilation-dir=/tmp/gdb-mips -nostdsysteminc -nobuiltininc -resource-dir /home/xd/lib/clang/18 -dependency-file /home/xd/.cache/zig/tmp/31d16d21f64f0de3-a.o.d -MT /home/xd/.cache/zig/tmp/31d16d21f64f0de3-a.o -sys-header-deps -MV -isystem /home/xd/zig-mips64el-linux-musl-baseline/lib/include -isystem /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/mips64el-linux-gnuabi64 -isystem /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/generic-glibc -isystem /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/mips-linux-any -isystem /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/any-linux-any -D __GLIBC_MINOR__=28 -D _DEBUG -O0 -std=gnu89 -ferror-limit 19 -fmessage-length=185 -fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound -fsanitize-trap=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -stack-protector 2 -stack-protector-buffer-size 4 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -fno-spell-checking -target-cpu mips64 -target-feature -abs2008 -target-feature -cnmips -target-feature -cnmipsp -target-feature -crc -target-feature -dsp -target-feature -dspr2 -target-feature -dspr3 -target-feature -eva -target-feature +fp64 -target-feature -fpxx -target-feature -ginv -target-feature +gp64 -target-feature -long-calls -target-feature -micromips -target-feature +mips1 -target-feature -mips16 -target-feature +mips2 -target-feature +mips3 -target-feature +mips32 -target-feature -mips32r2 -target-feature -mips32r3 -target-feature -mips32r5 -target-feature -mips32r6 -target-feature +mips3_32 -target-feature +mips3_32r2 -target-feature -mips3d -target-feature +mips4 -target-feature +mips4_32 -target-feature +mips4_32r2 -target-feature +mips5 -target-feature +mips5_32r2 -target-feature +mips64 -target-feature -mips64r2 -target-feature -mips64r3 -target-feature -mips64r5 -target-feature -mips64r6 -target-feature -msa -target-feature -mt -target-feature -nan2008 -target-feature -noabicalls -target-feature -nomadd4 -target-feature -nooddspreg -target-feature -p5600 -target-feature -ptr64 -target-feature -single-float -target-feature -soft-float -target-feature -sym32 -target-feature -use-indirect-jump-hazard -target-feature -use-tcc-in-div -target-feature -vfpu -target-feature -virt -target-feature -xgot -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/xd/.cache/zig/tmp/31d16d21f64f0de3-a.o -x c a.c
clang -cc1 version 18.1.7 based upon LLVM 18.1.7 default target mips64el-linux-musl
#include "..." search starts here:
#include <...> search starts here:
 /home/xd/zig-mips64el-linux-musl-baseline/lib/include
 /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/mips64el-linux-gnuabi64
 /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/generic-glibc
 /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/mips-linux-any
 /home/xd/zig-mips64el-linux-musl-baseline/lib/libc/include/any-linux-any
End of search list.
0x000000000adf7268 in ?? ()
(gdb) bt
#0  0x000000000adf7268 in ?? ()
#1  0x000000000b75dbf8 in ?? ()
#2  0x000000000afedfd8 in ?? ()
#3  0x000000000afb7970 in ?? ()
#4  0x000000000afb8928 in ?? ()
#5  0x000000000ad11fbc in ?? ()
#6  0x000000000acf8890 in ?? ()
warning: GDB can't find the start of the function at 0xbcca487.

    GDB is unable to find the start of the function at 0xbcca487
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
    This problem is most likely caused by an invalid program counter or
stack pointer.
    However, if you think GDB should simply search farther back
from 0xbcca487 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
#7  0x000000000bcca488 in ?? ()

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

Successfully merging a pull request may close this issue.

3 participants