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

[SOLVED] Install Problem with Anaconda: "lib64/crti.o: file not recognized: file format not recognized" #18

Closed
alexkolo opened this issue Oct 3, 2019 · 10 comments
Assignees

Comments

@alexkolo
Copy link

alexkolo commented Oct 3, 2019

Below is the full error message. Any ideas?

FYI, same result when using pip.

$ python setup.py install --user
running install
running bdist_egg
running egg_info
writing pyatomdb.egg-info/PKG-INFO
writing dependency_links to pyatomdb.egg-info/dependency_links.txt
writing requirements to pyatomdb.egg-info/requires.txt
writing top-level names to pyatomdb.egg-info/top_level.txt
reading manifest file 'pyatomdb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyatomdb.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'linear_approx' extension
gcc -pthread -B /anaconda3/envs/science/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I/anaconda3/envs/science/include/python3.6m -c linear_approx.c -o build/temp.linux-x86_64-3.6/linear_approx.o
gcc -pthread -shared -B /anaconda3/envs/science/compiler_compat -L/anaconda3/envs/science/lib -Wl,-rpath=/anaconda3/envs/science/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/linear_approx.o -o build/lib.linux-x86_64-3.6/linear_approx.cpython-36m-x86_64-linux-gnu.so
/anaconda3/envs/science/compiler_compat/ld: /usr/lib64/../lib64/crti.o: unable to initialize decompress status for section .debug_aranges
/anaconda3/envs/science/compiler_compat/ld: /usr/lib64/../lib64/crti.o: unable to initialize decompress status for section .debug_aranges
/anaconda3/envs/science/compiler_compat/ld: /usr/lib64/../lib64/crti.o: unable to initialize decompress status for section .debug_aranges
/anaconda3/envs/science/compiler_compat/ld: /usr/lib64/../lib64/crti.o: unable to initialize decompress status for section .debug_aranges
/usr/lib64/../lib64/crti.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
@jagophile
Copy link
Member

Uh... yikes.

My initial guess (and it's a guess!) is that this is to do with the C compiler. Anaconda is trying to use a combination of the system and it's own gcc in a confused manner, and therefore it can't find some internal libraries it's looking for.

I can't give you a cleaner answer than that as I don't really know - it's an Anaconda gcc issue, not pyatomdb, and it's way beyond my expertise.

One suggestion which might work is manually compiling the c code.

Find the file linear_approx.c and change to its directory
then:
gcc -shared -o linear_approx.so -fPIC linear_approx.c

maybe that'll work?

@alexkolo
Copy link
Author

alexkolo commented Oct 3, 2019

Thanks. I will try this and also look into anaconda gcc issue.

@jagophile
Copy link
Member

I think it's something to do with 32 vs 64 bit compiled libraries, but don't quote me on that

@alexkolo
Copy link
Author

alexkolo commented Oct 3, 2019

so this gcc -shared -o linear_approx.so -fPIC linear_approx.c worked.
import pyatomdb didn't give an error.
I'm currently running pyatomdb.util.initialize() (downloading some files).
I will update here, if I run into any issues.

@alexkolo
Copy link
Author

alexkolo commented Oct 3, 2019

So far, everything works fine. I was able to reproduce the emissivity of XSPEC to high accuracy.

@jagophile
Copy link
Member

Great. I am going to close this, though I know it's not exactly fixed as such.

@alexkolo
Copy link
Author

alexkolo commented Nov 5, 2019

So, I had the same issue stated here when installing a totally different python package, where something needed to be compiled during the installation. Based on this I found a solution, which also works here. One needs to install anacondas most recent compiler before the package installation:

conda install -c anaconda gcc_linux-64

The inspiration came when studying this site:

@alexkolo alexkolo changed the title Install Problem: "lib64/crti.o: file not recognized: file format not recognized" [SOLVED] Install Problem: "lib64/crti.o: file not recognized: file format not recognized" Nov 5, 2019
@alexkolo alexkolo changed the title [SOLVED] Install Problem: "lib64/crti.o: file not recognized: file format not recognized" [SOLVED] Install Problem with Anaconda Compilier: "lib64/crti.o: file not recognized: file format not recognized" Nov 5, 2019
@alexkolo alexkolo changed the title [SOLVED] Install Problem with Anaconda Compilier: "lib64/crti.o: file not recognized: file format not recognized" [SOLVED] Install Problem with Anaconda: "lib64/crti.o: file not recognized: file format not recognized" Nov 5, 2019
@jagophile
Copy link
Member

Thank you! This is great to know for the future.

@awst-baum
Copy link

Since I stumbled over this while searching for the same error in another package:
This seems to be cause by conda using its own ld. It can also be fixed by removing that linker and replacing it with a link to the system linker, see pytorch/pytorch#16683 (comment)

@alexkolo
Copy link
Author

alexkolo commented Dec 3, 2019

Thanks a lot for this comment. This also explains why installing anacondas most recent compiler solved the issue, which is probably also the safer fix in comparison to temporarily renaming conda's own ld as suggested in pytorch/pytorch#16683

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