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

Build error on Arch Linux when Clang is present #237

Closed
andychu opened this issue Feb 19, 2019 · 9 comments
Closed

Build error on Arch Linux when Clang is present #237

andychu opened this issue Feb 19, 2019 · 9 comments

Comments

@andychu
Copy link
Contributor

andychu commented Feb 19, 2019

Due to dsymutil being used, which is meant for OS X only

https://lobste.rs/s/y8noui/osh_0_6_pre15_does_not_crave_chaos#c_wouaea

real	1m17,246s
user	1m12,306s
sys	0m4,116s
~/.local/tmp/oil-0.6.pre15
strip -o _build/oil/ovm-opt.stripped -S _build/oil/ovm-opt
dsymutil _build/oil/ovm-opt.stripped -o _build/oil/_build/oil/ovm-opt.stripped.dSYM
Stack dump:
0.	Program arguments: dsymutil _build/oil/ovm-opt.stripped -o _build/oil/_build/oil/ovm-opt.stripped.dSYM
LLVMSymbolizer: error reading file: No such file or directory
#0 0x00007fdab2905b4b llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/bin/../lib/libLLVM-7.so+0x900b4b)
#1 0x00007fdab2903fa4 llvm::sys::RunSignalHandlers() (/usr/bin/../lib/libLLVM-7.so+0x8fefa4)
#2 0x00007fdab290412e (/usr/bin/../lib/libLLVM-7.so+0x8ff12e)
#3 0x00007fdab1ce9e00 __restore_rt (/usr/bin/../lib/libc.so.6+0x37e00)
#4 0x0000556bb3b423dd (dsymutil+0x113dd)
#5 0x00007fdab1cd6223 __libc_start_main (/usr/bin/../lib/libc.so.6+0x24223)
#6 0x0000556bb3b449ae (dsymutil+0x139ae)
make: *** [Makefile:142: _build/oil/ovm-opt.stripped] Segmentation fault (core dumped)
make: *** Deleting file '_build/oil/ovm-opt.stripped'
@kseistrup
Copy link

PS: I am the person who posted the segfault on lobste.rs. I haven't been able to compile any of the 0.6-pre series.

ArchLinux uses gcc per default, but I have both gcc and clang installed. I have no idea whether it was gcc or clang that produced the segfault above.

@andychu
Copy link
Contributor Author

andychu commented Feb 19, 2019

Great thanks, it looks like the problem is the feature detection of dsymutil. I think we need feature detection for objcopy first?

Can you run

command -v objcopy; echo $? on your machine?

I think the issue is that my build first builds unstripped binaries so we have symbols, and then strips them. Most people build stripped binaries in the first place, which is more portable.

There's apparently no portable way to do the former. It depends on whether you're using Clang or GCC.

@andychu andychu changed the title Build error on Arch Linux Build error on Arch Linux when Clang is present Feb 19, 2019
@kseistrup
Copy link

$ command -v objcopy; echo $?
/usr/bin/objcopy
0

and

$ pajig owns /usr/bin/objcopy
/usr/bin/objcopy is owned by binutils 2.31.1-4

$ gcc --version
gcc (GCC) 8.2.1 20181127
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang --version
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@kseistrup
Copy link

I just tried explicitly with CC=gcc and CC=clang before doing the configure+make, and confirmed that gcc and clang were actually used: Both ended with a segfault.

andychu pushed a commit that referenced this issue Feb 20, 2019
We need objcopy to put symbols for the OPTIMIZED binary in a separate
file, and then add a "debuglink" field in the ELF.

If we don't have objcopy, e.g. with Clang on OS X, we just strip it and
lose the symbols.  It doesn't appear to have the "debuglink"
functionality?

Should fix issue #237.
@andychu
Copy link
Contributor Author

andychu commented Feb 20, 2019

Cool, can you try this temporary tarball and see if it works?

https://www.oilshell.org/share/oil-0.6.temp16.tar.gz

I changed the Makefile to only rely on objcopy if it's there.

@kseistrup
Copy link

With temp16 the build process runs successfully and produces a working binary.

@andychu
Copy link
Contributor Author

andychu commented Feb 20, 2019

Great, thanks for trying it! That was a definite improvement to the Makefile.

@andychu
Copy link
Contributor Author

andychu commented Mar 3, 2019

This is out now with 0.6.pre16:

http://www.oilshell.org/release/0.6.pre16/

Announcement forthcoming:

@hv15
Copy link

hv15 commented Mar 4, 2019

can confirm that it compiles and runs fine, thanks @andychu!

@andychu andychu closed this as completed Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants