2017-05-02 1 views
1

J'essaye de compiler statiquement mon projet C++ sur Redhat 7.3.Compiler le projet C++ de manière statique sur redhat

Ceci est mon script:

g++ -static -ldl -std=c++0x -O3 -fopenmp *.cpp -o main 

Mais j'obtenir cette erreur: /usr/bin/ld: cannot find -ldl

Comment puis-je résoudre ce problème? Je pense qu'une bibliothèque manque.

+0

Redhat quoi? Il y a eu beaucoup de versions. Être précis. –

+0

@BoundaryImposition J'utilise Redhat 7.3 – Teo

Répondre

2

-ldl signifie /usr/lib/libdl.so (fourni par glibc-devel)

le -static -ldl signifie /usr/lib/libdl.a (fourni par glibc-static)

yum install glibc-devel glibc-static 
+0

Ok, je l'ai fait. Mais maintenant j'obtiens/usr/bin/ld: ne peux pas trouver -lstdC++ pourquoi? – Teo

+0

maintenant vous devez 'yum intall libstdC++ libstdC++ - static' – Rama