Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

3 votes
1 answers
5075 views
Apache + mod_ssl build not linking to my OpenSSL build
I have spent some time searching online but none of what I found seems to help. I'm running CentOS 6 64bit and would like to compile Apache with mod_ssl and need to link it to my own OpenSSL build (which is newer than the OS provided version). OpenSSL 1.1.0i is configured with: ./config --prefix=/op...
I have spent some time searching online but none of what I found seems to help. I'm running CentOS 6 64bit and would like to compile Apache with mod_ssl and need to link it to my own OpenSSL build (which is newer than the OS provided version). OpenSSL 1.1.0i is configured with: ./config --prefix=/opt/openssl-1.1.0 --openssldir=/opt/openssl-1.1.0 shared Apache 2.4 is configured with: ./configure --enable-layout=mycustomlayout \ --prefix=/opt/httpd-2.4.34 \ --exec-prefix=/opt/httpd-2.4.34 \ --with-mpm=prefork \ --enable-so \ --enable-ssl \ --with-ssl=/opt/openssl-1.1.0 \ --enable-cgi \ --enable-http2 \ --enable-proxy-http2 \ --with-included-apr It appears to compile just fine but mod_ssl isn't aware of where OpenSSL 1.1.0 is installed: [root@host .libs]# ldd ./mod_ssl.so | grep -iP 'ssl|crypto' libssl.so.1.1 => not found libcrypto.so.1.1 => not found And so only works when you explicitly tell it where to look: [root@host .libs]# export LD_LIBRARY_PATH=/opt/openssl-1.1.0/lib:$LD_LIBRARY_PATH [root@host .libs]# ldd ./mod_ssl.so | grep -iP 'ssl|crypto' libssl.so.1.1 => /opt/openssl-1.1.0/lib/libssl.so.1.1 (0x00007f069149a000) libcrypto.so.1.1 => /opt/openssl-1.1.0/lib/libcrypto.so.1.1 (0x00007f069100a000) Even building mod_ssl statically into httpd binary with --enable-mods-static=ssl doesn't help. I tried --enable-ssl, --enable-ssl --enable-ssl-staticlib-deps, and --enable-ssl --enable-ssl-staticlib-deps --enable-mods-static=ssl and still the same result: libssl.so.1.1 => not found libcrypto.so.1.1 => not found Also tried, without luck, setting these variables before ./configure: export PKG_CONFIG_PATH=/opt/openssl-1.1.0/lib/pkgconfig:$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=/opt/openssl-1.1.0/lib:$LD_LIBRARY_PATH \ LDFLAGS="-L/opt/openssl-1.1.0/lib" I know I can just add to /etc/ld.so.conf.d to autoload the new OpenSSL library or adjust Apache's init script to add to LD_LIBRARY_PATH but I'd much prefer to have it working properly, have the program where to look for libssl.so / libcrypto.so, just like my PHP build: [root@host php]# export PKG_CONFIG_PATH=/opt/openssl-1.1.0/lib/pkgconfig:$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=/opt/openssl-1.1.0/lib:$LD_LIBRARY_PATH \ LDFLAGS="-L/opt/openssl-1.1.0/lib" \ PHP_PREFIX=/opt/php-7.2.9 \ EXTENSION_DIR=$PHP_PREFIX/usr/lib64/php/modules [root@host php]# ./configure […] \ --with-imap=shared \ --with-imap-ssl \ --with-openssl=shared \ --with-openssl-dir=/opt/openssl-1.1.0/bin [root@host php]# make [root@host php]# unset PKG_CONFIG_PATH LD_LIBRARY_PATH LDFLAGS [root@host modules]# ldd ./openssl.so | grep -iP 'ssl|crypto' libssl.so.1.1 => /opt/openssl-1.1.0/lib/libssl.so.1.1 (0x00007fc2220a6000) libcrypto.so.1.1 => /opt/openssl-1.1.0/lib/libcrypto.so.1.1 (0x00007fc221c17000) What am I doing wrong? Could this be a bug?
E-71 (53 rep)
Aug 29, 2018, 03:30 AM • Last activity: Jul 15, 2025, 12:05 PM
0 votes
1 answers
2779 views
Error linking svm_python: undefined reference to "exp@@GLIBC_2.2.5"
I've been trying to use the SVM-python implementation provided at tfinley.net. When I use the command make on the extracted directory, I get the following errors: /usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libm.so.6: error adding symbo...
I've been trying to use the SVM-python implementation provided at tfinley.net. When I use the command make on the extracted directory, I get the following errors: /usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:92: recipe for target 'svm_python_learn_hideo' failed make: *** [svm_python_learn_hideo] Error 1 This is the implementation I am trying to use.
AdveRSAry (101 rep)
Oct 13, 2016, 04:35 PM • Last activity: Jun 17, 2025, 08:07 AM
0 votes
1 answers
8611 views
Public static IP only for a Vagrantfile
I modified the [Vagrantfile for taiga-vagrant][1] based on [VAGRANT DOCS/Public Networks][2] as follows: # -*- mode: ruby -*- # vi: set ft=ruby : require "./source.rb" ROOT_PATH = File.dirname(__FILE__) VAGRANTFILE_API_VERSION = "2" def configure_extra(config) end def configure(config) config.vm.box...
I modified the Vagrantfile for taiga-vagrant based on VAGRANT DOCS/Public Networks as follows: # -*- mode: ruby -*- # vi: set ft=ruby : require "./source.rb" ROOT_PATH = File.dirname(__FILE__) VAGRANTFILE_API_VERSION = "2" def configure_extra(config) end def configure(config) config.vm.box = "trusty64" config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box " # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # vagrant box outdated. This is not recommended. # config.vm.box_check_update = false # Host name config.vm.hostname = "taiga" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. config.vm.network :forwarded_port, host: 8000, guest: 8000 config.vm.network :forwarded_port, host: 9001, guest: 9001 # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. config.vm.network "public_network", autoconfig: false config.vm.provision "fix-no-tty", type: "shell" do |s| s.privileged = false s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile" end # manual ip config.vm.provision "shell", run: "always", inline: "ifconfig eth1 xxx.yyy.zzz.153 netmask 255.255.255.0 up" # manual ipv6 config.vm.provision "shell", run: "always", inline: "ifconfig eth1 inet6 add fc00::17/7" # default router config.vm.provision "shell", run: "always", inline: "route add default gw xxx.yyy.zzz.132" # default router ipv6 config.vm.provision "shell", run: "always", inline: "route -A inet6 add default gw fc00::1 eth1" # delete default gw on eth0 config.vm.provision "shell", run: "always", inline: "eval route -n | awk '{ if ($8 ==\"eth0\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'" # If true, then any SSH connections made will enable agent forwarding. # Default value: false config.ssh.forward_agent = true # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. config.vm.synced_folder "./data", "/home/vagrant/data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. config.vm.provider "virtualbox" do |vb| # Boot with headless mode vb.gui = false host = RbConfig::CONFIG['host_os'] # Giving a quarter of system memory to VM and access to all available cpu cores if host =~ /darwin/ cpus = sysctl -n hw.ncpu.to_i # sysctl returns Bytes, converting to MB... mem = sysctl -n hw.memsize.to_i / 1024 / 1024 / 4 elsif host =~ /linux/ cpus = nproc.to_i # meminfo returns KB, converting to MB... mem = grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'.to_i / 1024 / 4 else # hardcoding values for windows... cpus = 2 mem = 2048 end vb.customize ["modifyvm", :id, "--memory", mem] vb.customize ["modifyvm", :id, "--cpus", cpus] end # Provisioning config.vm.provision "shell" do |shell| vagrant_shell_scripts_configure( shell, File.join(ROOT_PATH, "scripts"), "provision.sh", {} ) end end # Look for a Vagrantfile.local to load local_vagrantfile = "#{__FILE__}.local" if File.exists?(local_vagrantfile) eval File.read(local_vagrantfile) end Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| configure config configure_extra config end After vagrant up, I am asked for *"Which interface should the network bridge to?"*. After selecting *1 (for eth0)*, the VirtualBox virtual machine launches just fine and I can connect via ssh. The networking interface(s) settings of this VM are: eth0 Link encap:Ethernet HWaddr 08:00:27:70:2a:9d inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe70:2a9d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1462 errors:0 dropped:0 overruns:0 frame:0 TX packets:968 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:151879 (151.8 KB) TX bytes:122611 (122.6 KB) eth1 Link encap:Ethernet HWaddr 08:00:27:2e:e8:7f inet addr:xxx.yyy.zzz.153 Bcast:xxx.yyy.zzz.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe2e:e87f/64 Scope:Link inet6 addr: fc00::17/7 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1335 errors:0 dropped:0 overruns:0 frame:0 TX packets:683 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1078620 (1.0 MB) TX bytes:85690 (85.6 KB) *Small Update* While launching, there are several messages of default: Warning: Connection timeout. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... ... Finally, though, the machine starts. I can access taiga just fine from the outer internet. But, **is it necessary to have both of these interfaces?** **Can I not have the static public IP for eth0 only?**
Nikos Alexandris (1470 rep)
Dec 9, 2015, 06:16 PM • Last activity: Apr 9, 2025, 07:03 PM
1 votes
1 answers
75 views
How do I build a statically linked copy of xz-utils?
I'm trying to build a statically linked copy of xz-utils, such that the `xz` do not have dependencies on libc. I tried the usual way, which is to set LDFLAGS=-static, and works for most other packages out there. In the case of xz-utils, however, the binary is built successfully but it is statically...
I'm trying to build a statically linked copy of xz-utils, such that the xz do not have dependencies on libc. I tried the usual way, which is to set LDFLAGS=-static, and works for most other packages out there. In the case of xz-utils, however, the binary is built successfully but it is statically linked, as can be seen here.
$ docker run --rm -it -v $PWD/downloads:/downloads --platform linux/amd64 alpine:3
/ # cd ~
~ # apk add build-base clang
...
~ # tar -xf /downloads/xz-5.8.1.tar.gz 
~ # PREFIX=/opt/xz-5.8.1
~ # cd xz-5.8.1/
~ # export CC=clang 
~ # export LDFLAGS=-static
~/xz-5.8.1 # LDFLAGS=-static CC=clang ./configure --prefix=$PREFIX --disable-nls --disable-doc --disable-microlzma
[See https://pastebin.com/Cj6ZX9sC] 
~/xz-5.8.1 # make -j4
[See https://pastebin.com/79wmN4zS] 
~/xz-5.8.1 # make install
[See https://pastebin.com/iCpCG3hQ] 
~/xz-5.8.1 # ldd /opt/xz-5.8.1/bin/xz
        /lib/ld-musl-x86_64.so.1 (0x7fe94c28b000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fe94c28b000)
How do I solve this?
rs3 (11 rep)
Apr 6, 2025, 02:32 PM • Last activity: Apr 6, 2025, 04:18 PM
1 votes
0 answers
43 views
What is the difference between the ELF Visibility Values STV_INTERNAL and STV_HIDDEN?
I was trying to understand Visibility values in ELF file , and I couldn't Understand the difference between `STV_HIDDEN` and `STV_INTERNAL` . After some reseach I found that this may be related to how symbols are exported in symbol table , am not sure whether that is correct or not but if some one e...
I was trying to understand Visibility values in ELF file , and I couldn't Understand the difference between STV_HIDDEN and STV_INTERNAL . After some reseach I found that this may be related to how symbols are exported in symbol table , am not sure whether that is correct or not but if some one explain the story behind the difference it will be helpful for me . Possible Duplicate : https://unix.stackexchange.com/questions/472660/what-are-difference-between-the-elf-symbol-visibility-levels But from the answer there I still couldn't get the difference , perhaps more explaination may help me . Thanks
AbdAllah Talaat (197 rep)
Feb 4, 2025, 06:17 PM
0 votes
1 answers
81 views
Compiling old packages with outdated libraries for modern distros for preservation and archival purposes
I want to compile old (2005-2012) commits of an app, the app in question uses outdated libraries that no longer exist in modern distros, for example Qt3/Qt4 and ancient OpenSSL. I was successfully able to compile the app under Ubuntu 6.06 and 8.04, but due to missing libraries it would obviously not...
I want to compile old (2005-2012) commits of an app, the app in question uses outdated libraries that no longer exist in modern distros, for example Qt3/Qt4 and ancient OpenSSL. I was successfully able to compile the app under Ubuntu 6.06 and 8.04, but due to missing libraries it would obviously not run on modern distros. My first thought was to compile the binaries statically, but I failed since I would need to statically rebuild the libraries too. I want to compile the app for preservation and archival purposes, and I want it to run out of the box on modern distros, shipping it in something like AppImage maybe? Is statically compiling the dependencies the best way? Or is there a better way?
user18686221 (21 rep)
Oct 28, 2024, 03:25 PM • Last activity: Oct 28, 2024, 06:25 PM
1 votes
0 answers
56 views
Process is not running in real-time priority
I have a Fortran based application that is running fine and it provides the correct results when I run it normally (i.e ./myapp); however, when I tried to run it with real-time priority it gives the following error: > linux@AnasPC:~/myapp/build$ sudo chrt -r 99 ./myapp > [sudo] password for emtplinu...
I have a Fortran based application that is running fine and it provides the correct results when I run it normally (i.e ./myapp); however, when I tried to run it with real-time priority it gives the following error: > linux@AnasPC:~/myapp/build$ sudo chrt -r 99 ./myapp
> [sudo] password for emtplinux:
./myapp: error while loading shared libraries: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory I can see that this library is installed as part of Intel OneApi, this is confirmed when I run: >sudo find / -name libmkl_intel_lp64.so.2 I tried adding the path to the library in the running cmd using the following but that didn't solve the issue: > sudo LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/2024.0/lib/libmkl_intel_lp64.so.2 chrt -r 99 ./myapp Please note that I already run the ../../opt/intel/oneapi/setvars.sh to set the env variables. Anyone has any idea what is wrong?
Anas (111 rep)
Sep 5, 2024, 04:57 PM
1 votes
0 answers
97 views
Why does ldd behave differently on the ldconfig binary?
When we run `ldd` on some file, there are two possible results: If the file is dynamic executable, the shared dependencies are shown, for example: ``` # ldd /usr/bin/sleep linux-vdso.so.1 (0x00007ffff7fc7000) libc.so.6 => /usr/lib/libc.so.6 (0x00007ffff7dd6000) /lib64/ld-linux-x86-64.so.2 (0x00007ff...
When we run ldd on some file, there are two possible results: If the file is dynamic executable, the shared dependencies are shown, for example:
# ldd /usr/bin/sleep
        linux-vdso.so.1 (0x00007ffff7fc7000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007ffff7dd6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fc9000)
Or, if the file is either a static executable or not an executable at all, we see not a dynamic executable, for example
# ldd /usr/bin/toybox
        not a dynamic executable
# ldd /etc/shadow
warning: you do not have execution permission...
        not a dynamic executable
But I have also discovered a special case! It takes place if you ever happen to invoke ldd on /usr/sbin/ldconfig. Then, ldd will **explicitly** say that the binary is statically linked!
# ldd /usr/sbin/ldconfig
        statically linked
I'm very interested to know why this happens, what's so special about the ldconfig binary? Thanks.
melonfsck - she her (150 rep)
Aug 26, 2024, 05:52 PM
2 votes
1 answers
1136 views
How to write a file PkgConfig.pc file that supports both static and shared linking
I am writing a little library as a self challenge. I plan to target Linux based systems. I want to add a `libname.pc` file so as to add support for `PkgConfig`. Here, is my current file: ``` prefix=/usr/local exec_prefix=${prefix} cphoton_directory=cphoton-0.0 include_directory=${prefix}/include/${c...
I am writing a little library as a self challenge. I plan to target Linux based systems. I want to add a libname.pc file so as to add support for PkgConfig. Here, is my current file:
prefix=/usr/local
exec_prefix=${prefix}
cphoton_directory=cphoton-0.0
include_directory=${prefix}/include/${cphoton_directory}
library_directory=${exec_prefix}/lib

Name: cphoton-0.0
Description: CPhoton is a basic utility library.
Version: 0.0.0
URL: https://gitlab.com/invitron/cphoton 
Cflags: -I${include_directory}
Libs: -L${library_directory} -lcphoton-0.0
Libs.private:
I wanted to know if this is compatible for both static and dynamic libs. I tried to use pkg-config with --static flag but, it seems to give precedence to .so lib. I also tested it with cmake. It links statically only if the dynamic lib is not available. Is it possible or will I have to provide a separate .pc file for static version? Already visited: - https://stackoverflow.com/questions/27586503/how-to-use-pkg-config-to-link-a-library-statically - https://people.freedesktop.org/~dbn/pkg-config-guide.html
Mansoor Ahmed Memon (138 rep)
Dec 5, 2020, 04:46 PM • Last activity: Jun 9, 2024, 08:09 PM
0 votes
1 answers
938 views
Build statically linked binary on gentoo
I'm looking for a way to build a fully statically linked binary on Gentoo. The build system is Meson. I tries `--prefer-static` and `--default_library=static` with no success. A possible obstacle is that some libraries (e.g. `libevent` and `glib`) don't have the static versions installed (unlike `li...
I'm looking for a way to build a fully statically linked binary on Gentoo. The build system is Meson. I tries --prefer-static and --default_library=static with no success. A possible obstacle is that some libraries (e.g. libevent and glib) don't have the static versions installed (unlike libc and a few other libraries). Should I rerun emerge with some special flags?
grep (131 rep)
Jul 28, 2023, 02:45 PM • Last activity: Dec 8, 2023, 01:25 AM
-3 votes
1 answers
737 views
Why is my static IP address not set to what I made it in the /etc/sysconfig/network-scripts/ifcfg-enp0s3 file?
I have made the following changes to /network-scripts/ifcfg-enp0s3 file in order to try and get a static IP address (added ip i want ending in .49, added gateway, Prefix and Subnet mask ( [![enter image description here][1]][1] [1]: https://i.sstatic.net/Qamcp.png image of file included) But i get t...
I have made the following changes to /network-scripts/ifcfg-enp0s3 file in order to try and get a static IP address (added ip i want ending in .49, added gateway, Prefix and Subnet mask ( enter image description here But i get this error message when I attempt to restart network (image of error included) enter image description here When I check Jornalctl -xe I get this (image included)enter image description here *Possible solution i found: “If you are using NetworkManager there will be more items that you would need to configure like: GATEWAY, DOMAIN, DNS1, DNS2, etc. If you are not using NetworkManager, you will need to configure the gateway address in the /etc/sysconfig/network file, and the DNS resolvers (if required) in the /etc/resolv.conf file I added DNS="8/8/8/8".” **But I do not know how to configure DNS, Domain etc.***
jspaine (21 rep)
Mar 3, 2023, 09:37 PM • Last activity: Mar 13, 2023, 09:57 AM
1 votes
1 answers
694 views
Qt statically linked application error: linuxfb plugin not found by the application
I have successfully developed a graphical Qt 5.15.2 application using Qt Creator with dynamically linked libraries. For various reasons I have determined static linking would be better for my application. I attempted to switch my development environment to use static libraries instead of dynamic. My...
I have successfully developed a graphical Qt 5.15.2 application using Qt Creator with dynamically linked libraries. For various reasons I have determined static linking would be better for my application. I attempted to switch my development environment to use static libraries instead of dynamic. My application built with no errors, but when I deployed my application to a development board (a BeagleBone Black running Debian 11.5), I got the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "linuxfb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
I passed in a -platform linuxfb command line argument, I built my own static Qt libraries, I added CONFIG += static to my .pro file, and I am using the static libraries in Qt Creator. Is there something special I need to do to get the linuxfb library/plugin to link? Any insight into how I can resolve this would be greatly appreciated.
amyers (61 rep)
Nov 11, 2022, 03:38 PM • Last activity: Nov 14, 2022, 01:32 PM
0 votes
1 answers
1058 views
why static libraries use relocatable object files while share libraries use source file?
I was reading a textbook which describes static libraries anad shared libraries. There are two source files, `addvec.c` and `multvec.c`, to create a static library of them, we would use the ar tool as follows: ``` linux> gcc -c addvec.c multvec.c linux> ar rcs libvector.a addvec.o multvec.o ``` so b...
I was reading a textbook which describes static libraries anad shared libraries. There are two source files, addvec.c and multvec.c, to create a static library of them, we would use the ar tool as follows:
linux> gcc -c addvec.c multvec.c
linux> ar rcs libvector.a addvec.o multvec.o
so basically it just create relocatable object files (.o) first then use the ar tool with those .o files. But if we want to build a shared library libvector.so then the command in the book is:
linux> gcc -shared -fpic -o libvector.so addvec.c multvec.c
note that we use source file (.c) as arguments directly, not relocatable object files. So why for share libraries, there is no need to produce relocatable object files and use source files directly, which is inconsistent compared to static linking which uses relocatable object files?
amjad (177 rep)
Sep 2, 2020, 09:03 AM • Last activity: Oct 23, 2022, 09:43 PM
0 votes
2 answers
146 views
Could I make an embedded program faster by statically linking it to the Linux kernel
This is probably a silly question, but is it possible to statically compile a C program along with an init system and the Linux kernel to make an embedded application? If so, is it a good idea?
This is probably a silly question, but is it possible to statically compile a C program along with an init system and the Linux kernel to make an embedded application? If so, is it a good idea?
Samuel Ammonius STUDENT (3 rep)
Oct 14, 2022, 04:29 PM • Last activity: Oct 14, 2022, 08:08 PM
39 votes
3 answers
15659 views
Do C compilers discard unused functions when statically linking to .a file?
Say I have a C program `main.c` that statically links to `libmine.a`. Statically linking to a library causes library functions to be embedded into the main executable at compile time. If `libmine.a` were to feature functions that weren't used by `main.c`, would the compiler (e.g. GCC) discard these...
Say I have a C program main.c that statically links to libmine.a. Statically linking to a library causes library functions to be embedded into the main executable at compile time. If libmine.a were to feature functions that weren't used by main.c, would the compiler (e.g. GCC) discard these functions? This question is inspired by the "common messaging" that using static libraries make executables larger, so I'm curious if the compiler at least strips away unused code from an archive file.
Izzo (1013 rep)
Sep 2, 2022, 12:14 PM • Last activity: Sep 3, 2022, 01:48 PM
0 votes
1 answers
1288 views
apt packages - static vs dynamic libraries
I use Ubuntu 18.04. I install libraries using apt, for example: sudo apt install freeglut3-dev Does apt always install dynamic libraries or I can determine if a package contains static or dynamic library ?
I use Ubuntu 18.04. I install libraries using apt, for example: sudo apt install freeglut3-dev Does apt always install dynamic libraries or I can determine if a package contains static or dynamic library ?
Irbis (239 rep)
Jun 7, 2022, 11:23 AM • Last activity: Jun 7, 2022, 12:22 PM
6 votes
1 answers
4795 views
create an statically linked executable from a dynamically linked executable and its dependencies
Take `cat` as an example, if I do `ldd $(which cat)`, it shows ``` linux-vdso.so.1 (0x00007fff8afbb000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb3102dd000) /lib64/ld-linux-x86-64.so.2 (0x00007fb310524000) ``` Is there any way to bundle the `cat` binary and these three `so` files, so th...
Take cat as an example, if I do ldd $(which cat), it shows
linux-vdso.so.1 (0x00007fff8afbb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb3102dd000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb310524000)
Is there any way to bundle the cat binary and these three so files, so that it become statically linked? My purpose is to use it inside a container.
doraemon (491 rep)
Jan 6, 2022, 05:25 AM • Last activity: Jan 6, 2022, 06:34 AM
2 votes
1 answers
2721 views
How to compile a program statically on NixOS?
I'm trying to compile a simple program into a static executable: ``` $ cat hello.c #include int main() { puts("Hello, world!"); } ``` However, I'm met with the following error: ``` $ gcc -static hello.c -o hello /nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/ld: cannot find -lc coll...
I'm trying to compile a simple program into a static executable:
$ cat hello.c
#include 
int main() {
    puts("Hello, world!");
}
However, I'm met with the following error:
$ gcc -static hello.c -o hello
/nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Maya (408 rep)
Oct 21, 2020, 01:53 PM
0 votes
0 answers
337 views
How to debug a cpp file that's part of a so file in the software?
So I have this software which has multiple .so files. For one of the so file and I made some changes to the code but I want to see the line by line execution of file present in the so file. Just to give a reference while using visual studio we can attach the code to the process that is using the dll...
So I have this software which has multiple .so files. For one of the so file and I made some changes to the code but I want to see the line by line execution of file present in the so file. Just to give a reference while using visual studio we can attach the code to the process that is using the dll file and then once it gets attached we put breakpoints in the file we want to debug and step over to go to the next line. How can I achieve the same on Linux machine? Is there any hack that would help me? I have a software that uses so files and that so files has multiple cpp files as part of its build and I want to debug a file present in that so file.
Himanshuman (321 rep)
Oct 19, 2020, 02:28 PM
3 votes
2 answers
1671 views
Linux static compilation issue
I am building testdisk as static and run > make static it returns the following error > /usr/bin/ld: cannot find -luuid > > collect2: ld returned 1 exit status What's the problem? In the makefile I have the following line > LIBS = -lz -lntfs -luuid -lcrypto > -lext2fs -lcom_err and I am getting erro...
I am building testdisk as static and run > make static it returns the following error > /usr/bin/ld: cannot find -luuid > > collect2: ld returned 1 exit status What's the problem? In the makefile I have the following line > LIBS = -lz -lntfs -luuid -lcrypto > -lext2fs -lcom_err and I am getting error on all the floowing flags > -luuid -lcrypto -lext2fs -lcom_err
MA1 (137 rep)
Sep 7, 2010, 07:28 AM • Last activity: Feb 18, 2020, 02:51 AM
Showing page 1 of 20 total questions