Giter VIP home page Giter VIP logo

Comments (13)

mgerhardy avatar mgerhardy commented on June 3, 2024
if (FIPS_LINUX)
    check_function_exists(__atomic_fetch_add_4 HAVE___ATOMIC_FETCH_ADD_4)
    if (NOT HAVE___ATOMIC_FETCH_ADD_4)
        check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
        if (HAVE_LIBATOMIC)
            fips_deps(atomic)
        endif()
    endif()
endif()

from fips.

floooh avatar floooh commented on June 3, 2024

Hmm interesting, didn't know that. What system(s) requires this?

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

At least my system which is a ubuntu 14.10. I will check the relevant lib
versions once i am on the machine again - if needed.
Am 12.02.2015 17:40 schrieb "Andre Weissflog" [email protected]:

Hmm interesting, didn't know that. What system(s) requires this?


Reply to this email directly or view it on GitHub
#54 (comment).

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

Just digged a little bit deeper: They've moved atomics implementation since gcc 4.8 into libatomic.a - and this must be linked whenever you use atomics.

Do you think this patch can make it into fips? Or should I change something?

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

Well, in fact gcc < 4.8 didn't support atomics at all... - just to clarify.

from fips.

floooh avatar floooh commented on June 3, 2024

I'd like to figure out first why Oryol is linking at all on Linux with gcc4.8 without explicitly linking libatomic... :) For instance I'm using std::atomic_exchange_explicit() and some operators (++, ...).

I'm on Linux Mint 17.1, based on Ubuntu 14.04.1 LTS
gcc -- version: gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

from fips.

floooh avatar floooh commented on June 3, 2024

So... it looks like it worked in older Ubuntu and/or gcc versions but no longer in newer ones? What's your exact gcc version?

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.10
Release: 14.10
Codename: utopic

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

btw. oryol links for me, too - which is very weird. Maybe not all symbols are put into the atomic lib.

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

in simpleai this works:

cd /home/mgerhardy/dev/simpleai/src/run && /usr/bin/cmake -E cmake_link_script CMakeFiles/simpleai-run.dir/link.txt --verbose=1
/usr/bin/c++ -std=c++11 -Wall -Wextra -fno-exceptions CMakeFiles/simpleai-run.dir/GameEntity.cpp.o CMakeFiles/simpleai-run.dir/Main.cpp.o -o simpleai-run -L/home/mgerhardy/dev/simpleai/src/ai -rdynamic ../ai/libsimpleai.a -lpthread -latomic ../libs/lua/liblua.a -ldl -Wl,-rpath,/home/mgerhardy/dev/simpleai/src/ai

while this doesn't:

cd /home/mgerhardy/dev/simpleai/src/run && /usr/bin/cmake -E cmake_link_script CMakeFiles/simpleai-run.dir/link.txt --verbose=1
/usr/bin/c++ -std=c++11 -Wall -Wextra -fno-exceptions CMakeFiles/simpleai-run.dir/GameEntity.cpp.o CMakeFiles/simpleai-run.dir/Main.cpp.o -o simpleai-run -L/home/mgerhardy/dev/simpleai/src/ai -rdynamic ../ai/libsimpleai.a -lpthread -latomic ../libs/lua/liblua.a -ldl -Wl,-rpath,/home/mgerhardy/dev/simpleai/src/ai

the only difference is -latomic

CMakeFiles/simpleai-run.dir/GameEntity.cpp.o: In Funktion std::atomic<ai::Vector3f>::store(ai::Vector3f, std::memory_order)': GameEntity.cpp:(.text._ZNSt6atomicIN2ai8Vector3fEE5storeES1_St12memory_order[_ZNSt6atomicIN2ai8Vector3fEE5storeES1_St12memory_order]+0x27): Nicht definierter Verweis auf__atomic_store'
CMakeFiles/simpleai-run.dir/GameEntity.cpp.o: In Funktion std::atomic<ai::Vector3f>::load(std::memory_order) const': GameEntity.cpp:(.text._ZNKSt6atomicIN2ai8Vector3fEE4loadESt12memory_order[_ZNKSt6atomicIN2ai8Vector3fEE4loadESt12memory_order]+0x42): Nicht definierter Verweis auf__atomic_load'
collect2: error: ld returned 1 exit status

from fips.

floooh avatar floooh commented on June 3, 2024

Strange. Would you mind providing a pull request for fips? I think this should go into cmake-toolchains/linux.toolchain.cmake. There's already a couple of standard libs defined (-lpthread and -lrt),
additionally to your detection whether atomic exists, you could also limit this to gcc with an if (FIPS_GCC).

from fips.

mgerhardy avatar mgerhardy commented on June 3, 2024

created a pull request.

while we are on it - there are systems that don't have librt - they have clock_gettime somewhere else (afair in libc directly - but my memories might be wrong, fixed that for ufoai a felt decade ago)

I will try to fix it in a proper cmake way and provide another pull request.

from fips.

floooh avatar floooh commented on June 3, 2024

Cleaning up leftover tickets...

from fips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.