Teo
Teo

Reputation: 3213

Compile C++ project statically on redhat

I'm trying to compile statically my C++ project on Redhat 7.3.

This is my script:

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

But I obtain this error: /usr/bin/ld: cannot find -ldl

How can I fix it? I think a library misses.

Upvotes: 1

Views: 81

Answers (1)

Rama
Rama

Reputation: 3305

-ldl means /usr/lib/libdl.so ( Provided by glibc-devel )

the -static -ldl means /usr/lib/libdl.a ( Provided by glibc-static )

yum install glibc-devel glibc-static

Upvotes: 2

Related Questions