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

linker failure with 1.0.0 #117

Closed
darix opened this issue Nov 25, 2020 · 6 comments
Closed

linker failure with 1.0.0 #117

darix opened this issue Nov 25, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@darix
Copy link

darix commented Nov 25, 2020

When trying to build 1.0.0 for openSUSE Tumbleweed:

cd /home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/pgagroal.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g -DNDEBUG -Wformat -Wformat-security -fstack-protector-strong -fPIC -fPIE -O2 -g -DNDEBUG  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -pie -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libpgagroal.so.1 -o libpgagroal.so.1.0.0 CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o CMakeFiles/pgagroal.dir/libpgagroal/logging.c.o CMakeFiles/pgagroal.dir/libpgagroal/management.c.o CMakeFiles/pgagroal.dir/libpgagroal/memory.c.o CMakeFiles/pgagroal.dir/libpgagroal/message.c.o CMakeFiles/pgagroal.dir/libpgagroal/network.c.o CMakeFiles/pgagroal.dir/libpgagroal/pipeline_perf.c.o CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o CMakeFiles/pgagroal.dir/libpgagroal/pipeline_transaction.c.o CMakeFiles/pgagroal.dir/libpgagroal/pool.c.o CMakeFiles/pgagroal.dir/libpgagroal/prometheus.c.o CMakeFiles/pgagroal.dir/libpgagroal/remote.c.o CMakeFiles/pgagroal.dir/libpgagroal/security.c.o CMakeFiles/pgagroal.dir/libpgagroal/server.c.o CMakeFiles/pgagroal.dir/libpgagroal/shmem.c.o CMakeFiles/pgagroal.dir/libpgagroal/tracker.c.o CMakeFiles/pgagroal.dir/libpgagroal/utils.c.o CMakeFiles/pgagroal.dir/libpgagroal/worker.c.o  /usr/lib64/libev.so /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libsystemd.so 
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o: in function `pgagroal_init_configuration':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:69: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o: in function `pgagroal_read_configuration':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:164: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o: in function `pgagroal_validate_configuration':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:780: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o: in function `pgagroal_read_hba_configuration':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:1001: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o: in function `pgagroal_validate_hba_configuration':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:1080: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/configuration.c.o:/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/configuration.c:1143: more undefined references to `shmem' follow
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o: in function `session_stop':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:137: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o: in function `session_start':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:123: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o: in function `session_periodic':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:163: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:165: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:171: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o: in function `client_active':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:372: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:372: undefined reference to `pipeline_shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_session.c.o: in function `session_client':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_session.c:207: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_transaction.c.o: in function `transaction_server':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_transaction.c:306: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_transaction.c.o: in function `transaction_client':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_transaction.c:192: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_transaction.c.o: in function `transaction_stop':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_transaction.c:155: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pipeline_transaction.c.o: in function `transaction_start':
/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pipeline_transaction.c:102: undefined reference to `shmem'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/pgagroal.dir/libpgagroal/pool.c.o:/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/src/libpgagroal/pool.c:1046: more undefined references to `shmem' follow
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/pgagroal.dir/build.make:365: src/libpgagroal.so.1.0.0] Error 1
make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/pgagroal-1.0.0/build'
make[1]: *** [CMakeFiles/Makefile2:251: src/CMakeFiles/pgagroal.dir/all] Error 2

0.9.2 works fine.

@darix darix added the bug Something isn't working label Nov 25, 2020
@jesperpedersen
Copy link
Collaborator

Just to be sure can you share the output from

gcc --version
ld --version

?

@jesperpedersen jesperpedersen self-assigned this Nov 25, 2020
@darix
Copy link
Author

darix commented Nov 25, 2020

the problem probably comes from:

        -DCMAKE_SHARED_LINKER_FLAGS="-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \

If I remove the -Wl,--no-undefined it works. and for a normal shared library it makes sense that there are no undefined symbols.

ld --version ; gcc --version
GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.35.1.20201112-1
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
gcc (SUSE Linux) 10.2.1 20201117 [revision 98ba03ffe0b9f37b4916ce6238fad754e00d720b]
Copyright (C) 2020 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.

@jesperpedersen
Copy link
Collaborator

Thanks for confirming !

Yeah, I move the requirements for the shared memory segments in d53372b, so will have a think about that.

Is -Wl,--no-undefined mandatory for OpenSuSE ?

@darix
Copy link
Author

darix commented Nov 25, 2020

I could configure it away, but I would prefer not to.

jesperpedersen added a commit that referenced this issue Dec 1, 2020
jesperpedersen added a commit that referenced this issue Dec 1, 2020
@jesperpedersen
Copy link
Collaborator

Hack committed and released; I'll likely change it later on master.

Thanks for the report !

@dtseiler
Copy link

FYI looks like this fix broke building on Ubuntu 18.04 since it requires a newer version of cmake. See #119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants